积分统计
This commit is contained in:
parent
e81acb4bb2
commit
d1d3a0606f
|
@ -16,5 +16,5 @@ public interface UserMoneyDao extends BaseMapper<UserMoney> {
|
|||
|
||||
void updateMoney(UserMoney userMoney);
|
||||
|
||||
void updateMaySad(@Param("type") Integer type, @Param("userId") Long userId, @Param("money") Double money);
|
||||
void updateMaySad(@Param("userId") Long userId, @Param("money") Double money);
|
||||
}
|
||||
|
|
|
@ -138,6 +138,7 @@ public class UserMoneyServiceImpl extends ServiceImpl<UserMoneyDao, UserMoney> i
|
|||
userMoney.setMoney(BigDecimal.ZERO);
|
||||
userMoney.setUserId(userId);
|
||||
userMoney.setCashDeposit(BigDecimal.ZERO);
|
||||
userMoney.setSad(BigDecimal.ZERO);
|
||||
baseMapper.insert(userMoney);
|
||||
}
|
||||
return userMoney;
|
||||
|
@ -175,7 +176,17 @@ public class UserMoneyServiceImpl extends ServiceImpl<UserMoneyDao, UserMoney> i
|
|||
|
||||
@Override
|
||||
public void updateSad(int i, Long userId, double payMoney) {
|
||||
baseMapper.updateMaySad(i, userId, payMoney);
|
||||
UserMoney userMoney = selectUserMoneyByUserId(userId);
|
||||
BigDecimal sad = userMoney.getSad();
|
||||
if(sad==null){
|
||||
sad = BigDecimal.ZERO;
|
||||
}
|
||||
if(i==1){
|
||||
payMoney = sad.doubleValue() + payMoney;
|
||||
}else{
|
||||
payMoney = sad.doubleValue() - payMoney;
|
||||
}
|
||||
baseMapper.updateMaySad(userId, payMoney);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -154,4 +154,6 @@ public interface OrdersDao extends BaseMapper<Orders> {
|
|||
|
||||
IPage<Map<String,Object>> selectArtificerMoneyList(Page<Map<String,Object>> page,String startTime,String endTime,Integer status,Integer by);
|
||||
|
||||
Orders getOrdersMoneyById(Long ordersId);
|
||||
|
||||
}
|
|
@ -34,4 +34,5 @@ public interface UserRechargeDao extends BaseMapper<UserRecharge> {
|
|||
@Param("type") String type,
|
||||
@Param("artificerId") String artificerId);
|
||||
|
||||
List<UserRecharge> selectStoredList(@Param("createTime") String createTime);
|
||||
}
|
|
@ -28,6 +28,8 @@ import com.sqx.modules.artificer.dao.ArtificerDao;
|
|||
import com.sqx.modules.artificer.dao.OrdersDao;
|
||||
import com.sqx.modules.artificer.entity.*;
|
||||
import com.sqx.modules.artificer.service.*;
|
||||
import com.sqx.modules.bl.artificer.dao.ArtificerIntegralStatisticsDao;
|
||||
import com.sqx.modules.bl.artificer.entity.ArtificerIntegralStatistics;
|
||||
import com.sqx.modules.bl.commission.fxy.entity.FxyApply;
|
||||
import com.sqx.modules.bl.commission.fxy.entity.FxyConfig;
|
||||
import com.sqx.modules.bl.commission.fxy.service.FxyApplyService;
|
||||
|
@ -176,6 +178,8 @@ public class OrdersServiceImpl extends ServiceImpl<OrdersDao, Orders> implements
|
|||
private JjrConfigService jjrConfigService;
|
||||
@Autowired
|
||||
private JjrConfigLevelService jjrConfigServiceLevel;
|
||||
@Autowired
|
||||
private ArtificerIntegralStatisticsDao artificerIntegralStatisticsDao;
|
||||
|
||||
|
||||
private ReentrantReadWriteLock reentrantReadWriteLock = new ReentrantReadWriteLock(true);
|
||||
|
@ -7082,6 +7086,30 @@ public class OrdersServiceImpl extends ServiceImpl<OrdersDao, Orders> implements
|
|||
}
|
||||
}
|
||||
|
||||
//统计业绩积分
|
||||
public void statisticsAchievementIntegral(Long ordersId){
|
||||
Orders orders = baseMapper.getOrdersMoneyById(ordersId);
|
||||
String xmbs = commonInfoService.findOne(463).getValue();
|
||||
String jzbs = commonInfoService.findOne(464).getValue();
|
||||
|
||||
QueryWrapper<ArtificerIntegralStatistics> delWrapper = new QueryWrapper<ArtificerIntegralStatistics>();
|
||||
delWrapper.le("orders_no",orders.getOrdersNo());
|
||||
artificerIntegralStatisticsDao.delete(delWrapper);
|
||||
|
||||
Artificer artificer = artificerDao.selectById(orders.getArtificerId());
|
||||
ArtificerIntegralStatistics artificerIntegralStatistics = new ArtificerIntegralStatistics();
|
||||
artificerIntegralStatistics.setArtificerId(orders.getArtificerId());
|
||||
artificerIntegralStatistics.setArtificerName(artificer.getArtificerName());
|
||||
artificerIntegralStatistics.setClassify(3);
|
||||
artificerIntegralStatistics.setType(1);
|
||||
// artificerIntegralStatistics.setAchievement();//业绩
|
||||
// artificerIntegralStatistics.setIncome();//收益
|
||||
// artificerIntegralStatistics.setIntegral();//积分
|
||||
artificerIntegralStatistics.setOrdersNo(orders.getOrdersNo());
|
||||
artificerIntegralStatistics.setCreateTime(orders.getEndTimes());
|
||||
artificerIntegralStatisticsDao.insert(artificerIntegralStatistics);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result startOrders(Long ordersId, String startLongitude, String startLatitude, String startImg,String startRemark) {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
package com.sqx.modules.bl.artificer.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.sqx.modules.bl.artificer.entity.ArtificerIntegralStatistics;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface ArtificerIntegralStatisticsDao extends BaseMapper<ArtificerIntegralStatistics> {
|
||||
|
||||
}
|
|
@ -0,0 +1,57 @@
|
|||
package com.sqx.modules.bl.artificer.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @description:技师积分统计表
|
||||
*/
|
||||
@Data
|
||||
@TableName("bl_artificer_integral_statistics")
|
||||
|
||||
public class ArtificerIntegralStatistics implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("id")
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty("技师ID")
|
||||
private Long artificerId;
|
||||
|
||||
@ApiModelProperty("技师名称")
|
||||
private String artificerName;
|
||||
|
||||
@ApiModelProperty("技师名称")
|
||||
private String createTime;
|
||||
|
||||
@ApiModelProperty("类型 1在线积分 2充值积分 3业绩积分 4系统调整")
|
||||
private Integer classify;
|
||||
|
||||
@ApiModelProperty("1为正数 2为负数")
|
||||
private Integer type;
|
||||
|
||||
@ApiModelProperty("业绩")
|
||||
private BigDecimal achievement;
|
||||
|
||||
@ApiModelProperty("收益")
|
||||
private BigDecimal income;
|
||||
|
||||
@ApiModelProperty("积分")
|
||||
private BigDecimal integral;
|
||||
|
||||
@ApiModelProperty("订单号")
|
||||
private String ordersNo;
|
||||
|
||||
@ApiModelProperty("描述")
|
||||
private String remarks;
|
||||
|
||||
|
||||
}
|
|
@ -1,5 +1,7 @@
|
|||
package com.sqx.modules.bl.artificer.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
@ -18,6 +20,7 @@ public class ArtificerPartitioningDetails implements Serializable {
|
|||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("id")
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty("等级")
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package com.sqx.modules.bl.artificer.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
@ -18,6 +20,7 @@ public class ArtificerRechargeReward implements Serializable {
|
|||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("id")
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty("充值金额")
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
package com.sqx.modules.bl.artificer.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.sqx.modules.bl.artificer.entity.ArtificerIntegralStatistics;
|
||||
|
||||
public interface ArtificerIntegralStatisticsService extends IService<ArtificerIntegralStatistics> {
|
||||
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
package com.sqx.modules.bl.artificer.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.sqx.modules.bl.artificer.dao.ArtificerIntegralStatisticsDao;
|
||||
import com.sqx.modules.bl.artificer.entity.ArtificerIntegralStatistics;
|
||||
import com.sqx.modules.bl.artificer.service.ArtificerIntegralStatisticsService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class ArtificerIntegralStatisticsServiceImpl extends ServiceImpl<ArtificerIntegralStatisticsDao, ArtificerIntegralStatistics> implements ArtificerIntegralStatisticsService {
|
||||
|
||||
}
|
|
@ -12,7 +12,9 @@ import com.sqx.modules.artificer.dao.UserRechargeDao;
|
|||
import com.sqx.modules.artificer.entity.Artificer;
|
||||
import com.sqx.modules.artificer.entity.BlArtificerZqhz;
|
||||
import com.sqx.modules.artificer.entity.UserRecharge;
|
||||
import com.sqx.modules.bl.artificer.dao.ArtificerIntegralStatisticsDao;
|
||||
import com.sqx.modules.bl.artificer.dao.ArtificerPartitioningDetailsDao;
|
||||
import com.sqx.modules.bl.artificer.entity.ArtificerIntegralStatistics;
|
||||
import com.sqx.modules.bl.artificer.entity.ArtificerPartitioningDetails;
|
||||
import com.sqx.modules.bl.sadjob.entity.BlSadJob;
|
||||
import com.sqx.modules.bl.sadjob.service.BlSadJobService;
|
||||
|
@ -29,6 +31,7 @@ import org.springframework.stereotype.Service;
|
|||
import java.math.BigDecimal;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
@ -64,6 +67,8 @@ public class AllTaskServiceImpl implements AllTaskSercice {
|
|||
private UserSadDetailsService userSadDetailsService;
|
||||
@Autowired
|
||||
private UserMoneyService userMoneyService;
|
||||
@Autowired
|
||||
private ArtificerIntegralStatisticsDao artificerIntegralStatisticsDao;
|
||||
|
||||
/**
|
||||
* 计算技师升级规则 每天半夜1点执行,预留12点到01点之间的计算间隔,用于触发其他计算逻辑
|
||||
|
@ -297,7 +302,61 @@ public class AllTaskServiceImpl implements AllTaskSercice {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 业绩积分汇总 t+1 8时进行汇总
|
||||
*/
|
||||
@Scheduled(cron = "0 0 8 * * ?")
|
||||
public void tongjiIntegral() {
|
||||
System.out.println("----------------每日积业绩及分汇总 定时任务-------------");
|
||||
//当前时间减一天
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.add(Calendar.DAY_OF_YEAR, -1);//上一天
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
String date = sdf.format(calendar.getTime());
|
||||
BlUserZxsc blUserZxscParam = new BlUserZxsc();
|
||||
blUserZxscParam.setCreateTime(date);
|
||||
//获取在线积分
|
||||
List<BlUserZxsc> blUserZxsc = blUserZxscDao.selectGrouplist(blUserZxscParam);
|
||||
for(BlUserZxsc blUserZxscPar:blUserZxsc){
|
||||
QueryWrapper<ArtificerIntegralStatistics> delWrapper = new QueryWrapper<ArtificerIntegralStatistics>();
|
||||
delWrapper.eq("artificer_id",blUserZxscPar.getArtificerId());
|
||||
delWrapper.eq("classify",1);
|
||||
delWrapper.ge("create_time",date);
|
||||
delWrapper.le("create_time",date+" 23:59:59");
|
||||
artificerIntegralStatisticsDao.delete(delWrapper);
|
||||
|
||||
Artificer artificer = artificerDao.selectById(blUserZxscPar.getArtificerId());
|
||||
ArtificerIntegralStatistics artificerIntegralStatistics = new ArtificerIntegralStatistics();
|
||||
artificerIntegralStatistics.setArtificerId(blUserZxscPar.getArtificerId());
|
||||
artificerIntegralStatistics.setArtificerName(artificer.getArtificerName());
|
||||
artificerIntegralStatistics.setClassify(1);
|
||||
artificerIntegralStatistics.setType(1);
|
||||
artificerIntegralStatistics.setIntegral(blUserZxscPar.getUserRecharge());
|
||||
artificerIntegralStatistics.setCreateTime(date+" 23:59:59");
|
||||
artificerIntegralStatisticsDao.insert(artificerIntegralStatistics);
|
||||
}
|
||||
//获取充值积分
|
||||
List<UserRecharge> userRechargeList = userRechargeDao.selectStoredList(date);
|
||||
for(UserRecharge userRecharge:userRechargeList){
|
||||
QueryWrapper<ArtificerIntegralStatistics> delWrapper = new QueryWrapper<ArtificerIntegralStatistics>();
|
||||
delWrapper.eq("artificer_id",userRecharge.getArtificerId());
|
||||
delWrapper.eq("classify",2);
|
||||
delWrapper.ge("create_time",date);
|
||||
delWrapper.le("create_time",date+" 23:59:59");
|
||||
artificerIntegralStatisticsDao.delete(delWrapper);
|
||||
|
||||
Artificer artificer = artificerDao.selectById(userRecharge.getArtificerId());
|
||||
ArtificerIntegralStatistics artificerIntegralStatistics = new ArtificerIntegralStatistics();
|
||||
artificerIntegralStatistics.setArtificerId(userRecharge.getArtificerId());
|
||||
artificerIntegralStatistics.setArtificerName(artificer.getArtificerName());
|
||||
artificerIntegralStatistics.setClassify(2);
|
||||
artificerIntegralStatistics.setType(1);
|
||||
artificerIntegralStatistics.setIntegral(userRecharge.getUserRecharge());
|
||||
artificerIntegralStatistics.setCreateTime(date+" 23:59:59");
|
||||
artificerIntegralStatisticsDao.insert(artificerIntegralStatistics);
|
||||
}
|
||||
}
|
||||
|
||||
//赠送盛安豆定时任务
|
||||
@Scheduled(cron = "0 10 0 * * ?")
|
||||
|
|
|
@ -15,13 +15,8 @@
|
|||
</update>
|
||||
|
||||
<update id="updateMaySad">
|
||||
update user_money set
|
||||
<if test="type==1">
|
||||
sad=sad+#{money}
|
||||
</if>
|
||||
<if test="type==2">
|
||||
sad=sad-#{money}
|
||||
</if>
|
||||
update user_money
|
||||
set sad=#{money}
|
||||
where user_id=#{userId}
|
||||
</update>
|
||||
|
||||
|
|
|
@ -2036,5 +2036,10 @@
|
|||
</if>
|
||||
</select>
|
||||
|
||||
<select id="getOrdersMoneyById" resultType="com.sqx.modules.artificer.entity.Orders">
|
||||
select o.*
|
||||
from orders o
|
||||
where old_orders_id = #{ordersId}
|
||||
</select>
|
||||
|
||||
</mapper>
|
|
@ -40,4 +40,15 @@
|
|||
and user_recharge.artificer_id = #{artificerId}
|
||||
and user_recharge.create_time BETWEEN #{start} and #{end}
|
||||
</select>
|
||||
|
||||
<select id="selectStoredList" resultType="com.sqx.modules.artificer.entity.UserRecharge">
|
||||
SELECT artificer_id,
|
||||
IFNULL( SUM( user_recharge ), '0' ) AS userRecharge
|
||||
FROM user_recharge
|
||||
where type = 2
|
||||
and create_time >= #{createTime}
|
||||
and create_time <= concat(#{createTime},' 23:59:59')
|
||||
GROUP BY artificer_id
|
||||
</select>
|
||||
|
||||
</mapper>
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
<mapper namespace="com.sqx.modules.bl.userZxsc.dao.BlUserZxscDao">
|
||||
|
||||
|
||||
<select id="selectGrouplist" resultType="com.sqx.modules.bl.userZxsc.entity.BlUserZxsc">
|
||||
select sum(user_recharge) as user_recharge,artificer_id
|
||||
from bl_user_zxsc
|
||||
|
@ -12,7 +11,4 @@
|
|||
GROUP BY artificer_id
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
|
||||
</mapper>
|
Loading…
Reference in New Issue