修改打赏信息
This commit is contained in:
parent
bf5566bf62
commit
fdbbde9dd3
|
@ -98,13 +98,19 @@ public class AppUserMoneyController {
|
|||
//出账
|
||||
Long outgoingLong= filteredPersons.stream()
|
||||
.filter(UserMoneyDetails -> UserMoneyDetails.getType() == 2)
|
||||
.filter(UserMoneyDetails -> !UserMoneyDetails.getContent().contains("管理端减少"))
|
||||
.mapToLong(UserMoneyDetails -> UserMoneyDetails.getMoney().longValue())
|
||||
.sum();
|
||||
BigDecimal income = new BigDecimal(incomeLong);
|
||||
BigDecimal outgoing = new BigDecimal(outgoingLong);
|
||||
BigDecimal balance = income.subtract(outgoing);
|
||||
|
||||
BigDecimal ktxje = userMoney.getMoney().subtract(balance);
|
||||
if(ktxje.compareTo(BigDecimal.ZERO) < 0){
|
||||
ktxje = BigDecimal.ZERO;
|
||||
}
|
||||
//插入可提现金额
|
||||
userMoneyResult.setWithdrawableAmount(userMoney.getMoney().subtract(balance));
|
||||
userMoneyResult.setWithdrawableAmount(ktxje);
|
||||
return Result.success().put("data",userMoneyResult);
|
||||
}
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@ import org.apache.ibatis.annotations.Mapper;
|
|||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface UserMoneyDetailsDao extends BaseMapper<UserMoneyDetails> {
|
||||
|
@ -19,4 +20,6 @@ public interface UserMoneyDetailsDao extends BaseMapper<UserMoneyDetails> {
|
|||
int insert(UserMoneyDetails userMoneyDetails);
|
||||
|
||||
IPage<UserMoneyDetails> findUserMontyDetailPage(Page<UserMoneyDetails> page, @Param("userId") Long userId);
|
||||
|
||||
List<UserMoneyDetails> selectArtificerQianbao(Long userId, String startTime, String endTime);
|
||||
}
|
||||
|
|
|
@ -25,4 +25,5 @@ public interface UserMoneyDetailsService extends IService<UserMoneyDetails> {
|
|||
|
||||
int insert(UserMoneyDetails userMoneyDetails);
|
||||
|
||||
Result selectArtificerQianbao(Long artificerId, String startTime, String endTime,Integer page, Integer limit);
|
||||
}
|
||||
|
|
|
@ -25,10 +25,7 @@ import org.springframework.stereotype.Service;
|
|||
|
||||
import java.math.BigDecimal;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
@Service
|
||||
public class UserMoneyDetailsServiceImpl extends ServiceImpl<UserMoneyDetailsDao, UserMoneyDetails> implements UserMoneyDetailsService {
|
||||
|
@ -331,7 +328,7 @@ public class UserMoneyDetailsServiceImpl extends ServiceImpl<UserMoneyDetailsDao
|
|||
QueryWrapper<UserMoneyDetails> queryWrapper = new QueryWrapper();
|
||||
queryWrapper.eq("user_id", period.getArtificerId());
|
||||
if(StringUtil.isNotEmpty(period.getStartFundData().toString())){
|
||||
queryWrapper.between("end_times", period.getStartFundData(), period.getEndFundData());
|
||||
queryWrapper.between("create_time", period.getStartFundData(), period.getEndFundData());
|
||||
}
|
||||
if(period.getDetailsType()!= null){
|
||||
//方便前端判断 传1则查询全部 2查询收入 3查询支出
|
||||
|
@ -348,7 +345,7 @@ public class UserMoneyDetailsServiceImpl extends ServiceImpl<UserMoneyDetailsDao
|
|||
}
|
||||
//只查询操作余额的数据
|
||||
queryWrapper.eq("manipulate_type", 2);
|
||||
queryWrapper.orderByDesc("end_times");
|
||||
queryWrapper.orderByDesc("create_time");
|
||||
List<UserMoneyDetails> page2 = baseMapper.selectList(queryWrapper);
|
||||
return page2;
|
||||
}
|
||||
|
@ -364,4 +361,38 @@ public class UserMoneyDetailsServiceImpl extends ServiceImpl<UserMoneyDetailsDao
|
|||
return baseMapper.insert(userMoneyDetails);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result selectArtificerQianbao(Long artificerId, String startTime, String endTime,Integer page, Integer limit) {
|
||||
Artificer artificer = artificerService.getById(artificerId);
|
||||
List<UserMoneyDetails> list = baseMapper.selectArtificerQianbao(artificer.getUserId(),startTime,endTime);
|
||||
String bqsr = "0";//本期收入
|
||||
for(UserMoneyDetails par:list){
|
||||
if(par.getType()==1){
|
||||
bqsr = par.getMoney().toString();
|
||||
}
|
||||
}
|
||||
if(page == null){
|
||||
page = 1;
|
||||
}
|
||||
if(limit == null){
|
||||
limit = 10;
|
||||
}
|
||||
QueryWrapper<UserMoneyDetails> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("user_id",artificer.getUserId());
|
||||
queryWrapper.eq("bl_role","2");
|
||||
queryWrapper.eq("bl_flag","1");
|
||||
queryWrapper.eq("state","2");
|
||||
queryWrapper.eq("classify","8");
|
||||
queryWrapper.ge(StringUtil.isNotEmpty(startTime),"create_time",startTime);
|
||||
queryWrapper.le(StringUtil.isNotEmpty(endTime),"create_time",endTime+" 23:59:59");
|
||||
IPage<UserMoneyDetails> iPage = baseMapper.selectPage(new Page<>(page, limit),queryWrapper);
|
||||
|
||||
Map<String,Object> map = new HashMap<String,Object>();
|
||||
map.put("bqsr",bqsr);
|
||||
map.put("startFundData",startTime);
|
||||
map.put("endFundData",endTime);
|
||||
map.put("data",iPage);
|
||||
return Result.success(map);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@ import com.sqx.common.utils.Result;
|
|||
import com.sqx.map.CommonMapUtils;
|
||||
import com.sqx.modules.app.annotation.Login;
|
||||
import com.sqx.modules.app.entity.UserEntity;
|
||||
import com.sqx.modules.app.service.UserMoneyDetailsService;
|
||||
import com.sqx.modules.app.service.UserService;
|
||||
import com.sqx.modules.artificer.dao.ArtificerDao;
|
||||
import com.sqx.modules.artificer.dao.UserRechargeDao;
|
||||
|
@ -34,6 +35,7 @@ import com.sqx.modules.trip.entity.Trip;
|
|||
import com.sqx.modules.trip.service.TripService;
|
||||
import com.sqx.modules.utils.HttpClientUtil;
|
||||
import com.sqx.modules.utils.LonLatUtil;
|
||||
import com.sqx.modules.utils.PeriodUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
@ -88,6 +90,8 @@ public class AppArtificerController {
|
|||
private UserRechargeDao userRechargeDao;
|
||||
@Autowired
|
||||
private CollectMassageService collectMassageService;
|
||||
@Autowired
|
||||
private UserMoneyDetailsService userMoneyDetailsService;
|
||||
|
||||
@GetMapping("/selectMassageTypePage")
|
||||
@ApiOperation("查询按摩分类(分页)")
|
||||
|
@ -644,4 +648,20 @@ public class AppArtificerController {
|
|||
return Result.success(artificerService.getJifenList(userId,startTime,endTime));
|
||||
}
|
||||
|
||||
|
||||
@Login
|
||||
@ApiOperation("技师获取钱包明细列表")
|
||||
@GetMapping(value = "selectArtificerQianbao")
|
||||
public Result selectArtificerQianbao(@RequestAttribute Long userId,String fundData,Integer fundType,Integer page, Integer limit) throws ParseException {
|
||||
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
|
||||
Period period = new Period();
|
||||
period.setFundData(sdf.parse(fundData));
|
||||
period.setFundType(fundType);
|
||||
period = PeriodUtil.calculationPeriod(period);
|
||||
String startTime = sdf.format(period.getStartFundData());
|
||||
String endTime = sdf.format(period.getEndFundData());
|
||||
Artificer artificer = artificerService.selectArtificerByUserId(userId);
|
||||
return userMoneyDetailsService.selectArtificerQianbao(artificer.getArtificerId(),startTime,endTime,page, limit);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -291,10 +291,13 @@ public class ArtificerServiceImpl extends ServiceImpl<ArtificerDao, Artificer> i
|
|||
public Result selectArtificerMoney(Long userId,Long artificerId){
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
String dayTime = sdf.format(new Date());
|
||||
//累计收益 今日收益 本月预估收益 本月预估提现
|
||||
//累计收益
|
||||
BigDecimal sumMoney = ordersDao.selectSumMoney(artificerId, null, null);
|
||||
//今日收益
|
||||
BigDecimal dayMoney = ordersDao.selectEstimationSumMoneyBy(artificerId, dayTime, 1);
|
||||
//本月预估收益
|
||||
BigDecimal monthMoney = ordersDao.selectEstimationSumMoneyBy(artificerId, dayTime, 2);
|
||||
//本月预估提现
|
||||
BigDecimal cashMoney = cashOutDao.sumMoneyByUserId(userId, dayTime, 2);
|
||||
UserMoney userMoney = userMoneyService.selectUserMoneyByUserId(userId);
|
||||
Map<String,Object> result=new HashMap<>();
|
||||
|
|
|
@ -5147,10 +5147,11 @@ public class OrdersServiceImpl extends ServiceImpl<OrdersDao, Orders> implements
|
|||
|
||||
@Override
|
||||
public Result selectArtificerIndex(Long artificerId, String startTime, String endTime) {
|
||||
Artificer artificer = artificerService.getById(artificerId);
|
||||
Map<String, Object> result = new HashMap<String, Object>();
|
||||
//总收益
|
||||
BigDecimal sumMoney = ordersDao.selectSumMoney(artificerId, startTime, endTime);
|
||||
//总销量
|
||||
//总销量 有关这个技师的订单销售数量的累计
|
||||
int countOrderNum = ordersDao.selectCountOrderNum(artificerId, startTime, endTime);
|
||||
//评价分数
|
||||
Double countTakingByUserId = orderTakingCommentDao.selectCountTakingByUserId(artificerId, startTime, endTime);
|
||||
|
@ -5159,7 +5160,7 @@ public class OrdersServiceImpl extends ServiceImpl<OrdersDao, Orders> implements
|
|||
//总订单数
|
||||
int countOrder = ordersDao.selectCountOrder(artificerId, null, startTime, endTime);
|
||||
//退款金额
|
||||
BigDecimal sumRefund = userMoneyDetailsService.selectSumRefund(artificerId, startTime, endTime);
|
||||
BigDecimal sumRefund = userMoneyDetailsService.selectSumRefund(artificer.getUserId(), startTime, endTime);
|
||||
//访客人数
|
||||
int countByUserId = collectArtificerService.selectCountByUserId(artificerId, startTime, endTime);
|
||||
//待服务
|
||||
|
@ -5170,13 +5171,18 @@ public class OrdersServiceImpl extends ServiceImpl<OrdersDao, Orders> implements
|
|||
int countOrderCancel = ordersDao.selectCountOrder(artificerId, 4, startTime, endTime);
|
||||
//已完成
|
||||
int countOrderEnd = ordersDao.selectCountOrder(artificerId, 5, startTime, endTime);
|
||||
//状态 1待支付 2待服务 3待评论 4已取消 5已完成 6进行中 7技师出发 8技师到达 9用户已支付技师待接单 10待补单 11原单挂单
|
||||
int countOrderJin = ordersDao.selectCountOrder(artificerId, 6, startTime, endTime);
|
||||
|
||||
//客户评价总数
|
||||
Integer scoreCount = orderTakingCommentDao.selectCommentCount(artificerId, null, startTime, endTime);
|
||||
//好评数量 分数为4分5分
|
||||
Integer goodsScoreCount = orderTakingCommentDao.selectCommentCount(artificerId, 1, startTime, endTime);
|
||||
//差评数 分数为1,2,3分
|
||||
Integer loseScoreCount = orderTakingCommentDao.selectCommentCount(artificerId, 2, startTime, endTime);
|
||||
BigDecimal goodsRate = BigDecimal.ZERO;
|
||||
BigDecimal loseRate = BigDecimal.ZERO;
|
||||
//计算评价比例
|
||||
if (scoreCount != 0) {
|
||||
if (goodsScoreCount != null) {
|
||||
goodsRate = BigDecimal.valueOf(goodsScoreCount).divide(BigDecimal.valueOf(scoreCount), 2, BigDecimal.ROUND_HALF_UP);
|
||||
|
|
|
@ -61,7 +61,7 @@ public class AllTaskServiceImpl implements AllTaskSercice {
|
|||
* A0,A1,A2,A3,A4,A5等
|
||||
*/
|
||||
// @Scheduled(cron = "0 * * * * ?")
|
||||
@Scheduled(cron = "0 * * * * ?")
|
||||
@Scheduled(cron = "0 0 0 * * ?")
|
||||
public void upgradeJishi() {
|
||||
System.out.println("------------计算技师升级规则-----------");
|
||||
//1.获取全部参与积分规则的技师
|
||||
|
@ -217,7 +217,7 @@ public class AllTaskServiceImpl implements AllTaskSercice {
|
|||
/**
|
||||
* 计算技师在线时长,每10分钟计算一积分
|
||||
*/
|
||||
@Scheduled(cron = "0 * * * * ?")
|
||||
// @Scheduled(cron = "0 * * * * ?")
|
||||
public void upJishiZxsc() throws ParseException {
|
||||
System.out.println("----------------计算技师在线时长,每10分钟计算一积分-------------");
|
||||
CommonInfo commonInfo = commonInfoDao.findOne(100000);
|
||||
|
@ -265,7 +265,7 @@ public class AllTaskServiceImpl implements AllTaskSercice {
|
|||
/**
|
||||
* 积分汇总 t+1进行汇总
|
||||
*/
|
||||
@Scheduled(cron = "0 * * * * ?")
|
||||
@Scheduled(cron = "0 0 0 * * ?")
|
||||
public void tongjiJishiGrade() {
|
||||
System.out.println("----------------每日积分汇总 定时任务-------------");
|
||||
//当前时间减一天
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
</select>
|
||||
|
||||
<select id="selectSumRefund" resultType="java.math.BigDecimal">
|
||||
select ifnull(sum(money), 0) from user_money_details where artificer_id = #{userId} and type = 1
|
||||
select ifnull(sum(money), 0) from user_money_details where user_id = #{userId} and bl_role = 2 and bl_flag =1 and state = 2
|
||||
<if test="startTime!=null and startTime!=''">
|
||||
and date_format(create_time,'%Y-%m-%d') >= date_format(#{startTime},'%Y-%m-%d')
|
||||
</if>
|
||||
|
@ -126,4 +126,14 @@
|
|||
order by create_time desc
|
||||
</select>
|
||||
|
||||
<select id="selectArtificerQianbao" resultType="com.sqx.modules.app.entity.UserMoneyDetails">
|
||||
select type,IFNULL(sum(money),0) as money from user_money_details where user_id = #{userId} and bl_role = 2 and bl_flag = 1 and state = 2 and classify = 8 and type = 1
|
||||
<if test="startTime!=null and startTime!=''">
|
||||
and date_format(create_time,'%Y-%m-%d') >= date_format(#{startTime},'%Y-%m-%d')
|
||||
</if>
|
||||
<if test="endTime!=null and endTime!=''">
|
||||
and date_format(create_time,'%Y-%m-%d') <= date_format(#{endTime},'%Y-%m-%d')
|
||||
</if>
|
||||
GROUP BY type
|
||||
</select>
|
||||
</mapper>
|
|
@ -529,16 +529,13 @@
|
|||
|
||||
|
||||
<select id="selectCountOrderNum" resultType="int">
|
||||
select ifnull(sum(num), 0) from orders_massage
|
||||
where orders_id in
|
||||
(select orders_id from orders where artificer_id = #{userId} and status in (2,3,5,6)
|
||||
select ifnull(sum(massage_num), 0) as num from orders where artificer_id = #{userId} and status in (2,3,5,6,7,8,9,10)
|
||||
<if test="startTime!=null and startTime!=''">
|
||||
and date_format(pay_time,'%Y-%m-%d') >= date_format(#{startTime},'%Y-%m-%d')
|
||||
</if>
|
||||
<if test="endTime!=null and endTime!=''">
|
||||
and date_format(pay_time,'%Y-%m-%d') <= date_format(#{endTime},'%Y-%m-%d')
|
||||
</if>
|
||||
)
|
||||
</select>
|
||||
|
||||
<select id="selectCountOrders" resultType="Integer">
|
||||
|
@ -572,7 +569,7 @@
|
|||
and status = #{status}
|
||||
</if>
|
||||
<if test="status==null">
|
||||
and status in (2,3,4,5,6)
|
||||
and status in (2,3,4,5,6,7,8,9,10)
|
||||
</if>
|
||||
<if test="startTime!=null and startTime!=''">
|
||||
and date_format(create_time,'%Y-%m-%d') >= date_format(#{startTime},'%Y-%m-%d')
|
||||
|
|
Loading…
Reference in New Issue