Commit 0e6b8355 authored by liqin's avatar liqin 💬

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

parents 16ce5021 39c85355
package cn.wisenergy.common.config;
/**
* Created by m1991 on 2021/3/10 17:27
*/
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.multipart.MultipartResolver;
import org.springframework.web.multipart.commons.CommonsMultipartResolver;
@Configuration
public class UploadConfig {
//显示声明CommonsMultipartResolver为mutipartResolver
@Bean(name = "multipartResolver")
public MultipartResolver multipartResolver() {
CommonsMultipartResolver resolver = new CommonsMultipartResolver();
resolver.setDefaultEncoding("UTF-8");
//resolveLazily属性启用是为了推迟文件解析,以在在UploadAction中捕获文件大小异常
resolver.setResolveLazily(true);
resolver.setMaxInMemorySize(40960);
//上传文件大小 5M 5*1024*1024
resolver.setMaxUploadSize(5 * 1024 * 1024);
return resolver;
}
}
...@@ -18,7 +18,7 @@ public class FileUtils { ...@@ -18,7 +18,7 @@ public class FileUtils {
public static boolean upload(MultipartFile file, String path, String fileName) { public static boolean upload(MultipartFile file, String path, String fileName) {
//确定上传的文件名 //确定上传的文件名
String realPath = path + "\\" + fileName; String realPath = path + fileName;
System.out.println("上传文件:" + realPath); System.out.println("上传文件:" + realPath);
File dest = new File(realPath); File dest = new File(realPath);
......
...@@ -2,11 +2,11 @@ package cn.wisenergy.mapper; ...@@ -2,11 +2,11 @@ package cn.wisenergy.mapper;
import cn.wisenergy.model.app.shopZx; import cn.wisenergy.model.app.shopZx;
import cn.wisenergy.model.app.zxUserDto;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; 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;
...@@ -26,5 +26,5 @@ public interface ShopZxMapper extends BaseMapper<shopZx> { ...@@ -26,5 +26,5 @@ public interface ShopZxMapper extends BaseMapper<shopZx> {
/** /**
* 查询资讯数据 * 查询资讯数据
*/ */
List<shopZx> selectPage(@Param("pageNum") Integer pageNum, @Param("pageSize") Integer pageSize); List<zxUserDto> selectPage(@Param("pageNum") Integer pageNum, @Param("pageSize") Integer pageSize);
} }
...@@ -44,33 +44,40 @@ public interface UsersMapper extends BaseMapper<User> { ...@@ -44,33 +44,40 @@ public interface UsersMapper extends BaseMapper<User> {
List<User> getList(Map<String, Object> map); List<User> getList(Map<String, Object> map);
List<User> findAll(); List<User> findAll();
User findByName(String name); User findByName(String name);
String findPswByName(String UserName); String findPswByName(String UserName);
void save(User user); void save(User user);
/** /**
* 获取用户信息 * 获取用户信息
*
* @param userId 用户id * @param userId 用户id
* @return 用户信息 * @return 用户信息
*/ */
User getByUserId(@Param("userId") String userId); User getByUserId(@Param("userId") String userId);
/** /**
* 获取用户信息 * 获取用户信息
*
* @param userId 用户id * @param userId 用户id
* @return 用户信息 * @return 用户信息
*/ */
Integer ByUserId(@Param("userId") String userId); Integer ByUserId(@Param("userId") String userId);
/** /**
* 获取用户信息 * 获取用户信息
*
* @param * @param
* @return 用户信息 * @return 用户信息
*/ */
Integer beInvitedCode1(@Param("beInvitedCode") String beInvitedCode); Integer beInvitedCode1(@Param("beInvitedCode") String beInvitedCode);
/** /**
* 获取用户信息 * 获取用户信息
*
* @param beInvitedCode 用户被邀请码 * @param beInvitedCode 用户被邀请码
* @return 用户信息 * @return 用户信息
*/ */
...@@ -78,39 +85,46 @@ public interface UsersMapper extends BaseMapper<User> { ...@@ -78,39 +85,46 @@ public interface UsersMapper extends BaseMapper<User> {
/** /**
* 获取黄金树以上会员用户 * 获取黄金树以上会员用户
*
* @return * @return
*/ */
List<User> getAllGoldUser(); List<User> getAllGoldUser();
/** /**
* 查询用户 * 查询用户
*
* @param param * @param param
* @return * @return
*/ */
public List<User> getUsersListByMap(Map<String,Object> param); public List<User> getUsersListByMap(Map<String, Object> param);
//根据手机号查询用户Integer //根据手机号查询用户Integer
User queryUsersByPhone(@Param("userId")String userId); User queryUsersByPhone(@Param("userId") String userId);
//根据用户的推荐人邀请码比对推荐人的本人邀请码,查询推荐人的用户ID //根据用户的推荐人邀请码比对推荐人的本人邀请码,查询推荐人的用户ID
Integer inviteCodeBeInvitedCode(@Param("beInvitedCode")Integer beInvitedCode); Integer inviteCodeBeInvitedCode(@Param("beInvitedCode") Integer beInvitedCode);
/** /**
* 用户注册 * 用户注册
*
* @param userId * @param userId
* @param inviteCode * @param inviteCode
* @param beInvitedCode * @param beInvitedCode
* @param userLevel * @param userLevel
*/ */
Integer save(@Param("userId")String userId, @Param("inviteCode") String inviteCode, @Param("beInvitedCode") String beInvitedCode, @Param("userLevel") Integer userLevel); Integer save(@Param("userId") String userId, @Param("inviteCode") String inviteCode, @Param("beInvitedCode") String beInvitedCode, @Param("userLevel") Integer userLevel);
Integer insertbyint(@Param("userId")String userId, @Param("beInvitedCode") String beInvitedCode);
Integer insertbyint(@Param("userId") String userId, @Param("beInvitedCode") String beInvitedCode);
User edit1(int userLevel, String intiveCode, String userId);
Integer getuserIdById(@Param("userId") String userId);
User edit1(int userLevel, String intiveCode,String userId); Integer BYQMById(@Param("userId") String userId);
Integer getuserIdById(@Param("userId")String userId);
Integer BYQMById(@Param("userId")String userId);
/** /**
* 根据userid获取获取所有的直接推荐人 * 根据userid获取获取所有的直接推荐人
*
* @param inviteCode 用户本人的邀请码 * @param inviteCode 用户本人的邀请码
* @return 所有填写此人的邀请码的用户 * @return 所有填写此人的邀请码的用户
*/ */
...@@ -118,8 +132,24 @@ public interface UsersMapper extends BaseMapper<User> { ...@@ -118,8 +132,24 @@ public interface UsersMapper extends BaseMapper<User> {
/** /**
* 通过邀请码,获取用户信息 * 通过邀请码,获取用户信息
*
* @param inviteCode 邀请码 * @param inviteCode 邀请码
* @return 用户信息 * @return 用户信息
*/ */
User queryByInviteCode(@Param("inviteCode") String inviteCode); User queryByInviteCode(@Param("inviteCode") String inviteCode);
/**
* 通过用户等级,获取该等级用户列表
*
* @param userLevel 用户等级
* @return 等级用户列表
*/
List<User> getByLevel(@Param("userLevel") Integer userLevel);
/**
*
* @param
* @return
*/
User biInvitedCode1(@Param("inviteCode") String inviteCode);
} }
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
</insert> </insert>
<!--资讯内容倒叙查询--> <!--资讯内容倒叙查询-->
<select id="selectPage" parameterType="java.lang.Integer" resultType="cn.wisenergy.model.app.shopZx"> <select id="selectPage" parameterType="java.lang.Integer" resultType="cn.wisenergy.model.app.zxUserDto">
select select
b.zx_id as zxid, b.zx_id as zxid,
b.zx_url as zxUrl, b.zx_url as zxUrl,
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
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!=0 WHERE zx_to_examine != 1
order by zxid desc limit #{pageNum},#{pageSize} order by zxid desc limit #{pageNum},#{pageSize}
</select> </select>
......
...@@ -101,15 +101,15 @@ ...@@ -101,15 +101,15 @@
<include refid="table"/> <include refid="table"/>
<where> <where>
be_invited_code=1 be_invited_code=1
<if test="createTime != null"> <if test="createTime != null">
and(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 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" parameterType="string">
select select
<include refid="cols_all"/> <include refid="cols_all"/>
from from
...@@ -165,7 +165,8 @@ ...@@ -165,7 +165,8 @@
<!--用户注册--> <!--用户注册-->
<insert id="save"> <insert id="save">
insert into user(user_id,invite_code,be_invited_code,user_level) value (#{userId},#{inviteCode},#{beInvitedCode},#{userLevel}) insert into user(user_id,invite_code,be_invited_code,user_level) value
(#{userId},#{inviteCode},#{beInvitedCode},#{userLevel})
</insert> </insert>
<insert id="insertbyint"> <insert id="insertbyint">
insert into user_info(user_id,be_invited_code) value (#{userId},#{beInvitedCode}) insert into user_info(user_id,be_invited_code) value (#{userId},#{beInvitedCode})
...@@ -173,7 +174,7 @@ ...@@ -173,7 +174,7 @@
<select id="queryUsersByPhone" resultType="cn.wisenergy.model.app.User"> <select id="queryUsersByPhone" resultType="cn.wisenergy.model.app.User">
select select
<include refid="vals"/> <include refid="vals"/>
from from
<include refid="table"/> <include refid="table"/>
<where> <where>
...@@ -219,7 +220,7 @@ ...@@ -219,7 +220,7 @@
user_id=#{userId} user_id=#{userId}
</where> </where>
</select> </select>
<update id="edit1" > <update id="edit1">
update update
user_info user_info
<set> <set>
...@@ -229,7 +230,7 @@ ...@@ -229,7 +230,7 @@
update_time =now() update_time =now()
</set> </set>
<where> <where>
user_id = #{userId} user_id = #{userId}
</where> </where>
</update> </update>
...@@ -289,7 +290,7 @@ ...@@ -289,7 +290,7 @@
</if> </if>
</select> </select>
<!-- 获取当前用户的所有直接推荐人--> <!-- 获取当前用户的所有直接推荐人-->
<select id="getByInviteCode" resultType="cn.wisenergy.model.app.User" parameterType="string"> <select id="getByInviteCode" resultType="cn.wisenergy.model.app.User" parameterType="string">
select select
<include refid="cols_all"/> <include refid="cols_all"/>
...@@ -311,5 +312,15 @@ ...@@ -311,5 +312,15 @@
</where> </where>
</select> </select>
<select id="getByLevel" resultType="cn.wisenergy.model.app.User">
select
<include refid="cols_all"/>
from
<include refid="table"/>
<where>
user_level=#{userLevel}
</where>
</select>
</mapper> </mapper>
package cn.wisenergy.model.app; package cn.wisenergy.model.app;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
......
package cn.wisenergy.model.app;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* Created by m1991 on 2021/3/10 20:29
*/
@Data
public class zxUserDto {
/**
* 手机号作为用户账号
*/
@TableField(exist = false)
@ApiModelProperty(name = "user_id", value = "用户id")
private String userId;
/**
* 资讯主键id
*/
@TableField(exist = false)
@ApiModelProperty(name = "zx_id", value = "资讯主键id")
private Integer zxid;
/**
* 视频存放地址
*/
@TableField(exist = false)
@ApiModelProperty(name = "zx_url", value = "视频/图片存放地址")
private String zxUrl;
/**
* 用户本人邀请码
*/
@TableField(exist = false)
@ApiModelProperty(name = "invite_code", value = "用户本人邀请码")
private String inviteCode;
/**
* 获赞数
*/
@TableField(exist = false)
@ApiModelProperty(name = "zx_likes", value = "获赞数")
private Integer zxLikes;
/**
* 审核字段
*/
@TableField(exist = false)
@ApiModelProperty(name = "zx_to_examine", value = "审核字段")
private Integer zxToExamine;
/**
* 资讯文字输入字段
*/
@TableField(exist = false)
@ApiModelProperty(name = "zx_field", value = "资讯文字输入字段")
private String zxField;
/**
* 用户发布地址
*/
@TableField(exist = false)
@ApiModelProperty(name = "zx_address", value = "用户发布地址")
private String zxAddress;
/**
* 资讯数据创建时间
*/
@TableField(exist = false)
@ApiModelProperty(name = "zx_date", value = "资讯数据创建时间")
private Long zxDate;
@TableField(exist = false)
private List<String> askImgList;
}
...@@ -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;
/**
* 用户level
*/
@ApiModelProperty(value = "用户level", name = "userLevel")
private int userLevel;
/** /**
* 当月消费金额 * 当月消费金额
*/ */
......
...@@ -46,6 +46,9 @@ public class AccountManager { ...@@ -46,6 +46,9 @@ public class AccountManager {
@Autowired @Autowired
private TradeRecordMapper tradeRecordMapper; private TradeRecordMapper tradeRecordMapper;
@Autowired
private MonthManureMapper monthManureMapper;
private static final String PATTERN = "yyyy-MM"; private static final String PATTERN = "yyyy-MM";
...@@ -229,4 +232,40 @@ public class AccountManager { ...@@ -229,4 +232,40 @@ public class AccountManager {
} }
return true; return true;
} }
/**
* 更新账户信息和保存交易流水记录、保存上月剩余月度肥料奖金
*
* @param accountInfoList 账户列表
* @param recordList 交易流水信息
*/
@Transactional(rollbackFor = Exception.class)
public Boolean updateAccountAddRecordAndManure(List<AccountInfo> accountInfoList,
List<TradeRecord> recordList,
MonthManure manure) {
//更新月收益
if (!CollectionUtils.isEmpty(accountInfoList)) {
for (AccountInfo accountInfo : accountInfoList) {
int count = accountMapper.updateById(accountInfo);
if (count == 0) {
return false;
}
}
}
//新增交易流水记录
if (!CollectionUtils.isEmpty(recordList)) {
for (TradeRecord tradeRecord : recordList) {
int count = tradeRecordMapper.add(tradeRecord);
if (count == 0) {
return false;
}
}
}
//新增上月剩余月度肥料奖金
int count = monthManureMapper.add(manure);
return count != 0;
}
} }
...@@ -50,9 +50,4 @@ public interface AccountService { ...@@ -50,9 +50,4 @@ public interface AccountService {
* @return true or false * @return true or false
*/ */
R<Boolean> progressPrizeCount(); R<Boolean> progressPrizeCount();
/**
* 账户表镜像---每月更新一次,保存上一个的数据
*/
void mirrorImage();
} }
package cn.wisenergy.service.app; package cn.wisenergy.service.app;
import cn.wisenergy.common.utils.R;
import cn.wisenergy.model.app.OrderInfo;
import java.util.List;
/** /**
*@ Description: 月定时任务接口定义 *@ Description: 月定时任务接口定义
*@ Author : 86187 *@ Author : 86187
...@@ -6,4 +12,30 @@ package cn.wisenergy.service.app; ...@@ -6,4 +12,30 @@ package cn.wisenergy.service.app;
* @author 86187 * @author 86187
*/ */
public interface MonthTaskService { public interface MonthTaskService {
/**
* 订单返佣-月任务
* @return true or false
*/
R<Boolean> orderRebate();
/**
* 收益和业绩统计(月度肥料)-月任务
*
* @param list 订单信息
* @return true or false
*/
R<Boolean> performanceCount(List<OrderInfo> list);
/**
* 进步奖收益统计(最大进步奖) -月任务
*
* @return true or false
*/
R<Boolean> progressPrizeCount();
/**
* 账户表镜像---每月更新一次,保存上一个的数据
*/
void mirrorImage();
} }
package cn.wisenergy.service.app; package cn.wisenergy.service.app;
import cn.wisenergy.model.app.shopZx;
import org.springframework.core.io.Resource; 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;
...@@ -39,6 +37,10 @@ public interface UploadService { ...@@ -39,6 +37,10 @@ public interface UploadService {
* @return * @return
*/ */
List imageUpload( MultipartFile[] file, String zxField, String zxAddress,String inviteCode); 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);
...@@ -49,7 +51,7 @@ public interface UploadService { ...@@ -49,7 +51,7 @@ public interface UploadService {
* @param pageSize * @param pageSize
* @return * @return
*/ */
List<shopZx> selectPage(Integer pageNum, Integer pageSize); Map selectPage(Integer pageNum, Integer pageSize);
} }
...@@ -57,10 +57,10 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo> ...@@ -57,10 +57,10 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo>
private ProgressPrizeMapper progressPrizeMapper; private ProgressPrizeMapper progressPrizeMapper;
@Autowired @Autowired
private LastAccountMapper lastAccountMapper; private OrderMapper orderMapper;
@Autowired @Autowired
private OrderMapper orderMapper; private MonthManureMapper monthManureMapper;
private static final String PATTERN = "yyyy-MM"; private static final String PATTERN = "yyyy-MM";
...@@ -70,7 +70,7 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo> ...@@ -70,7 +70,7 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo>
public R<Boolean> orderRebate() { public R<Boolean> orderRebate() {
//获取返佣订单 //获取返佣订单
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)) {
return R.ok(0, true); return R.ok(0, true);
...@@ -292,29 +292,6 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo> ...@@ -292,29 +292,6 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo>
return R.ok(0, true); return R.ok(0, true);
} }
@Override
public void mirrorImage() {
//1、把账户表account_info复制给表account_image CREATE TABLE table_2 SELECT * FROM table_1;
lastAccountMapper.copyTable("account_info", "account_image");
//删除上月备份
lastAccountMapper.deleteTable("account_backup");
//备份
lastAccountMapper.copyTable("account_info", "account_backup");
//2、把上月账户表last_month_account 复制给month_account_image
lastAccountMapper.copyTable("last_month_account", "month_account_image");
//3、删除last_month_account
lastAccountMapper.deleteTable("last_month_account");
//4、把account_image 更名为 last_month_account rename table table_2 to table_1;
lastAccountMapper.updateTableName("account_image", "last_month_account");
//5、删除month_account_image DROP table table_2;
lastAccountMapper.deleteTable("month_account_image");
}
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);
...@@ -341,6 +318,17 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo> ...@@ -341,6 +318,17 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo>
double moneyMonth = Math.floor(total / 3980 / 12); double moneyMonth = Math.floor(total / 3980 / 12);
List<AccountInfo> accountInfoList = new ArrayList<>(); List<AccountInfo> accountInfoList = new ArrayList<>();
List<TradeRecord> tradeRecordList = new ArrayList<>(); List<TradeRecord> tradeRecordList = new ArrayList<>();
//获取上月未分配完的奖金
double lastMonthAward;
Date last = DateUtil.getLastMonth(new Date());
String yearMonthTime = DateUtil.convertDateToStr(last, PATTERN);
MonthManure monthManure = monthManureMapper.queryByTime(yearMonthTime);
if (null == monthManure) {
lastMonthAward = 0.00;
} else {
lastMonthAward = monthManure.getManureAward();
}
for (User user : userList) { for (User user : userList) {
if (moneyMonth != 0) { if (moneyMonth != 0) {
//获取等级优惠百分比 //获取等级优惠百分比
...@@ -355,7 +343,7 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo> ...@@ -355,7 +343,7 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo>
double month = teamPerformance.getMonthTeamPerformance().doubleValue(); double month = teamPerformance.getMonthTeamPerformance().doubleValue();
double percent = memberPercent.getPercent().doubleValue(); double percent = memberPercent.getPercent().doubleValue();
//计算收益 //计算收益
double income = moneyMonth * 3980 * percent * month / teamTotal; double income = (moneyMonth + lastMonthAward) * 3980 * percent * month / teamTotal;
//获取账户信息 //获取账户信息
AccountInfo accountInfo = accountMapper.getByUserId(user.getUserId()); AccountInfo accountInfo = accountMapper.getByUserId(user.getUserId());
...@@ -371,7 +359,7 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo> ...@@ -371,7 +359,7 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo>
//5、添加交易流水记录 //5、添加交易流水记录
TradeRecord tradeRecord = new TradeRecord(); TradeRecord tradeRecord = new TradeRecord();
tradeRecord.setUserId(user.getUserId()); tradeRecord.setUserId(user.getUserId());
tradeRecord.setTradeType(TradeRecordEnum.ORDER_REBATE.getCode()); tradeRecord.setTradeType(TradeRecordEnum.MONTHLY_FERTILIZER.getCode());
tradeRecord.setTradeNo(null); tradeRecord.setTradeNo(null);
tradeRecord.setStatus(TradeStatusEnum.NO_SETTLE_ACCOUNTS.getCode()); tradeRecord.setStatus(TradeStatusEnum.NO_SETTLE_ACCOUNTS.getCode());
tradeRecordList.add(tradeRecord); tradeRecordList.add(tradeRecord);
......
...@@ -68,7 +68,7 @@ public class CustomerServiceServiceImpl implements CustomerServiceService { ...@@ -68,7 +68,7 @@ public class CustomerServiceServiceImpl implements CustomerServiceService {
file.transferTo(newFile); file.transferTo(newFile);
//入库地址 //入库地址
String serviceUrl = basePath + "/upload/" + newName; String serviceUrl = "/upload/" + newName;
CustomerService customerService = new CustomerService(); CustomerService customerService = new CustomerService();
customerService.setWechatId(wechatId); customerService.setWechatId(wechatId);
customerService.setWechatImgUrl(serviceUrl); customerService.setWechatImgUrl(serviceUrl);
......
...@@ -4,6 +4,7 @@ import cn.wisenergy.mapper.OrderMapper; ...@@ -4,6 +4,7 @@ import cn.wisenergy.mapper.OrderMapper;
import cn.wisenergy.model.app.OrderInfo; import cn.wisenergy.model.app.OrderInfo;
import cn.wisenergy.service.app.OrderService; import cn.wisenergy.service.app.OrderService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xxl.job.core.handler.annotation.XxlJob;
import com.youzan.cloud.open.sdk.common.exception.SDKException; import com.youzan.cloud.open.sdk.common.exception.SDKException;
import com.youzan.cloud.open.sdk.core.client.auth.Token; import com.youzan.cloud.open.sdk.core.client.auth.Token;
import com.youzan.cloud.open.sdk.core.client.core.DefaultYZClient; import com.youzan.cloud.open.sdk.core.client.core.DefaultYZClient;
...@@ -51,6 +52,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, OrderInfo> implem ...@@ -51,6 +52,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, OrderInfo> implem
* @return * @return
* @throws SDKException * @throws SDKException
*/ */
@XxlJob(value = "YouZanOrdersjobhandler")
@Override @Override
public void getYouZanOrdersForCreateTime() throws SDKException { public void getYouZanOrdersForCreateTime() throws SDKException {
Token token = youzanToken(); Token token = youzanToken();
......
...@@ -53,6 +53,7 @@ public class RecommendUserServiceImpl implements RecommendUserService { ...@@ -53,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.setUserLevel(user.getUserLevel());
userAndRecommendVo.setHeadImage(user.getHeadImage()); userAndRecommendVo.setHeadImage(user.getHeadImage());
userAndRecommendVo.setUserId(user.getUserId()); userAndRecommendVo.setUserId(user.getUserId());
userAndRecommendVo.setMonthyCount(recommendUserMapper.getByUserId(userId).getMonthyCount()); userAndRecommendVo.setMonthyCount(recommendUserMapper.getByUserId(userId).getMonthyCount());
......
...@@ -2,7 +2,8 @@ package cn.wisenergy.service.app.impl; ...@@ -2,7 +2,8 @@ package cn.wisenergy.service.app.impl;
import cn.wisenergy.common.utils.*; import cn.wisenergy.common.utils.*;
import cn.wisenergy.model.app.shopZx; import cn.wisenergy.mapper.UsersMapper;
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.beans.factory.annotation.Value;
import org.springframework.core.io.Resource; import org.springframework.core.io.Resource;
...@@ -38,6 +39,9 @@ public class UploadServiceImpl implements UploadService { ...@@ -38,6 +39,9 @@ public class UploadServiceImpl implements UploadService {
@Autowired @Autowired
private ShopZxMapper shopZxMapper; private ShopZxMapper shopZxMapper;
@Autowired
private UsersMapper usersMapper;
@Value("${file.upload.path:#{null}}") @Value("${file.upload.path:#{null}}")
private String path; private String path;
...@@ -48,10 +52,10 @@ public class UploadServiceImpl implements UploadService { ...@@ -48,10 +52,10 @@ public class UploadServiceImpl implements UploadService {
public Map<String, Object> uploadVideo(MultipartFile file,HttpServletRequest request,String zxField,String zxAddress,String inviteCode) 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://路径 * http://路径 request.getScheme() + "://" + request.getServerName()
* + ":" + request.getServerPort()+/upload/";"
*/ */
String basePath = request.getScheme() + "://" + request.getServerName() String basePath ="/upload/";
+ ":" + request.getServerPort()+"/upload/";
Long time = new Date().getTime(); Long time = new Date().getTime();
String fileName = file.getOriginalFilename();//文件原始名称 String fileName = file.getOriginalFilename();//文件原始名称
...@@ -105,8 +109,10 @@ public class UploadServiceImpl implements UploadService { ...@@ -105,8 +109,10 @@ public class UploadServiceImpl implements UploadService {
*/ */
Long zxDate= Long.valueOf(System.currentTimeMillis()); Long zxDate= Long.valueOf(System.currentTimeMillis());
String basePath = request.getScheme() + "://" + request.getServerName() // request.getScheme() + "://" + request.getServerName()
+ ":" + request.getServerPort()+"/mimi/upload/images/"; // + ":" + request.getServerPort()+"/upload/";
String basePath = "/upload/";
Long time = System.currentTimeMillis(); Long time = System.currentTimeMillis();
...@@ -115,7 +121,6 @@ public class UploadServiceImpl implements UploadService { ...@@ -115,7 +121,6 @@ public class UploadServiceImpl implements UploadService {
String newzxName = time+suffixName; //文件新名称 String newzxName = time+suffixName; //文件新名称
//设置文件存储路径,可以存放在你想要指定的路径里面 //设置文件存储路径,可以存放在你想要指定的路径里面
String rootPath="/opt/upload/video/"; //上传图片存放位置 String rootPath="/opt/upload/video/"; //上传图片存放位置
String filePath = rootPath+newzxName; String filePath = rootPath+newzxName;
File newFile = new File(filePath); File newFile = new File(filePath);
//判断目标文件所在目录是否存在 //判断目标文件所在目录是否存在
...@@ -135,48 +140,50 @@ public class UploadServiceImpl implements UploadService { ...@@ -135,48 +140,50 @@ public class UploadServiceImpl implements UploadService {
return resultMap; return resultMap;
} }
/**
* 多图片
* @param files
* @param zxField
* @param zxAddress
* @param inviteCode
* @return
*/
@Override @Override
public List imageUpload(MultipartFile[] files, String zxField, String zxAddress,String inviteCode) { public List imageUpload(MultipartFile[] files, String zxField, String zxAddress,String inviteCode) {
/**
* 生成当前时间戳
*/
Long zxDate= Long.valueOf(System.currentTimeMillis());
//获取上传图片数量,打印在控制台 //获取上传图片数量,打印在控制台
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 fileName=null; String fileName1=null;
String zxUrl=null; String zxUrl=null;
// 要上传的目标文件存放的绝对路径 // 要上传的目标文件存放的绝对路径
final String localPath = path; // final String localPath = path;
Long time = new Date().getTime();
String localPath = "/upload/";
Map<String, Object> result = new HashMap<String, Object>();//一个文件上传的结果 Map<String, Object> result = new HashMap<String, Object>();//一个文件上传的结果
String result_msg = "";//上传结果信息 String result_msg = "";//上传结果信息
//遍历图片数据 //遍历图片数据
for (MultipartFile file : files) { for (MultipartFile file : files) {
// Map<String, Object> result = new HashMap<String, Object>();//一个文件上传的结果
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")) {
// 要上传的目标文件存放的绝对路径
//上传后保存的文件名(需要防止图片重名导致的文件覆盖) //上传后保存的文件名(需要防止图片重名导致的文件覆盖)
//获取文件名 //获取文件名
fileName = file.getOriginalFilename(); fileName1 = file.getOriginalFilename();
//获取文件后缀名 //获取文件后缀名
String suffixName = fileName.substring(fileName.lastIndexOf(".")); String suffixName = fileName1.substring(fileName1.lastIndexOf("."));
//重新生成文件名 //重新生成文件名
fileName = UUID.randomUUID() + suffixName; String fileName ="1"+UUID.randomUUID()+suffixName;//文件新名称
//设置文件存储路径,可以存放在你想要指定的路径里面
String Path="/opt/upload/video/"; //上传图片存放位置
zxUrl+=localPath+fileName+","; zxUrl+=localPath+fileName+",";
// shopZxMapper.zxadd(zxUrl,userId,zxName,zxField,imgUrl,zxAddress); if (FileUtils.upload(file,Path, fileName)) {
if (FileUtils.upload(file, localPath, fileName)) {
//文件存放的相对路径(一般存放在数据库用于img标签的src) //文件存放的相对路径(一般存放在数据库用于img标签的src)
String relativePath = "img/" + fileName; String relativePath ="用于判断是否图片上传成功,返回值有:"+fileName;
result.put("relativePath", relativePath);//前端根据是否存在该字段来判断上传是否成功 result.put("relativePath", relativePath);//前端根据是否存在该字段来判断上传是否成功
result_msg = "图片上传成功"; result_msg = "图片上传成功";
result.put("zxUrl", zxUrl); result.put("zxUrl", zxUrl);
...@@ -194,6 +201,10 @@ public class UploadServiceImpl implements UploadService { ...@@ -194,6 +201,10 @@ 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);
/**
* 生成当前时间戳
*/
Long zxDate= Long.valueOf(System.currentTimeMillis());
shopZxMapper.zxadd(zxUrl,zxField,zxAddress,inviteCode, zxDate); shopZxMapper.zxadd(zxUrl,zxField,zxAddress,inviteCode, zxDate);
return root; return root;
} }
...@@ -259,19 +270,21 @@ public class UploadServiceImpl implements UploadService { ...@@ -259,19 +270,21 @@ public class UploadServiceImpl implements UploadService {
* 资讯文件展示 * 资讯文件展示
*/ */
@Override @Override
public List selectPage(Integer pageNum, Integer pageSize) { public Map selectPage(Integer pageNum, Integer pageSize) {
List<shopZx> shopZxList = shopZxMapper.selectPage(pageNum,pageSize); Map map = new HashMap();
for (shopZx shopZx : shopZxList) { List<zxUserDto> shopZxList = shopZxMapper.selectPage(pageNum,pageSize);
for (zxUserDto shopZx : shopZxList) {
String zxUrl = shopZx.getZxUrl(); String zxUrl = shopZx.getZxUrl();
;
shopZx.setUserId(shopZx.getUserId().replaceAll("(\\d{3})\\d{4}(\\d{4})","$1****$2"));
String[] split = StringUtils.split(zxUrl, ","); 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);
} }
} }
return shopZxList; map.put("data",shopZxList);
}
return map;
}
} }
package cn.wisenergy; package cn.wisenergy;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.web.servlet.MultipartAutoConfiguration; import org.springframework.boot.autoconfigure.web.servlet.MultipartAutoConfiguration;
import org.springframework.cache.annotation.EnableCaching; import org.springframework.cache.annotation.EnableCaching;
......
...@@ -22,9 +22,9 @@ public class LastAccountController { ...@@ -22,9 +22,9 @@ public class LastAccountController {
@Autowired @Autowired
private AccountService accountService; private AccountService accountService;
@ApiOperation(value = "复制表-结构和数据", notes = "复制表-结构和数据", httpMethod = "PUT") // @ApiOperation(value = "复制表-结构和数据", notes = "复制表-结构和数据", httpMethod = "PUT")
@PutMapping("/add") // @PutMapping("/add")
public void copyTable(){ // public void copyTable(){
accountService.mirrorImage(); // accountService.mirrorImage();
} // }
} }
package cn.wisenergy.web.admin.controller.app; package cn.wisenergy.web.admin.controller.app;
import cn.wisenergy.common.utils.PageRequest;
import cn.wisenergy.common.utils.Result;
import cn.wisenergy.model.app.shopZx;
import cn.wisenergy.service.app.UploadService; import cn.wisenergy.service.app.UploadService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
...@@ -94,7 +91,7 @@ public class UploadController { ...@@ -94,7 +91,7 @@ public class UploadController {
@ApiImplicitParam(name = "inviteCode", 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 zxField, String zxAddress,String inviteCode) { public List multipleImageUpload(@RequestParam(required=false,value = "files") MultipartFile[] files, String zxField, String zxAddress,String inviteCode) {
return uploadService.imageUpload(files, zxField, zxAddress,inviteCode); return uploadService.imageUpload(files, zxField, zxAddress,inviteCode);
} }
...@@ -109,7 +106,8 @@ public class UploadController { ...@@ -109,7 +106,8 @@ public class UploadController {
@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")})
@RequestMapping(method = RequestMethod.GET, value = "/zxAll") @RequestMapping(method = RequestMethod.GET, value = "/zxAll")
public List<shopZx> selectPage(int pageNum, int pageSize){ public Map selectPage(int pageNum, int pageSize){
return uploadService.selectPage(pageNum,pageSize); return uploadService.selectPage(pageNum,pageSize);
} }
} }
\ No newline at end of file
...@@ -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/upload/video/ path: /opt/upload/
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