Commit c3d4fb4a authored by liqin's avatar liqin 💬

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

parents e9e0ae30 f89c1ddf
...@@ -6,7 +6,7 @@ import java.awt.image.BufferedImage; ...@@ -6,7 +6,7 @@ import java.awt.image.BufferedImage;
import java.io.File; import java.io.File;
import javax.imageio.ImageIO; import javax.imageio.ImageIO;
import org.bytedeco.javacpp.opencv_core;
import org.bytedeco.javacv.FFmpegFrameGrabber; import org.bytedeco.javacv.FFmpegFrameGrabber;
import org.bytedeco.javacv.Frame; import org.bytedeco.javacv.Frame;
import org.bytedeco.javacv.Java2DFrameConverter; import org.bytedeco.javacv.Java2DFrameConverter;
...@@ -44,7 +44,7 @@ public class FrameGrabberKit { ...@@ -44,7 +44,7 @@ public class FrameGrabberKit {
* 获取指定视频的帧并保存为图片至指定目录 * 获取指定视频的帧并保存为图片至指定目录
* *
* @param videofile 源视频文件路径 * @param videofile 源视频文件路径
* @param framefile 截取帧的图片存放路径 例:F:/hfkjrecorder/target/4.jpg * @param framefile 截取帧的图片存放路径 例:F:\hfkjrecorder\target\4.jpg
* @throws Exception * @throws Exception
*/ */
public static void fetchFrame(String videofile, String framefile) throws Exception { public static void fetchFrame(String videofile, String framefile) throws Exception {
...@@ -82,5 +82,4 @@ public class FrameGrabberKit { ...@@ -82,5 +82,4 @@ public class FrameGrabberKit {
//ff.flush(); //ff.flush();
ff.stop(); ff.stop();
} }
} }
package cn.wisenergy.mapper;
import cn.wisenergy.model.app.CustomerService;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* 专属客服对应表
* @author zw
*/
public interface CustomerServiceMapper extends BaseMapper<CustomerService> {
/**
* 随机获得一条专属客服记录
* @return
*/
CustomerService randService();
}
package cn.wisenergy.mapper;
import cn.wisenergy.model.app.MonthManure;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
/**
* @author 86187
*/
public interface MonthManureMapper extends BaseMapper<MonthManure> {
/**
* 添加月度肥料
*
* @param monthManure 月度肥料信息
* @return 1
*/
int add(MonthManure monthManure);
/**
* 编辑月度肥料
*
* @param monthManure 月度肥料信息
* @return 1
*/
int edit(MonthManure monthManure);
/**
* 通过年月获取月度肥料剩余奖金信息
*
* @param yearMonth 年月
* @return 月度肥料剩余奖金信息
*/
MonthManure queryByTime(@Param("yearMonth") String yearMonth);
}
...@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; ...@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.math.BigInteger;
import java.util.List; import java.util.List;
...@@ -20,7 +21,7 @@ public interface ShopZxMapper extends BaseMapper<shopZx> { ...@@ -20,7 +21,7 @@ public interface ShopZxMapper extends BaseMapper<shopZx> {
* @param * @param
* @return 1 * @return 1
*/ */
int zxadd(@Param("zxUrl") String zxUrl,@Param("userId") String userId,@Param("zxName") String zxName,@Param("zxField") String zxField,@Param("imgUrl") String imgUrl,@Param("zxAddress") String zxAddress); int zxadd(@Param("zxUrl") String zxUrl,@Param("zxField") String zxField,@Param("zxAddress") String zxAddress,@Param("inviteCode") String inviteCode,@Param("zxDate") Long zxDate);
/** /**
* 查询资讯数据 * 查询资讯数据
......
...@@ -81,4 +81,29 @@ public interface TradeRecordMapper extends BaseMapper<TradeRecord> { ...@@ -81,4 +81,29 @@ public interface TradeRecordMapper extends BaseMapper<TradeRecord> {
*/ */
Double queryMonthAward(@Param("userId") String userId, @Param("yearMonth") Date yearMonth); Double queryMonthAward(@Param("userId") String userId, @Param("yearMonth") Date yearMonth);
/**
* 获取本月新增奖金(月度肥料)
*
* @param yearMonth 时间
* @return 本月新增奖金
*/
Double queryMonthGrow(@Param("yearMonth") Date yearMonth);
/**
* 获取历史累计奖金 -时间小于yearMonth (月度肥料)
*
* @param yearMonth 时间
* @return 本月新增奖金
*/
Double queryAllAward(@Param("yearMonth") Date yearMonth);
/**
* 获取用户等级 月奖金---时间小于yearMonth (月度肥料)
*
* @param userLevel 用户等级
* @param yearMonth 时间
* @return 用户等级 月奖金
*/
Double queryByUserLevel(@Param("userLevel") Integer userLevel, @Param("yearMonth") Date yearMonth);
} }
...@@ -107,7 +107,6 @@ public interface UsersMapper extends BaseMapper<User> { ...@@ -107,7 +107,6 @@ public interface UsersMapper extends BaseMapper<User> {
User edit1(int userLevel, String intiveCode,String userId); User edit1(int userLevel, String intiveCode,String userId);
Integer edit2(User user);
Integer getuserIdById(@Param("userId")String userId); Integer getuserIdById(@Param("userId")String userId);
Integer BYQMById(@Param("userId")String userId); Integer BYQMById(@Param("userId")String userId);
/** /**
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.wisenergy.mapper.CustomerServiceMapper">
<resultMap id="bankMap" type="cn.wisenergy.model.app.CustomerService">
<id column="id" property="id"/>
<result column="wechat_id" property="wechatId"/>
<result column="wechat_img_url" property="wechatImgUrl"/>
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
</resultMap>
<sql id="table">
customer_service
</sql>
<sql id="cols_all">
id,
<include refid="cols_exclude_id"/>
</sql>
<sql id="cols_exclude_id">
wechat_id,wechat_img_url,create_time,update_time
</sql>
<sql id="vals">
#{wechatId},#{wechatImgUrl},now(),now()
</sql>
<sql id="updateCondition">
<if test="wechatId != null">service_id = #{wechatId},</if>
<if test="wechatImgUrl != null">wechat_img_url = #{wechatImgUrl},</if>
update_time =now()
</sql>
<sql id="criteria">
<if test="id != null">id = #{id}</if>
<if test="wechatId != null">and service_id = #{wechatId}</if>
<if test="wechatImgUrl != null">and wechat_img_url = #{wechatImgUrl}</if>
<if test="createTime != null">and create_time &gt;= #{createTime}</if>
<if test="updateTime != null">and #{updateTime} &gt;= update_time</if>
</sql>
<select id="randService" resultType="cn.wisenergy.model.app.CustomerService">
select
<include refid="cols_all"/>
from
<include refid="table"/>
order by rand() limit 1
</select>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.wisenergy.mapper.MonthManureMapper">
<resultMap id="monthMap" type="cn.wisenergy.model.app.MonthManure">
<id column="id" property="id"/>
<result column="year_month" property="yearMonth"/>
<result column="manure_award" property="manureAward"/>
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
</resultMap>
<sql id="table">
month_manure
</sql>
<sql id="cols_all">
id,
<include refid="cols_exclude_id"/>
</sql>
<sql id="cols_exclude_id">
year_month,manure_award,create_time,update_time
</sql>
<sql id="vals">
#{yearMonth},#{manureAward},now(),now()
</sql>
<sql id="updateCondition">
<if test="yearMonth != null">year_month =#{yearMonth},</if>
<if test="manureAward != null">manure_award = #{manureAward},</if>
update_time =now()
</sql>
<sql id="criteria">
<if test="id != null">id = #{id}</if>
<if test="yearMonth != null">and year_month =#{yearMonth}</if>
<if test="manureAward != null">and manure_award = #{manureAward}</if>
<if test="createTime != null">and create_time &gt;= #{createTime}</if>
<if test="updateTime != null">and #{updateTime} &gt;= update_time</if>
</sql>
<insert id="add" parameterType="cn.wisenergy.model.app.MonthManure" keyProperty="id" useGeneratedKeys="true">
insert into
<include refid="table"/>
(<include refid="cols_exclude_id"/>)
value(
<include refid="vals"/>
)
</insert>
<update id="edit" parameterType="cn.wisenergy.model.app.MonthManure">
UPDATE
<include refid="table"/>
<set>
<include refid="updateCondition"/>
</set>
<where>
id = #{id}
</where>
</update>
<select id="queryByTime" resultType="cn.wisenergy.model.app.MonthManure">
SELECT
<include refid="cols_all"/>
FROM
<include refid="table"/>
<where>
<if test="yearMonth != null and yearMonth != ''">
year_month=#{yearMonth}
</if>
</where>
</select>
</mapper>
\ No newline at end of file
...@@ -2,31 +2,30 @@ ...@@ -2,31 +2,30 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.wisenergy.mapper.ShopZxMapper"> <mapper namespace="cn.wisenergy.mapper.ShopZxMapper">
<resultMap id="zxMap" type="cn.wisenergy.model.app.shopZx"> <resultMap id="zxMap" type="cn.wisenergy.model.app.shopZx">
<id column="zxid" property="zxid"/> <id column="zx_id" property="zxid"/>
<result column="zxUrl" property="zxUrl"/> <result column="zx_url" property="zxUrl"/>
<result column="zxLikes" property="zxLikes"/> <result column="zx_likes" property="zxLikes"/>
<result column="userid" property="userid"/> <result column="invite_code" property="inviteCode"/>
<result column="zxName" property="zxName"/> <result column="zx_to_examine" property="zxToExamine"/>
<result column="zxShenHe" property="zxShenHe"/> <result column="zx_field" property="zxField"/>
<result column="zxField" property="zxField"/> <result column="zx_address" property="zxAddress"/>
<result column="zxAddress" property="zxAddress"/> <result column="zx_date" property="zxDate"/>
<result column="imgUrl" property="imgUrl"/>
</resultMap> </resultMap>
<sql id="table"> <sql id="table">
shop_zx shop_zx
</sql> </sql>
<sql id="cols_all"> <sql id="cols_all">
zxid, zx_id as zxid,
<include refid="cols_exclude_id"/> <include refid="cols_exclude_id"/>
</sql> </sql>
<sql id="cols_exclude_id"> <sql id="cols_exclude_id">
zxUrl,userId,zxName,zxField,imgUrl,zxAddress zx_url,zx_field,zx_address,invite_code,zx_date
</sql> </sql>
<sql id="vals"> <sql id="vals">
#{zxUrl},#{userId},#{zxName},#{zxField},#{imgUrl},#{zxAddress} #{zxUrl},#{zxField},#{zxAddress},#{inviteCode},#{zxDate}
</sql> </sql>
<!--资讯内容插入--> <!--资讯内容插入-->
<insert id="zxadd" parameterType="cn.wisenergy.model.app.shopZx"> <insert id="zxadd" parameterType="cn.wisenergy.model.app.shopZx">
...@@ -38,35 +37,25 @@ ...@@ -38,35 +37,25 @@
) )
</insert> </insert>
<!--资讯内容插入-->
<!--<insert id="zxadd" parameterType="cn.wisenergy.model.app.shopZx" >-->
<!--INSERT INTO-->
<!--(zxUrl, userId,zxName,zxField,imgUrl)-->
<!--VALUES(-->
<!--#{zxUrl},#{userid},#{zxName},#{zxField},#{imgUrl}-->
<!--)-->
<!--</insert>-->
<!--资讯内容倒叙查询--> <!--资讯内容倒叙查询-->
<select id="findAll" parameterType="java.lang.Integer" resultType="cn.wisenergy.model.app.shopZx"> <select id="selectPage" parameterType="java.lang.Integer" resultType="cn.wisenergy.model.app.shopZx">
select zxid as zxid,zxUrl as zxUrl, select
zxLikes as zxLikes,userid as userid,zxName as zxName, b.zx_id as zxid,
zxShenHe as zxShenHe,zxField as zxField,zxDate as zxDate, b.zx_url as zxUrl,
imgUrl as imgUrl,zxAddress as zxAddress from shop_zx order by zxid desc limit #{pageNum},#{pageSize} b.zx_likes as zxLikes,
b.zx_field as zxField,
b.zx_date as zxDate,
b.zx_address as zxAddress,
b.invite_code as inviteCode,
a.user_id as userId,
a.head_image as headImage
from shop_zx b inner join user_info a ON a.invite_code=b.invite_code
WHERE zx_to_examine!=0
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>
<select id="selectPage" resultType="cn.wisenergy.model.app.shopZx">
select zxid as zxid,zxUrl as zxUrl,
zxLikes as zxLikes,userid as userid,zxName as zxName,
zxShenHe as zxShenHe,zxField as zxField,zxDate as zxDate,
imgUrl as imgUrl,zxAddress as zxAddress from shop_zx order by zxid desc limit #{pageNum},#{pageSize}
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -141,14 +141,62 @@ ...@@ -141,14 +141,62 @@
from from
<include refid="table"/> <include refid="table"/>
<where> <where>
(trade_type=2 or status=0) (trade_type=4 or trade_type=7)
and status=0
<if test="userId"> <if test="userId">
and user_id=#{userId} and user_id=#{userId}
</if> </if>
<if test="yearMonth != null"> <if test="yearMonth != null">
AND( AND(
YEAR(update_time) = YEAR(#{yearMonth}) YEAR(create_time) = YEAR(#{yearMonth})
AND MONTH(update_time) = MONTH(#{yearMonth})) AND MONTH(create_time) = MONTH(#{yearMonth}))
</if>
</where>
</select>
<select id="queryMonthGrow" resultType="java.lang.Double">
select sum(money)
from
<include refid="table"/>
<where>
(trade_type=4 or trade_type=7)
and status=0
<if test="yearMonth != null">
AND(
YEAR(create_time) = YEAR(#{yearMonth})
AND MONTH(create_time) = MONTH(#{yearMonth}))
</if>
</where>
</select>
<select id="queryAllAward" resultType="java.lang.Double">
select sum(money)
from
<include refid="table"/>
<where>
(trade_type=4 or trade_type=7)
and status=0
<if test="yearMonth != null">
and create_time &lt; #{yearMonth}
</if>
</where>
</select>
<select id="queryByUserLevel" resultType="java.lang.Double">
select sum(t.money)
from trade_record t,user_info u
<where>
(t.trade_type=4 or t.trade_type=7)
and t.status=0
and t.user_id=u.user_id
<if test="yearMonth != null">
and t.create_time &lt; #{yearMonth}
AND(
YEAR(t.create_time) = YEAR(#{yearMonth})
AND MONTH(t.create_time) = MONTH(#{yearMonth}))
</if>
<if test="userLevel != null">
and u.user_level=#{userLevel}
</if> </if>
</where> </where>
</select> </select>
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
</sql> </sql>
<sql id="cols_exclude_id"> <sql id="cols_exclude_id">
user_id,password, head_image,user_level,cross_border_line,id_card_number,fans_nickname,fans_id, invite_code, user_id,password,head_image,user_level,cross_border_line,id_card_number,fans_nickname,fans_id, invite_code,
be_invited_code,create_time,update_time be_invited_code,create_time,update_time
</sql> </sql>
...@@ -100,11 +100,13 @@ ...@@ -100,11 +100,13 @@
from from
<include refid="table"/> <include refid="table"/>
<where> <where>
be_invited_code=1
<if test="createTime != null"> <if test="createTime != null">
YEAR(create_time) = YEAR(#{createTime}) and(YEAR(create_time) = YEAR(#{createTime})
AND MONTH(create_time) = MONTH(#{createTime}) AND MONTH(create_time) = MONTH(#{createTime}))
</if> </if>
</where> </where>
order by create_time desc
</select> </select>
<select id="getByUserId" resultType="cn.wisenergy.model.app.User"> <select id="getByUserId" resultType="cn.wisenergy.model.app.User">
...@@ -237,6 +239,7 @@ ...@@ -237,6 +239,7 @@
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,
...@@ -308,17 +311,5 @@ ...@@ -308,17 +311,5 @@
</where> </where>
</select> </select>
<update id="updateByUserid">
update
<include refid="table"/>
set
(user_level,invite_code,)
value
(#{userLevel},#{inviteCode})
<where>
user_id=#{userId}
</where>
</update>
</mapper> </mapper>
package cn.wisenergy.model.app;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 专属客服实体类
*/
@Data
@ApiModel(value = "customerService")
public class CustomerService implements Serializable {
private static final long serialVersionUID = 4893386302084721578L;
/**
* 主键id
*/
@ApiModelProperty(name = "id", value = "主键id")
private int id;
/**wechatImgUrl
* 专属客服id(微信号)
*/
@ApiModelProperty(name = "wechatId", value = "专属客服id(微信号)")
private String wechatId;
/**
* 专属客服微信二维码图片地址
*/
@ApiModelProperty(name = "wechatImgUrl", value = "专属客服id(微信号)")
private String wechatImgUrl;
/**
* 创建时间
*/
@ApiModelProperty(name = "createTime", value = "创建时间")
private Date createTime;
/**
* 修改时间
*/
@ApiModelProperty(name = "updateTime", value = "修改时间")
private Date updateTime;
}
...@@ -29,50 +29,50 @@ public class MonthAward implements Serializable { ...@@ -29,50 +29,50 @@ public class MonthAward implements Serializable {
* 与上一次比较的增长奖金 * 与上一次比较的增长奖金
*/ */
@ApiModelProperty(name = "growthAward", value = "与上一次比较的增长额度") @ApiModelProperty(name = "growthAward", value = "与上一次比较的增长额度")
private BigDecimal growthAward; private Double growthAward;
/** /**
* 历史奖金总额 * 历史奖金总额
*/ */
@ApiModelProperty(value = "历史奖金总额",name="awardTotal") @ApiModelProperty(value = "历史奖金总额",name="awardTotal")
private BigDecimal awardTotal; private Double awardTotal;
/** /**
* 本月累计奖金总额(本月新增+上月没有分出去的月度肥料奖金) * 本月累计奖金总额(本月新增+上月没有分出去的月度肥料奖金)
*/ */
@ApiModelProperty(value = "本月累计奖金总额",name="monthAwardTotal") @ApiModelProperty(value = "本月累计奖金总额",name="monthAwardTotal")
private BigDecimal monthAwardTotal; private Double monthAwardTotal;
/** /**
* 本月新增 * 本月新增
*/ */
@ApiModelProperty(value = "本月新增",name="monthIncreased") @ApiModelProperty(value = "本月新增",name="monthIncreased")
private BigDecimal monthIncreased; private Double monthIncreased;
/** /**
* 黄金树月奖励总额 * 黄金树月奖励总额
*/ */
@ApiModelProperty(value = "黄金树月奖励总额",name="goldAward") @ApiModelProperty(value = "黄金树月奖励总额",name="goldAward")
private BigDecimal goldAward; private Double goldAward;
/** /**
* 农场主月奖励总额 * 农场主月奖励总额
*/ */
@ApiModelProperty(value = "农场主月奖励总额",name="farmerAward") @ApiModelProperty(value = "农场主月奖励总额",name="farmerAward")
private BigDecimal farmerAward; private Double farmerAward;
/** /**
* 森林之星月奖励总额 * 森林之星月奖励总额
*/ */
@ApiModelProperty(value = "森林之星月奖励总额",name="forestStartAward") @ApiModelProperty(value = "森林之星月奖励总额",name="forestStartAward")
private BigDecimal forestStartAward; private Double forestStartAward;
/** /**
* 森田合伙人月奖励总额 * 森田合伙人月奖励总额
*/ */
@ApiModelProperty(value = "森田合伙人月奖励总额",name="partnerAward") @ApiModelProperty(value = "森田合伙人月奖励总额",name="partnerAward")
private BigDecimal partnerAward; private Double partnerAward;
private Date createTime; private Date createTime;
......
package cn.wisenergy.model.app;
import lombok.Data;
import java.util.Date;
/**
*@ Description: 月度肥料实体类
*@ Author : 86187
*@ Date : 2021/3/10 10:05
* @author 86187
*/
@Data
public class MonthManure {
/**
* 主键id
*/
private Integer id;
/**
* 年月
*/
private String yearMonth;
/**
* 月度肥料余额
*/
private Double manureAward;
private Date createTime;
private Date updateTime;
}
...@@ -32,9 +32,9 @@ public class TradeRecord implements Serializable { ...@@ -32,9 +32,9 @@ public class TradeRecord implements Serializable {
private String userId; private String userId;
/** /**
* 交易记录类型 1:提现 2:订单返佣 3:订单下单 4:月度肥料 5:培育奖 6:工资奖励 * 交易记录类型 1:提现 2:订单返佣 3:订单下单 4:月度肥料 5:培育奖 6:工资奖励 7:进步奖
*/ */
@ApiModelProperty(name = "tradeType", value = "交易类型 1:提现 2:订单返佣 3:订单下单 4:月度肥料 5:培育奖 6:工资") @ApiModelProperty(name = "tradeType", value = "交易类型 1:提现 2:订单返佣 3:订单下单 4:月度肥料 5:培育奖 6:工资 7:进步奖")
private Integer tradeType; private Integer tradeType;
/** /**
......
...@@ -28,6 +28,7 @@ public class User extends Model<User> implements Serializable{ ...@@ -28,6 +28,7 @@ public class User extends Model<User> implements Serializable{
@ApiModelProperty(name = "id", value = "用户主键id") @ApiModelProperty(name = "id", value = "用户主键id")
private Integer id; private Integer id;
/** /**
* 手机号作为用户账号 * 手机号作为用户账号
*/ */
......
...@@ -44,6 +44,11 @@ public class UsersDto extends User implements Serializable { ...@@ -44,6 +44,11 @@ public class UsersDto extends User implements Serializable {
*/ */
private String beInvitedCode; private String beInvitedCode;
/**
* 用户名称
*/
private Integer userName;
/** /**
* 创建时间 * 创建时间
*/ */
......
...@@ -9,6 +9,7 @@ import io.swagger.annotations.ApiModelProperty; ...@@ -9,6 +9,7 @@ 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.Date;
import java.util.List; import java.util.List;
...@@ -27,95 +28,49 @@ public class shopZx extends Model<shopZx> implements Serializable { ...@@ -27,95 +28,49 @@ public class shopZx extends Model<shopZx> implements Serializable {
/** /**
* 资讯主键id * 资讯主键id
*/ */
@ApiModelProperty(name = "zxid", value = "资讯主键id") @ApiModelProperty(name = "zx_id", value = "资讯主键id")
private Integer zxid; private Integer zxid;
/** /**
* 视频存放地址 * 视频存放地址
*/ */
@ApiModelProperty(name = "zxUrl", value = "视频/图片存放地址") @ApiModelProperty(name = "zx_url", value = "视频/图片存放地址")
private String zxUrl; private String zxUrl;
/** /**
* 用户id(作者id * 用户本人邀请码
*/ */
@ApiModelProperty(name = "userid", value = "用户id(作者id)") @ApiModelProperty(name = "invite_code", value = "用户本人邀请码")
private String userid; private String inviteCode;
/** /**
* 获赞数 * 获赞数
*/ */
@ApiModelProperty(name = "zxLikes", value = "获赞数") @ApiModelProperty(name = "zx_likes", value = "获赞数")
private Integer zxLikes; private Integer zxLikes;
/**
* 视频/图片名称
*/
@ApiModelProperty(name = "zxName", value = "视频/图片名称")
private String zxName;
/** /**
* 审核字段 * 审核字段
*/ */
@ApiModelProperty(name = "zxShenHe", value = "审核字段") @ApiModelProperty(name = "zx_to_examine", value = "审核字段")
private Integer zxShenHe; private Integer zxToExamine;
/** /**
* 资讯文字输入字段 * 资讯文字输入字段
*/ */
@ApiModelProperty(name = "zxField", value = "资讯文字输入字段") @ApiModelProperty(name = "zx_field", value = "资讯文字输入字段")
private String zxField; private String zxField;
/** /**
* 资讯数据创建时间 * 用户发布地址
*/ */
@ApiModelProperty(name = "zxDate", value = "资讯数据创建时间") @ApiModelProperty(name = "zx_address", value = "用户发布地址")
private Date zxDate; private String zxAddress;
/** /**
* 图片存放地址imgUrl,zxAddress,zxField,zxName,userid,zxUrl * 资讯数据创建时间
*/ */
@ApiModelProperty(name = "imgUrl", value = "图片存放地址") @ApiModelProperty(name = "zx_date", value = "资讯数据创建时间")
private String imgUrl; private Long zxDate;
/**
* 用户发布地址
*/
@ApiModelProperty(name = "zxAddress", value = "用户发布地址")
private String zxAddress;
@TableField(exist = false) @TableField(exist = false)
private List<String> askImgList; private List<String> askImgList;
// /**
// * 资讯文件名称
// */
// @ApiModelProperty(name = "fileName", value = "资讯文件名称")
// private String fileName;
//
// /**
// * 资讯文件地址
// */
// @ApiModelProperty(name = "fileDownloadUri", value = "资讯文件地址")
// private String fileDownloadUri;
//
// /**
// * 资讯文件类型
// */
// @ApiModelProperty(name = "fileType", value = "资讯文件类型")
// private String fileType;
//
// /**
// * 资讯文件名称
// */
// @ApiModelProperty(name = "size", value = "资讯文件大小")
// private long size;
//
// public shopZx(String fileName, String fileDownloadUri, String fileType, long size) {
// this.fileName = fileName;
// this.fileDownloadUri = fileDownloadUri;
// this.fileType = fileType;
// this.size = size;
// }
} }
...@@ -21,50 +21,50 @@ public class MonthAwardVo { ...@@ -21,50 +21,50 @@ public class MonthAwardVo {
* 与上一次比较的增长奖金 * 与上一次比较的增长奖金
*/ */
@ApiModelProperty(name = "growthAward", value = "与上一次比较的增长额度") @ApiModelProperty(name = "growthAward", value = "与上一次比较的增长额度")
private BigDecimal growthAward; private Double growthAward;
/** /**
* 历史奖金总额 * 历史奖金总额
*/ */
@ApiModelProperty(value = "历史奖金总额",name="awardTotal") @ApiModelProperty(value = "历史奖金总额",name="awardTotal")
private BigDecimal awardTotal; private Double awardTotal;
/** /**
* 本月累计奖金总额(本月新增+上月没有分出去的月度肥料奖金) * 本月累计奖金总额(本月新增+上月没有分出去的月度肥料奖金)
*/ */
@ApiModelProperty(value = "本月累计奖金总额",name="monthAwardTotal") @ApiModelProperty(value = "本月累计奖金总额",name="monthAwardTotal")
private BigDecimal monthAwardTotal; private Double monthAwardTotal;
/** /**
* 本月新增 * 本月新增
*/ */
@ApiModelProperty(value = "本月新增",name="monthIncreased") @ApiModelProperty(value = "本月新增",name="monthIncreased")
private BigDecimal monthIncreased; private Double monthIncreased;
/** /**
* 黄金树月奖励总额 * 黄金树月奖励总额
*/ */
@ApiModelProperty(value = "黄金树月奖励总额",name="goldAward") @ApiModelProperty(value = "黄金树月奖励总额",name="goldAward")
private BigDecimal goldAward; private Double goldAward;
/** /**
* 农场主月奖励总额 * 农场主月奖励总额
*/ */
@ApiModelProperty(value = "农场主月奖励总额",name="farmerAward") @ApiModelProperty(value = "农场主月奖励总额",name="farmerAward")
private BigDecimal farmerAward; private Double farmerAward;
/** /**
* 森林之星月奖励总额 * 森林之星月奖励总额
*/ */
@ApiModelProperty(value = "森林之星月奖励总额",name="forestStartAward") @ApiModelProperty(value = "森林之星月奖励总额",name="forestStartAward")
private BigDecimal forestStartAward; private Double forestStartAward;
/** /**
* 森田合伙人月奖励总额 * 森田合伙人月奖励总额
*/ */
@ApiModelProperty(value = "森田合伙人月奖励总额",name="partnerAward") @ApiModelProperty(value = "森田合伙人月奖励总额",name="partnerAward")
private BigDecimal partnerAward; private Double partnerAward;
/** /**
* 用户-份额 * 用户-份额
......
...@@ -16,6 +16,12 @@ public class UserAndRecommendVo { ...@@ -16,6 +16,12 @@ public class UserAndRecommendVo {
@ApiModelProperty(value = "用户id", name = "userId") @ApiModelProperty(value = "用户id", name = "userId")
private String userId; private String userId;
/**
* 当月消费金额
*/
@ApiModelProperty(value = "用户头像", name = "headImage")
private String headImage;
/** /**
* 当月消费金额 * 当月消费金额
*/ */
......
...@@ -14,7 +14,7 @@ import java.util.List; ...@@ -14,7 +14,7 @@ import java.util.List;
public interface AccountService { public interface AccountService {
/** /**
* 订单返佣 * 订单返佣-日任务
* @return true or false * @return true or false
*/ */
R<Boolean> orderRebate(); R<Boolean> orderRebate();
...@@ -45,7 +45,7 @@ public interface AccountService { ...@@ -45,7 +45,7 @@ public interface AccountService {
/** /**
* 进步奖收益统计(最大进步奖) * 进步奖收益统计(最大进步奖) -日任务
* *
* @return true or false * @return true or false
*/ */
......
package cn.wisenergy.service.app;
import cn.wisenergy.common.utils.R;
import cn.wisenergy.model.app.CustomerService;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.util.Map;
public interface CustomerServiceService {
CustomerService getServiceByRand();
void setWeChatQRImg(String wechatId, String file);
/**
* 专属客服二维码图片上传
* @param file
* @param request
* @param wechatId
* @return
*/
R uploadImage(MultipartFile file, HttpServletRequest request, String wechatId) throws IOException;
}
package cn.wisenergy.service.app;
/**
*@ Description: 月定时任务接口定义
*@ Author : 86187
*@ Date : 2021/3/10 10:22
* @author 86187
*/
public interface MonthTaskService {
}
...@@ -4,5 +4,10 @@ package cn.wisenergy.service.app; ...@@ -4,5 +4,10 @@ package cn.wisenergy.service.app;
* @author 86187 * @author 86187
*/ */
public interface TradeRecordService { public interface TradeRecordService {
/**
* 月度奖金统计- 数据写入月度奖金实体类
*
* @return true or false
*/
Boolean monthAwardCount();
} }
...@@ -6,6 +6,7 @@ import org.springframework.core.io.Resource; ...@@ -6,6 +6,7 @@ import org.springframework.core.io.Resource;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.math.BigInteger;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -20,31 +21,24 @@ public interface UploadService { ...@@ -20,31 +21,24 @@ public interface UploadService {
* @param request * @param request
* @return * @return
*/ */
Map<String, Object> uploadVideo(MultipartFile file,HttpServletRequest request,String userId,String zxField,String zxAddress) throws Exception; Map<String, Object> uploadVideo(MultipartFile file,HttpServletRequest request,String zxField,String zxAddress,String inviteCode) throws Exception;
/** /**
* TODO 图片文件上传 * TODO 图片文件上传
* @param request * @param request
* @param userId
* @param zxField * @param zxField
* @param zxAddress * @param zxAddress
* @return * @return
*/ */
Map<String, Object> uploadImage(MultipartFile file, HttpServletRequest request, String userId, String zxField, String zxAddress) throws Exception; Map<String, Object> uploadImage(MultipartFile file, HttpServletRequest request, String zxField, String zxAddress,String inviteCode) throws Exception;
/**
* TODO 项目目录下的图片文件上传
* @param request
* @return
*/
Map<String, Object> getImageUrl(HttpServletRequest request) throws Exception;
/** /**
* TODO 多文件上传 * TODO 多文件上传
* @param file * @param file
* @return * @return
*/ */
List imageUpload( MultipartFile[] file,String userId, String zxField, String zxAddress); List imageUpload( MultipartFile[] file, String zxField, String zxAddress,String inviteCode);
String storeFile(MultipartFile file); String storeFile(MultipartFile file);
Resource loadFileAsResource(String fileName); Resource loadFileAsResource(String fileName);
......
...@@ -57,7 +57,19 @@ public interface UserService { ...@@ -57,7 +57,19 @@ public interface UserService {
*/ */
R<AerialDeliveryVo> queryAerialDelivery(); R<AerialDeliveryVo> queryAerialDelivery();
/**
* 设置用户头像
* @param userId 用户id
* @param headImage 头像图片地址
* @return true or false
*/
R<Boolean> setHeadImage(String userId, String headImage); R<Boolean> setHeadImage(String userId, String headImage);
/**
* 设置页面 -邀请码填写
* @param userId 用户id
* @param inviteCode 邀请人邀请码
* @return true or false
*/
R<Boolean> fillInInviteCode(String userId, String inviteCode); R<Boolean> fillInInviteCode(String userId, String inviteCode);
} }
package cn.wisenergy.service.app.impl;
import cn.wisenergy.common.utils.R;
import cn.wisenergy.mapper.CustomerServiceMapper;
import cn.wisenergy.model.app.CustomerService;
import cn.wisenergy.service.app.CustomerServiceService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import java.io.File;
import java.io.IOException;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
@Service
@Slf4j
public class CustomerServiceServiceImpl implements CustomerServiceService {
@Autowired
private CustomerServiceMapper customerServiceMapper;
@Value("${uploadFile.location}")
private String uploadQRImagesLocation;
@Override
public CustomerService getServiceByRand(){
return customerServiceMapper.randService();
}
@Override
public void setWeChatQRImg(String wechatId, String wechatImgUrl) {
CustomerService customerService = new CustomerService();
customerService.setWechatId(wechatId);
customerService.setWechatImgUrl(wechatImgUrl);
customerService.setCreateTime(new Date());
customerService.setUpdateTime(new Date());
customerServiceMapper.insert(customerService);
}
/**
* 专属客服二维码图片文件上传
*/
@Override
public R uploadImage(MultipartFile file, HttpServletRequest request, String wechatId) throws IOException {
String basePath = request.getScheme() + "://" + request.getServerName()
+ ":" + request.getServerPort();
Long time = System.currentTimeMillis();
String originalFilename = file.getOriginalFilename();//文件原始名称
String suffixName = originalFilename.substring(originalFilename.lastIndexOf("."));//从最后一个.开始截取。截取zxName的后缀名
String newName = time+suffixName; //文件新名称
//设置文件存储路径,可以存放在你想要指定的路径里面
String rootPath="/opt/upload/video/"; //上传图片存放位置
String filePath = rootPath + newName;
File newFile = new File(filePath);
//判断目标文件所在目录是否存在
if(!newFile.getParentFile().exists()){
//如果目标文件所在的目录不存在,则创建父目录
newFile.getParentFile().mkdirs();
}
//将内存中的数据写入磁盘
file.transferTo(newFile);
//入库地址
String serviceUrl = basePath + "/upload/" + newName;
CustomerService customerService = new CustomerService();
customerService.setWechatId(wechatId);
customerService.setWechatImgUrl(serviceUrl);
customerServiceMapper.insert(customerService);
return R.ok("上传成功");
}
}
package cn.wisenergy.service.app.impl;
import cn.wisenergy.service.app.MonthTaskService;
/**
* @author 86187
*/
public class MonthTaskServiceImpl implements MonthTaskService {
}
...@@ -37,6 +37,13 @@ public class RecommendUserServiceImpl implements RecommendUserService { ...@@ -37,6 +37,13 @@ public class RecommendUserServiceImpl implements RecommendUserService {
return recommendUserMapper.getByUserId(userId); return recommendUserMapper.getByUserId(userId);
} }
/**
* 获取我的直推用户信息表
* @param userId
* @param userLevel
* @return
*/
@Override
public List<UserAndRecommendVo> getMyRecommendInfo(String userId, Integer userLevel){ public List<UserAndRecommendVo> getMyRecommendInfo(String userId, Integer userLevel){
//当前用户的邀请码 //当前用户的邀请码
...@@ -46,6 +53,7 @@ public class RecommendUserServiceImpl implements RecommendUserService { ...@@ -46,6 +53,7 @@ public class RecommendUserServiceImpl implements RecommendUserService {
List<UserAndRecommendVo> userAndRecommendVos = new ArrayList<>(); List<UserAndRecommendVo> userAndRecommendVos = new ArrayList<>();
for (User user : byInviteCode) { for (User user : byInviteCode) {
UserAndRecommendVo userAndRecommendVo = new UserAndRecommendVo(); UserAndRecommendVo userAndRecommendVo = new UserAndRecommendVo();
userAndRecommendVo.setHeadImage(user.getHeadImage());
userAndRecommendVo.setUserId(user.getUserId()); userAndRecommendVo.setUserId(user.getUserId());
userAndRecommendVo.setMonthyCount(recommendUserMapper.getByUserId(userId).getMonthyCount()); userAndRecommendVo.setMonthyCount(recommendUserMapper.getByUserId(userId).getMonthyCount());
userAndRecommendVo.setHistoryCount(recommendUserMapper.getByUserId(userId).getHistoryCount()); userAndRecommendVo.setHistoryCount(recommendUserMapper.getByUserId(userId).getHistoryCount());
......
package cn.wisenergy.service.app.impl; package cn.wisenergy.service.app.impl;
import cn.wisenergy.common.utils.DateUtil;
import cn.wisenergy.mapper.MonthAwardMapper;
import cn.wisenergy.mapper.MonthManureMapper;
import cn.wisenergy.mapper.TradeRecordMapper; import cn.wisenergy.mapper.TradeRecordMapper;
import cn.wisenergy.model.app.MonthAward;
import cn.wisenergy.model.app.MonthManure;
import cn.wisenergy.model.app.TradeRecord; import cn.wisenergy.model.app.TradeRecord;
import cn.wisenergy.model.enums.UserLevelEnum;
import cn.wisenergy.service.app.TradeRecordService; import cn.wisenergy.service.app.TradeRecordService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.Date;
/** /**
* @author 86187 * @author 86187
*/ */
@Service @Service
@Slf4j @Slf4j
public class TradeRecordServiceImpl extends ServiceImpl<TradeRecordMapper, TradeRecord> implements TradeRecordService { public class TradeRecordServiceImpl extends ServiceImpl<TradeRecordMapper, TradeRecord> implements TradeRecordService {
@Autowired
private MonthManureMapper monthManureMapper;
@Autowired
private MonthAwardMapper monthAwardMapper;
@Override
public Boolean monthAwardCount() {
MonthAward result = new MonthAward();
//1、获取本月新增奖金
Double monthGrow = baseMapper.queryMonthGrow(new Date());
result.setMonthIncreased(monthGrow);
//2、获取历史奖金金额
Double awardTotal = baseMapper.queryAllAward(new Date());
result.setAwardTotal(awardTotal);
//3、本月累计奖金 =本月新增奖金+上月剩余月度肥料奖金
//获取上月剩余月度肥料奖金
Double monthAwardTotal;
Date date = DateUtil.getLastMonth(new Date());
String yearMonth = DateUtil.convertDateToStr(date, "yyyy-MM");
MonthManure monthManure = monthManureMapper.queryByTime(yearMonth);
if (null == monthManure) {
monthAwardTotal = monthGrow;
} else {
monthAwardTotal = monthGrow + monthManure.getManureAward();
}
result.setMonthAwardTotal(monthAwardTotal);
//4、较上月增长奖金 本月累计奖金-上月累计奖金
//获取上月 累计奖金
Double growthAward;
MonthAward monthAward = monthAwardMapper.getByTime(date);
if (null == monthAward) {
growthAward = monthAwardTotal;
} else {
growthAward = monthAwardTotal - monthAward.getMonthAwardTotal();
}
result.setGrowthAward(growthAward);
//5、获取黄金树本月奖金
Double goldAward = baseMapper.queryByUserLevel(UserLevelEnum.GOLD_TREE.getCode(), new Date());
result.setGoldAward(goldAward);
//6、获取农场主本月奖金
Double farmerAward = baseMapper.queryByUserLevel(UserLevelEnum.FARMER.getCode(), new Date());
result.setFarmerAward(farmerAward);
//7、森林之星月奖金
Double startAward = baseMapper.queryByUserLevel(UserLevelEnum.FOREST_START.getCode(), new Date());
result.setForestStartAward(startAward);
//8、森田合伙人月奖金
Double partnerAward = baseMapper.queryByUserLevel(UserLevelEnum.PARTNER.getCode(), new Date());
result.setPartnerAward(partnerAward);
//9、 判断是否有本月奖金这条数据,没有,新增,有更新值
MonthAward currentMonth = monthAwardMapper.getByTime(new Date());
if (null == currentMonth) {
int count = monthAwardMapper.add(result);
return count != 0;
} else {
int count = monthAwardMapper.edit(result);
return count != 0;
}
}
} }
...@@ -4,8 +4,6 @@ import cn.wisenergy.common.utils.*; ...@@ -4,8 +4,6 @@ import cn.wisenergy.common.utils.*;
import cn.wisenergy.model.app.shopZx; import cn.wisenergy.model.app.shopZx;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import org.apache.commons.io.FilenameUtils;
import org.apache.ibatis.jdbc.Null;
import org.springframework.beans.factory.annotation.Value; 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;
...@@ -21,16 +19,12 @@ import java.nio.file.Paths; ...@@ -21,16 +19,12 @@ import java.nio.file.Paths;
import java.nio.file.StandardCopyOption; import java.nio.file.StandardCopyOption;
import cn.wisenergy.service.app.UploadService; import cn.wisenergy.service.app.UploadService;
import java.io.File; import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.util.*; import java.util.*;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import cn.wisenergy.mapper.ShopZxMapper; import cn.wisenergy.mapper.ShopZxMapper;
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.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.ClassUtils;
/** /**
...@@ -51,12 +45,13 @@ public class UploadServiceImpl implements UploadService { ...@@ -51,12 +45,13 @@ public class UploadServiceImpl implements UploadService {
* 视频文件上传 * 视频文件上传
*/ */
@Override @Override
public Map<String, Object> uploadVideo(MultipartFile file,HttpServletRequest request,String userId,String zxField, String zxAddress) throws Exception { public Map<String, Object> uploadVideo(MultipartFile file,HttpServletRequest request,String zxField,String zxAddress,String inviteCode) throws Exception {
Map<String, Object> resultMap=new HashMap<String, Object>(); Map<String, Object> resultMap=new HashMap<String, Object>();
/**
* http://路径
*/
String basePath = request.getScheme() + "://" + request.getServerName() String basePath = request.getScheme() + "://" + request.getServerName()
+ ":" + request.getServerPort()+"/upload/video/"; + ":" + request.getServerPort()+"/upload/";
Long time = new Date().getTime(); Long time = new Date().getTime();
String fileName = file.getOriginalFilename();//文件原始名称 String fileName = file.getOriginalFilename();//文件原始名称
...@@ -87,8 +82,14 @@ public class UploadServiceImpl implements UploadService { ...@@ -87,8 +82,14 @@ public class UploadServiceImpl implements UploadService {
resultMap.put("videoUrl", videoUrl); resultMap.put("videoUrl", videoUrl);
resultMap.put("imgUrl", imgUrl); resultMap.put("imgUrl", imgUrl);
resultMap.put("returnCode", 200); resultMap.put("returnCode", 0);
String zxUrl=videoUrl;
//System.out.println("上传的文件名为:"+fileName+",后缀名为:"+newFileName); //System.out.println("上传的文件名为:"+fileName+",后缀名为:"+newFileName);
/**
* 生成当前时间戳
*/
Long zxDate= System.currentTimeMillis();
shopZxMapper.zxadd(zxUrl,zxField,zxAddress,inviteCode, zxDate);
return resultMap; return resultMap;
} }
...@@ -96,9 +97,14 @@ public class UploadServiceImpl implements UploadService { ...@@ -96,9 +97,14 @@ public class UploadServiceImpl implements UploadService {
* 图片文件上传 * 图片文件上传
*/ */
@Override @Override
public Map<String, Object> uploadImage(MultipartFile file, HttpServletRequest request,String userId,String zxField, String zxAddress) throws Exception { public Map<String, Object> uploadImage(MultipartFile file, HttpServletRequest request,String zxField, String zxAddress,String inviteCode) throws Exception {
Map<String, Object> resultMap=new HashMap<String, Object>(); Map<String, Object> resultMap=new HashMap<String, Object>();
/**
* 生成当前时间戳
*/
Long zxDate= Long.valueOf(System.currentTimeMillis());
String basePath = request.getScheme() + "://" + request.getServerName() String basePath = request.getScheme() + "://" + request.getServerName()
+ ":" + request.getServerPort()+"/mimi/upload/images/"; + ":" + request.getServerPort()+"/mimi/upload/images/";
...@@ -108,7 +114,7 @@ public class UploadServiceImpl implements UploadService { ...@@ -108,7 +114,7 @@ public class UploadServiceImpl implements UploadService {
String suffixName = zxName.substring(zxName.lastIndexOf("."));//从最后一个.开始截取。截取zxName的后缀名 String suffixName = zxName.substring(zxName.lastIndexOf("."));//从最后一个.开始截取。截取zxName的后缀名
String newzxName = time+suffixName; //文件新名称 String newzxName = time+suffixName; //文件新名称
//设置文件存储路径,可以存放在你想要指定的路径里面 //设置文件存储路径,可以存放在你想要指定的路径里面
String rootPath="D:/mimi/"+File.separator+"upload/images/"; //上传图片存放位置 String rootPath="/opt/upload/video/"; //上传图片存放位置
String filePath = rootPath+newzxName; String filePath = rootPath+newzxName;
File newFile = new File(filePath); File newFile = new File(filePath);
...@@ -121,77 +127,25 @@ public class UploadServiceImpl implements UploadService { ...@@ -121,77 +127,25 @@ public class UploadServiceImpl implements UploadService {
//将内存中的数据写入磁盘 //将内存中的数据写入磁盘
file.transferTo(newFile); file.transferTo(newFile);
//图片上传保存url //图片上传保存url
String imgUrl = basePath + newzxName; String zxUrl = basePath + newzxName;
resultMap.put("imgUrl", imgUrl); resultMap.put("zxUrl", zxUrl);
resultMap.put("returnCode", 0); resultMap.put("returnCode", 0);
String zxUrl=null; shopZxMapper.zxadd(zxUrl,zxField,zxAddress,inviteCode, zxDate);
shopZxMapper.zxadd(zxUrl,userId,zxName,zxField,imgUrl,zxAddress);
return resultMap; return resultMap;
} }
/**
* 项目目录下的图片文件上传
*/
@Override @Override
public Map<String, Object> getImageUrl(HttpServletRequest request) throws Exception { public List imageUpload(MultipartFile[] files, String zxField, String zxAddress,String inviteCode) {
Map<String,Object> result = new HashMap<String,Object>();
//获取图片在项目路径下的地址
String basePath= ClassUtils.getDefaultClassLoader().getResource("").getPath();
String oldPath=basePath+"/static/images/animate.png";
Long res =System.currentTimeMillis(); /**
//设置文件存储路径,可以存放在你想要指定的路径里面 * 生成当前时间戳
String rootPath="D:/mimi/"+File.separator+"upload/images/"; */
// 新文件名 Long zxDate= Long.valueOf(System.currentTimeMillis());
String newzxName =res + oldPath.substring(oldPath.lastIndexOf("."));
//新文件
File newFile=new File(rootPath+File.separator+newzxName);
//判断文件目录是否存在
if(!newFile.getParentFile().exists()){
//如果目标文件所在的目录不存在,则创建父目录
newFile.getParentFile().mkdirs();
}
//-------把图片文件写入磁盘 start ----------------
FileOutputStream fos = new FileOutputStream(newFile);
//读取本地文件
File localFile = new File(oldPath);
//获取本地文件输入流
InputStream stream=new FileInputStream(localFile);
//写入目标文件
byte[] buffer=new byte[1024*1024];
int byteRead=0;
//stream.read(buffer) 每次读到的数据存放在 buffer 数组中
while((byteRead=stream.read(buffer))!=-1){
//在 buffer 数组中 取出数据 写到 (输出流)磁盘上
fos.write(buffer, 0, byteRead);
fos.flush();
}
fos.close();
stream.close();
//-------把图片文件写入磁盘 end ----------------
//服务器图片地址
String baseURL = request.getScheme() + "://" + request.getServerName()
+ ":" + request.getServerPort()+"/mimi/upload/images/";
String imgUrl=baseURL+newzxName;
result.put("imgUrl", imgUrl);
result.put("returnCode", 0);
return result;
}
//, String userId, String zxField, String zxAddress
@Override
public List imageUpload(MultipartFile[] files,String userId, String zxField, String zxAddress) {
//获取上传图片数量,打印在控制台 //获取上传图片数量,打印在控制台
System.out.println("上传图片数量" + files.length); System.out.println("上传图片数量" + files.length);
//创建集合 //创建集合
List<Map<String, Object>> root = new ArrayList<Map<String, Object>>(); List<Map<String, Object>> root = new ArrayList<Map<String, Object>>();
String imgUrl = "";
String zxName=null;
String fileName=null; String fileName=null;
String zxUrl=null; String zxUrl=null;
// 要上传的目标文件存放的绝对路径 // 要上传的目标文件存放的绝对路径
...@@ -218,16 +172,14 @@ public class UploadServiceImpl implements UploadService { ...@@ -218,16 +172,14 @@ public class UploadServiceImpl implements UploadService {
//重新生成文件名 //重新生成文件名
fileName = UUID.randomUUID() + suffixName; fileName = UUID.randomUUID() + suffixName;
zxUrl=""; zxUrl+=localPath+fileName+",";
zxName += fileName+",";
imgUrl+=localPath+fileName+",";
// shopZxMapper.zxadd(zxUrl,userId,zxName,zxField,imgUrl,zxAddress); // shopZxMapper.zxadd(zxUrl,userId,zxName,zxField,imgUrl,zxAddress);
if (FileUtils.upload(file, localPath, fileName)) { if (FileUtils.upload(file, localPath, fileName)) {
//文件存放的相对路径(一般存放在数据库用于img标签的src) //文件存放的相对路径(一般存放在数据库用于img标签的src)
String relativePath = "img/" + fileName; String relativePath = "img/" + fileName;
result.put("relativePath", relativePath);//前端根据是否存在该字段来判断上传是否成功 result.put("relativePath", relativePath);//前端根据是否存在该字段来判断上传是否成功
result_msg = "图片上传成功"; result_msg = "图片上传成功";
result.put("imgUrl", imgUrl); result.put("zxUrl", zxUrl);
} else { } else {
result_msg = "图片上传失败"; result_msg = "图片上传失败";
...@@ -242,9 +194,7 @@ public class UploadServiceImpl implements UploadService { ...@@ -242,9 +194,7 @@ public class UploadServiceImpl implements UploadService {
String root_json = JSON.toJSONString(root); String root_json = JSON.toJSONString(root);
System.out.println(root_json); System.out.println(root_json);
result.put("returnCode", 0); result.put("returnCode", 0);
System.out.println(zxName); shopZxMapper.zxadd(zxUrl,zxField,zxAddress,inviteCode, zxDate);
System.out.println(imgUrl);
shopZxMapper.zxadd(zxUrl,userId,zxName,zxField,imgUrl,zxAddress);
return root; return root;
} }
...@@ -312,15 +262,14 @@ public class UploadServiceImpl implements UploadService { ...@@ -312,15 +262,14 @@ public class UploadServiceImpl implements UploadService {
public List selectPage(Integer pageNum, Integer pageSize) { public List selectPage(Integer pageNum, Integer pageSize) {
List<shopZx> shopZxList = shopZxMapper.selectPage(pageNum,pageSize); List<shopZx> shopZxList = shopZxMapper.selectPage(pageNum,pageSize);
for (shopZx shopZx : shopZxList) { for (shopZx shopZx : shopZxList) {
String imgUrl = shopZx.getImgUrl(); String zxUrl = shopZx.getZxUrl();
String[] split = StringUtils.split(imgUrl, ","); String[] split = StringUtils.split(zxUrl, ",");
if (null != split){ if (null != split){
List<String> strings = Arrays.asList(split); List<String> strings = Arrays.asList(split);
shopZx.setAskImgList(strings); shopZx.setAskImgList(strings);
} }
// if(null!=shopZx.getImgUrl()){
// shopZx.setAskImgList(Arrays.asList(StringUtils.split(shopZx.getImgUrl(), ",")));
// }
} }
return shopZxList; return shopZxList;
} }
......
...@@ -36,17 +36,15 @@ public class UserServiceImpl extends ServiceImpl<UsersMapper, User> implements U ...@@ -36,17 +36,15 @@ public class UserServiceImpl extends ServiceImpl<UsersMapper, User> implements U
@Autowired @Autowired
private UsersMapper usersMapper; private UsersMapper usersMapper;
//直推表userId
@Autowired @Autowired
private RecommendUserMapper recommendUserMapper; private RecommendUserMapper recommendUserMapper;
//团队表
@Autowired @Autowired
private TeamUserInfoMapper teamUserInfoMapper; private TeamUserInfoMapper teamUserInfoMapper;
@Override @Override
public User getById(String userId) { public User getById(String userId) {
return null; return usersMapper.getByUserId(userId);
} }
@Override @Override
......
This diff is collapsed.
package cn.wisenergy.web.admin.controller.app;
import cn.wisenergy.common.utils.R;
import cn.wisenergy.model.app.CustomerService;
import cn.wisenergy.service.app.CustomerServiceService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
/**
* 专属客服
*/
@Api(tags = "专属客服")
@RestController
@RequestMapping("/customerService")
@Slf4j
public class CustomerServiceController {
@Autowired
private CustomerServiceService customerServiceService;
@ApiOperation(value = "获取专属客服", notes = "获取专属客服")
@GetMapping("/service")
public R getServiceByRand(){
try {
CustomerService serviceByRand = customerServiceService.getServiceByRand();
String wechatImgUrl = serviceByRand.getWechatImgUrl();
return R.ok(wechatImgUrl);
}catch (Exception e){
return R.error("获取失败,请重试");
}
}
/**
* String wechatId ,@RequestParam("file") MultipartFile file,
* 上传专属客服微信二维码图片
*/
@ResponseBody
@PostMapping("/uploadWeChatImg")
public R uploadWeChatQRImg(@RequestParam("file")MultipartFile file,HttpServletRequest request,String wechatId){
try {
customerServiceService.uploadImage(file,request,wechatId);
} catch (IOException e) {
e.printStackTrace();
R.error("上传失败");
}
return R.ok("上传成功");
}
}
...@@ -13,6 +13,8 @@ import org.springframework.web.bind.annotation.RequestMapping; ...@@ -13,6 +13,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.math.BigInteger;
@Api(tags = "短信服务测试,邀请码测试") @Api(tags = "短信服务测试,邀请码测试")
@RestController @RestController
@RequestMapping("/ZX") @RequestMapping("/ZX")
...@@ -53,13 +55,32 @@ public class TestController { ...@@ -53,13 +55,32 @@ public class TestController {
public static void main(String [] args){ public static void main(String [] args){
String str = "1,2,3,4,5,6,7,8,9"; /**
String repStr = str.replaceAll(",",""); * 隐藏中间四位的方法
*/
String phone = "18501234234";
String hidenPhone = phone.replaceAll("(\\d{3})\\d{4}(\\d{4})","$1****$2");
String b = ShareCodeUtil.idToCode(1); // /**
String a= ShareCodeUtil.idToCode(1,0+1); // * 生成当前时间戳
// */
// BigInteger zxDate= BigInteger.valueOf(System.currentTimeMillis());
// /**
// * 去,的写法
// */
// String str = "1,2,3,4,5,6,7,8,9";
// String repStr = str.replaceAll(",","");
//
// /**
// * 调用工具类生成六位邀请码
// */
// String b = ShareCodeUtil.idToCode(1);
// String a= ShareCodeUtil.idToCode(1,0+1);
System.out.println(repStr); System.out.println(hidenPhone);
} }
@ApiOperation(value = "测试短信服务,发送手机号", notes = "测试短信服务,发送手机号", httpMethod = "POST", produces = "application/json; charset=UTF-8") @ApiOperation(value = "测试短信服务,发送手机号", notes = "测试短信服务,发送手机号", httpMethod = "POST", produces = "application/json; charset=UTF-8")
......
...@@ -45,7 +45,6 @@ public class UploadController { ...@@ -45,7 +45,6 @@ public class UploadController {
* *
* @param file * @param file
* @param request * @param request
* @param userId
* @param zxField * @param zxField
* @param zxAddress * @param zxAddress
* @return * @return
...@@ -56,39 +55,32 @@ public class UploadController { ...@@ -56,39 +55,32 @@ public class UploadController {
@ApiImplicitParam(name = "zxField", value = "资讯文字", dataType = "String"), @ApiImplicitParam(name = "zxField", value = "资讯文字", dataType = "String"),
@ApiImplicitParam(name = "file", value = "视频文件", dataType = "MultipartFile"), @ApiImplicitParam(name = "file", value = "视频文件", dataType = "MultipartFile"),
@ApiImplicitParam(name = "zxAddress", value = "资讯发布地址", dataType = "String"), @ApiImplicitParam(name = "zxAddress", value = "资讯发布地址", dataType = "String"),
@ApiImplicitParam(name = "userId", value = "用户手机号(发布人)", required = true, dataType = "String")}) @ApiImplicitParam(name = "inviteCode", value = "用户本人邀请码(发布人)", required = true, dataType = "String")})
@RequestMapping(value = "/uploadVideo", method = RequestMethod.POST) @RequestMapping(value = "/uploadVideo", method = RequestMethod.POST)
public Map<String, Object> uploadVideo(@RequestParam(value = "files")MultipartFile file, HttpServletRequest request, String userId, String zxField, String zxAddress) throws Exception { public Map<String, Object> uploadVideo(@RequestParam(value = "files")MultipartFile file, HttpServletRequest request, String zxField, String zxAddress,String inviteCode) throws Exception {
return uploadService.uploadVideo(file, request, userId, zxField, zxAddress); return uploadService.uploadVideo(file, request, zxField, zxAddress,inviteCode);
} }
/** /**
* 单图片文件上传 * TODO 单图片文件上传
* *
* @param request * @param request
* @return * @return
* @throws Exception * @throws Exception
*/ */
@ApiOperation(value = "资讯信息-文字/单图片上传接口", notes = "返回路径给前台", httpMethod = "POST", produces = "application/json; charset=UTF-8") @ApiOperation(value = "用户头像上传接口", notes = "返回路径给前台", httpMethod = "POST", produces = "application/json; charset=UTF-8")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "zxField", value = "资讯文字", dataType = "String"),
@ApiImplicitParam(name = "file", value = "单图片", dataType = "MultipartFile"), @ApiImplicitParam(name = "file", value = "单图片", dataType = "MultipartFile"),
@ApiImplicitParam(name = "zxAddress", value = "资讯发布地址", dataType = "String"), @ApiImplicitParam(name = "inviteCode", value = "用户本人邀请码(发布人)", required = true, dataType = "String")})
@ApiImplicitParam(name = "userId", value = "用户手机号", required = true, dataType = "String")})
@RequestMapping(value = "/uploadImage", method = RequestMethod.POST) @RequestMapping(value = "/uploadImage", method = RequestMethod.POST)
public Map<String, Object> uploadImage(@RequestParam(value = "files")MultipartFile file, HttpServletRequest request, String userId, String zxField, String zxAddress) throws Exception { public Map<String, Object> uploadImage(@RequestParam(value = "files")MultipartFile file, HttpServletRequest request, String zxField, String zxAddress ,String inviteCode) throws Exception {
return uploadService.uploadImage(file,request,zxField,zxAddress,inviteCode);
return uploadService.uploadImage(file, request, userId, zxField, zxAddress);
} }
/** /**
* 多文件上传 * *
* * * TODO 多文件上传接口
* @param files @RequestParam("file") /**
* * 多文件上传接口
* * T0D0 value = "/fileUpload", produces = "application/json;charset=UTF-8
* * * *
* @return * @return
*/ */
...@@ -99,13 +91,20 @@ public class UploadController { ...@@ -99,13 +91,20 @@ public class UploadController {
@ApiImplicitParam(name = "zxField", value = "资讯文字", dataType = "String"), @ApiImplicitParam(name = "zxField", value = "资讯文字", dataType = "String"),
@ApiImplicitParam(name = "files", value = "多图片", paramType = "form", allowMultiple=true, dataType = "__file"), @ApiImplicitParam(name = "files", value = "多图片", paramType = "form", allowMultiple=true, dataType = "__file"),
@ApiImplicitParam(name = "zxAddress", value = "发表地址", dataType = "String"), @ApiImplicitParam(name = "zxAddress", value = "发表地址", dataType = "String"),
@ApiImplicitParam(name = "userId", value = "用户手机号", required = true, dataType = "String")}) @ApiImplicitParam(name = "inviteCode", value = "用户本人邀请码(发布人)", required = true, dataType = "String")})
@RequestMapping(method = RequestMethod.POST, value = "/multipleImageUpload", headers = "content-type=multipart/form-data") @RequestMapping(method = RequestMethod.POST, value = "/multipleImageUpload", headers = "content-type=multipart/form-data")
public List multipleImageUpload(@RequestParam(value = "files") MultipartFile[] files, String userId, String zxField, String zxAddress) { public List multipleImageUpload(@RequestParam(value = "files") MultipartFile[] files, String zxField, String zxAddress,String inviteCode) {
return uploadService.imageUpload(files, userId, zxField, zxAddress); return uploadService.imageUpload(files, zxField, zxAddress,inviteCode);
} }
/**
* 资讯展示
* @param pageNum
* @param pageSize
* @return
*/
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "pageNum", value = "从几开始", required = true,dataType = "integer"), @ApiImplicitParam(name = "pageNum", value = "从几开始", required = true,dataType = "integer"),
@ApiImplicitParam(name = "pageSize", value = "一页展示数量", required = true, dataType = "Integger")}) @ApiImplicitParam(name = "pageSize", value = "一页展示数量", required = true, dataType = "Integger")})
......
...@@ -15,10 +15,7 @@ import cn.wisenergy.service.app.UserService; ...@@ -15,10 +15,7 @@ import cn.wisenergy.service.app.UserService;
import cn.wisenergy.web.common.BaseController; import cn.wisenergy.web.common.BaseController;
import cn.wisenergy.web.config.JwtConfig; import cn.wisenergy.web.config.JwtConfig;
import cn.wisenergy.web.shiro.JwtUtil; import cn.wisenergy.web.shiro.JwtUtil;
import io.swagger.annotations.Api; import io.swagger.annotations.*;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -110,7 +107,9 @@ public class UserController extends BaseController { ...@@ -110,7 +107,9 @@ public class UserController extends BaseController {
@ApiOperation(value = "获取用户我的直推信息", notes = "获取用户我的直推信息", httpMethod = "GET") @ApiOperation(value = "获取用户我的直推信息", notes = "获取用户我的直推信息", httpMethod = "GET")
@GetMapping("/myRecommend") @GetMapping("/myRecommend")
public R<Map> getMyRecommend(String userId) { public R<Map> getMyRecommend(String userId) {
//用户id
int userLevel = userService.getByUserId(userId).getUserLevel(); int userLevel = userService.getByUserId(userId).getUserLevel();
//用户各等级人数
RecommendUser myRecommed = recommendUserService.getMyRecommed(userId); RecommendUser myRecommed = recommendUserService.getMyRecommed(userId);
Map myRecommedMap = new HashMap(); Map myRecommedMap = new HashMap();
myRecommedMap.put("userlevel", userLevel); myRecommedMap.put("userlevel", userLevel);
......
...@@ -62,7 +62,7 @@ uploadFile: ...@@ -62,7 +62,7 @@ uploadFile:
location: /opt/images/upload_flowChart/ #自定义上传文件服务器硬盘保存路径 ,linux服务器保存路径 /home/changfa/app/wxbjgkpt/upload_flowChart/ location: /opt/images/upload_flowChart/ #自定义上传文件服务器硬盘保存路径 ,linux服务器保存路径 /home/changfa/app/wxbjgkpt/upload_flowChart/
file: file:
upload: upload:
path: /opt/images/ path: /opt/upload/video/
jwt: jwt:
# 加密秘钥 # 加密秘钥
secret: f4e2e52034348f86b67cde581c0f9eb5 secret: f4e2e52034348f86b67cde581c0f9eb5
......
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