admin
2019-08-22 0753e8e2febe83f13d9d7a6071fa5f7b57d7d7f1
Merge remote-tracking branch 'origin/div' into div
17个文件已修改
507 ■■■■■ 已修改文件
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/IntegralControllerV2.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/integral/IntegralTaskRecordMapper.java 188 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dto/msg/MsgOtherExchangeContentDTO.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/job/TaoLiJinJob.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/integral/IntegralTaskRecordMapper.xml 17 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/integral/IntegralDetailServiceImpl.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/integral/IntegralExchangeRecordServiceImpl.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/integral/IntegralExchangeServiceImpl.java 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/integral/IntegralTaskClassServiceImpl.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/integral/IntegralTaskRecordServiceImpl.java 150 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/tlj/UserTaoLiJinOriginServiceImpl.java 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/TokenRecordServiceImpl.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserSystemCouponServiceImpl.java 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/integral/IntegralTaskClassService.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/tlj/UserTaoLiJinOriginService.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/factory/msg/UserMsgVOFactory.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
utils/src/main/java/org/yeshi/utils/DateUtil.java 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/IntegralControllerV2.java
@@ -55,7 +55,6 @@
import com.yeshi.fanli.util.Constant;
import com.yeshi.fanli.util.StringUtil;
import com.yeshi.fanli.util.TimeUtil;
import com.yeshi.fanli.util.annotation.RequestSerializableByKey;
import com.yeshi.fanli.vo.integral.DailySignVO;
import com.yeshi.fanli.vo.integral.ExchangeTipVO;
import com.yeshi.fanli.vo.integral.IntegralDetailVO;
@@ -138,7 +137,6 @@
            // 用户签到
            Integer signState = 0;
            int signDays = 1;
            if (page == 1) {
                // 签到
@@ -168,9 +166,6 @@
                // 签到日期信息
                DailySignVO dailySignVO = integralTaskClassService.getDailySignList(uid, userRank.getId());
                if (dailySignVO != null) {
                    signDays = dailySignVO.getDays();
                }
                boolean ejectSign = false;
                if (signState == 1)
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/integral/IntegralTaskRecordMapper.java
@@ -1,89 +1,99 @@
package com.yeshi.fanli.dao.mybatis.integral;
import java.util.Date;
import java.util.List;
import java.util.Set;
import org.apache.ibatis.annotations.Param;
import com.yeshi.fanli.dao.BaseMapper;
import com.yeshi.fanli.entity.integral.IntegralTaskRecord;
public interface IntegralTaskRecordMapper extends BaseMapper<IntegralTaskRecord> {
    /**
     * 未领取金币
     *
     * @param count
     * @param uid
     * @return
     */
    List<IntegralTaskRecord> listNotReceived(@Param("count") int count, @Param("uid") Long uid);
    /**
     * 未领取金币- 排除id
     *
     * @param count
     * @param uid
     * @return
     */
    List<IntegralTaskRecord> listNotReceivedExcludeId(@Param("count") int count, @Param("uid") Long uid,
            @Param("list") Set<Long> idList);
    /**
     * 总完成
     *
     * @param uid
     * @param dateType
     * @return
     */
    Integer getTotalGoldCoin(@Param("uid") Long uid, @Param("cid") Long cid, @Param("dateType") Integer dateType);
    /**
     * 统计完成数量
     *
     * @param uid
     * @param cid
     * @param dateType
     * @return
     */
    Integer countFinished(@Param("uid") Long uid, @Param("cid") Long cid, @Param("dateType") Integer dateType);
    /**
     * 近7天签到情况
     *
     * @param uid
     * @param cid
     * @param sortState
     *            1倒序-创建时间
     * @return
     */
    List<IntegralTaskRecord> listDaySignRecord(@Param("uid") Long uid, @Param("cid") Long cid);
    /**
     * 未领取金币
     *
     * @param count
     * @param uid
     * @return
     */
    int countTotalGoldCoin(@Param("uid") Long uid);
    /**
     * 更新领取状态
     *
     * @param uid
     */
    void updateReceived(@Param("uid") Long uid);
    /**
     * 根据任务ID与时间段查询任务完成数量
     *
     * @param taskId
     * @param uid
     * @param minTime
     * @param maxTime
     */
    int countGetCountByTaskIdAndDay(@Param("taskId") Long taskId,@Param("uid")Long uid, @Param("minTime") Date minTime,
            @Param("maxTime") Date maxTime);
}
package com.yeshi.fanli.dao.mybatis.integral;
import java.util.Date;
import java.util.List;
import java.util.Set;
import org.apache.ibatis.annotations.Param;
import com.yeshi.fanli.dao.BaseMapper;
import com.yeshi.fanli.entity.integral.IntegralTaskRecord;
public interface IntegralTaskRecordMapper extends BaseMapper<IntegralTaskRecord> {
    /**
     * 未领取金币
     *
     * @param count
     * @param uid
     * @return
     */
    List<IntegralTaskRecord> listNotReceived(@Param("count") int count, @Param("uid") Long uid);
    /**
     * 未领取金币- 排除id
     *
     * @param count
     * @param uid
     * @return
     */
    List<IntegralTaskRecord> listNotReceivedExcludeId(@Param("count") int count, @Param("uid") Long uid,
            @Param("list") Set<Long> idList);
    /**
     * 总完成
     *
     * @param uid
     * @param dateType
     * @return
     */
    Integer getTotalGoldCoin(@Param("uid") Long uid, @Param("cid") Long cid, @Param("dateType") Integer dateType);
    /**
     * 统计完成数量
     *
     * @param uid
     * @param cid
     * @param dateType
     * @return
     */
    Integer countFinished(@Param("uid") Long uid, @Param("cid") Long cid, @Param("dateType") Integer dateType);
    /**
     * 近7天签到情况
     *
     * @param uid
     * @param cid
     * @param sortState
     *            1倒序-创建时间
     * @return
     */
    List<IntegralTaskRecord> listDaySignRecord(@Param("uid") Long uid, @Param("cid") Long cid);
    /**
     * 未领取金币
     *
     * @param count
     * @param uid
     * @return
     */
    int countTotalGoldCoin(@Param("uid") Long uid);
    /**
     * 更新领取状态
     *
     * @param uid
     */
    void updateReceived(@Param("uid") Long uid);
    /**
     * 根据任务ID与时间段查询任务完成数量
     *
     * @param taskId
     * @param uid
     * @param minTime
     * @param maxTime
     */
    int countGetCountByTaskIdAndDay(@Param("taskId") Long taskId,@Param("uid")Long uid, @Param("minTime") Date minTime,
            @Param("maxTime") Date maxTime);
    /**
     * 统计今日第几次完成的任务
     *
     * @param count
     * @param uid
     * @return
     */
    int countByTaskIdTodayNum(@Param("uid") Long uid, @Param("tid") Long tid, @Param("date") String date);
}
fanli/src/main/java/com/yeshi/fanli/dto/msg/MsgOtherExchangeContentDTO.java
@@ -8,6 +8,20 @@
 */
public class MsgOtherExchangeContentDTO {
    
    public enum MsgTypeOtherTypeEnum {
        coupon("券"), taoLiJin("推广红包"), cash("现金"), invite("激活或发布卡");
        private final String desc;
        private MsgTypeOtherTypeEnum(String desc) {
            this.desc = desc;
        }
        public String getDesc() {
            return desc;
        }
    }
    private String state; // 状态
    private String expend;  // 消耗
    private String totalGold;  //赠送类别
fanli/src/main/java/com/yeshi/fanli/job/TaoLiJinJob.java
@@ -196,7 +196,7 @@
            
            for (UserTaoLiJinGiveRecord record: overdueList) {
                try {
                    userTaoLiJinOriginService.giveSendBack(record.getGiveUid(), record.getAmount());
                    userTaoLiJinOriginService.giveSendBack(record.getGiveUid(), record);
                    // 更新记录
                    UserTaoLiJinGiveRecord updateRecord = new UserTaoLiJinGiveRecord();
                    updateRecord.setId(record.getId());
fanli/src/main/java/com/yeshi/fanli/mapping/integral/IntegralTaskRecordMapper.xml
@@ -1,6 +1,6 @@
<?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">
<?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="com.yeshi.fanli.dao.mybatis.integral.IntegralTaskRecordMapper">
    <resultMap id="BaseResultMap"
        type="com.yeshi.fanli.entity.integral.IntegralTaskRecord">
@@ -175,5 +175,12 @@
            and #{maxTime}>ir_create_time
        </if>
    </select>
</mapper>
    <select id="countByTaskIdTodayNum" resultType="Integer">
        SELECT IFNULL(COUNT(tr.`ir_id`),0) FROM yeshi_ec_integral_task_record tr
        WHERE tr.ir_uid = #{uid} AND tr.`ir_task_id`= #{tid}
              AND TO_DAYS(tr.ir_create_time) = TO_DAYS('${date}') AND tr.ir_create_time <![CDATA[<=]]>'${date}'
    </select>
</mapper>
fanli/src/main/java/com/yeshi/fanli/service/impl/integral/IntegralDetailServiceImpl.java
@@ -160,8 +160,8 @@
                BigDecimal income = new BigDecimal(voList.get(p).getIncome());
                
                // 去除支出负号
                finalList.get(key).getMonth().setExpend(expend.setScale(2).toString().replace("-", ""));
                finalList.get(key).getMonth().setIncome(income.setScale(2).toString());
                finalList.get(key).getMonth().setExpend(expend.setScale(0).toString().replace("-", ""));
                finalList.get(key).getMonth().setIncome(income.setScale(0).toString());
                p++;
            }
        }
fanli/src/main/java/com/yeshi/fanli/service/impl/integral/IntegralExchangeRecordServiceImpl.java
@@ -99,8 +99,18 @@
            if (StringUtil.isNullOrEmpty(progress))
                continue;
            
            // 自购免单券-只能兑换一次
            if (type == ExchangeTypeEnum.freeCouponBuy) {
                long num = integralExchangeRecordMapper.countRecordByUid(id, uid, null);
                if  (num >= 1) {
                    listValid.remove(i);
                    i --;
                    continue;
                }
            }
            // 今日兑换情况
            long num = integralExchangeRecordMapper.countRecordByUid(id, uid, null);
            long num = integralExchangeRecordMapper.countRecordByUid(id, uid, 1);
            Integer upperLimit = exchange.getUpperLimit();
            if (upperLimit == null) {
                progress = progress.replace("{已兑换}", num + "").replace("/{上限数}", "");
fanli/src/main/java/com/yeshi/fanli/service/impl/integral/IntegralExchangeServiceImpl.java
@@ -16,6 +16,7 @@
import com.yeshi.fanli.entity.bus.user.UserInfoExtra;
import com.yeshi.fanli.entity.bus.user.UserSystemCoupon;
import com.yeshi.fanli.entity.integral.CodePublishRecord;
import com.yeshi.fanli.entity.integral.IntegralDetail;
import com.yeshi.fanli.entity.integral.IntegralExchange;
import com.yeshi.fanli.entity.integral.IntegralExchange.ExchangeTypeEnum;
import com.yeshi.fanli.entity.money.UserMoneyDetail;
@@ -24,6 +25,7 @@
import com.yeshi.fanli.service.inter.config.ConfigService;
import com.yeshi.fanli.service.inter.hongbao.HongBaoV2Service;
import com.yeshi.fanli.service.inter.integral.CodePublishRecordService;
import com.yeshi.fanli.service.inter.integral.IntegralDetailService;
import com.yeshi.fanli.service.inter.integral.IntegralExchangeRecordService;
import com.yeshi.fanli.service.inter.integral.IntegralExchangeService;
import com.yeshi.fanli.service.inter.msg.MsgInviteDetailService;
@@ -80,6 +82,8 @@
    @Resource
    private MsgInviteDetailService msgInviteDetailService;
    
    @Resource
    private IntegralDetailService integralDetailService;
    
    @Override
@@ -212,33 +216,41 @@
        }
        
        String thing = "";
        String thingNum = "";
        int couponNews = 0;
        try {
            if (ExchangeTypeEnum.freeCouponBuy == type) {
                thing = "自购免单券";
                thingNum = "1张";
                userSystemCouponService.exchangeCoupon(uid, type.name(), UserSystemCoupon.SOURCE_EXCHANGE, null);
                
                couponNews = 1;
            } else if (ExchangeTypeEnum.freeCouponGive == type) {
                thing = "赠送免单券";
                thingNum = "1张";
                userSystemCouponService.exchangeCoupon(uid, type.name(), UserSystemCoupon.SOURCE_EXCHANGE, null);
                couponNews = 1;
            } else if (ExchangeTypeEnum.rebatePercentCoupon == type) {
                thing = "奖励免单券";
                thingNum = "3天";
                String percent = configService.get("exchange_rebate_percent");
                userSystemCouponService.exchangeCoupon(uid, type.name(), UserSystemCoupon.SOURCE_EXCHANGE, new BigDecimal(percent));
                couponNews = 1;
            } else if (ExchangeTypeEnum.inviteCodePublish == type) {
                thing = "邀请码发布卡";
                thingNum = "1组";
                if(codePublishRecordService.countValidRecord(uid) > 0)
                    throw new IntegralExchangeException(1, "三天之内不可重复兑换");
                codePublishRecordService.publishInviteCode(uid);
            } else if (ExchangeTypeEnum.taoLiJin == type) {
                thing = "推广红包";
                thingNum = exchange.getAmount() + "元";
                userTaoLiJinOriginService.exchangeMoney(uid, exchange.getAmount());
            } else if (ExchangeTypeEnum.cash == type) {
                thing = "现金红包";
                BigDecimal money = exchange.getAmount();
                thingNum = money + "元";
                // 1、插入红包数据
                HongBaoV2 hongBaoV2 = new HongBaoV2();
                hongBaoV2.setMoney(money);
@@ -282,6 +294,14 @@
            
            // 添加兑换记录
            integralExchangeRecordService.addExchangeRecord(id, uid);
            // 加入明细
            IntegralDetail detail = new IntegralDetail();
            detail.setUid(uid);
            detail.setTitle("金币兑换-" + thing + "-" + thingNum);
            detail.setMoney(-goldCoin);
            detail.setCreateTime(new Date());
            integralDetailService.insertSelective(detail);
            
            // 消息 
            final String things = thing;
@@ -392,7 +412,14 @@
            extraUpdate.setGoldCoin(surplus);
            userInfoExtraService.saveUserInfoExtra(extraUpdate);
            
            // 加入明细
            IntegralDetail detail = new IntegralDetail();
            detail.setUid(uid);
            detail.setTitle("金币兑换-邀请码激活卡-1组");
            detail.setMoney(-goldCoin);
            detail.setCreateTime(new Date());
            integralDetailService.insertSelective(detail);
            // 添加兑换记录
            integralExchangeRecordService.addExchangeRecord(id, uid);
            
fanli/src/main/java/com/yeshi/fanli/service/impl/integral/IntegralTaskClassServiceImpl.java
@@ -52,6 +52,12 @@
    
    @Override
    public IntegralTaskClass selectByPrimaryKey(Long id) {
        return integralTaskClassMapper.selectByPrimaryKey(id);
    }
    @Override
    public List<IntegralTaskClassVO> getIntegralTaskClassVO(Long uid, long start, int count) {
        return integralTaskClassMapper.getIntegralTaskClassVO(start, count);
    }
fanli/src/main/java/com/yeshi/fanli/service/impl/integral/IntegralTaskRecordServiceImpl.java
@@ -16,11 +16,14 @@
import com.yeshi.fanli.entity.bus.user.UserInfoExtra;
import com.yeshi.fanli.entity.integral.IntegralDetail;
import com.yeshi.fanli.entity.integral.IntegralTask;
import com.yeshi.fanli.entity.integral.IntegralTask.FrequencyEnum;
import com.yeshi.fanli.entity.integral.IntegralTaskClass;
import com.yeshi.fanli.entity.integral.IntegralTaskRecord;
import com.yeshi.fanli.exception.integral.IntegralTaskRecordException;
import com.yeshi.fanli.exception.user.UserInfoExtraException;
import com.yeshi.fanli.log.LogHelper;
import com.yeshi.fanli.service.inter.integral.IntegralDetailService;
import com.yeshi.fanli.service.inter.integral.IntegralTaskClassService;
import com.yeshi.fanli.service.inter.integral.IntegralTaskRecordService;
import com.yeshi.fanli.service.inter.integral.IntegralTaskService;
import com.yeshi.fanli.service.inter.user.UserInfoExtraService;
@@ -34,14 +37,15 @@
    @Resource
    private UserInfoExtraService userInfoExtraService;
    @Resource
    private IntegralDetailService integralDetailService;
    @Resource
    private IntegralTaskService integralTaskService;
    @Resource
    private IntegralTaskClassService integralTaskClassService;
    @Override
    public Integer getTotalGoldCoin(long uid, Long cid, Integer dateType) {
@@ -151,47 +155,14 @@
        if (userInfoExtra == null)
            throw new IntegralTaskRecordException(1, "用户信息不全");
        List<IntegralTaskRecord> list = integralTaskRecordMapper.listNotReceived(Integer.MAX_VALUE, uid);
        if (list == null || list.size() == 0)
            throw new IntegralTaskRecordException(1, "暂无可领取");
        Integer totalGoldCoin = 0;
        List<IntegralTaskRecord> list = integralTaskRecordMapper.listNotReceived(Integer.MAX_VALUE, uid);
        if (list == null || list.size() == 0)
            throw new IntegralTaskRecordException(1, "暂无可领取");
        Integer totalGoldCoin = 0;
        for (IntegralTaskRecord record : list) {
            Long uid2 = record.getUid();
            if (uid2 == null || uid.longValue() != uid2.longValue())
                continue; // 用户id不符合
            if (record.getState() != null && record.getState().intValue() == 1) {
                continue; // 已领取
            }
            IntegralTaskRecord taskRecord = new IntegralTaskRecord();
            taskRecord.setId(record.getId());
            taskRecord.setState(1); // 已领取
            taskRecord.setUpdateTime(new Date());
            integralTaskRecordMapper.updateByPrimaryKeySelective(taskRecord);
            Long taskId = record.getTaskId();
            if (taskId == null)
                continue;
            IntegralTask integralTask = integralTaskService.selectByPrimaryKey(taskId);
            if (integralTask == null)
                continue;
            // 加入明细
            IntegralDetail detail = new IntegralDetail();
            detail.setUid(uid);
            detail.setCreateTime(new Date());
            detail.setMoney(record.getGoldCoin());
            detail.setTitle(integralTask.getName());
            integralDetailService.insertSelective(detail);
            totalGoldCoin += record.getGoldCoin();
            if (addDetail(uid, record))
                totalGoldCoin += record.getGoldCoin();
        }
        Integer goldCoin = userInfoExtra.getGoldCoin();
@@ -228,39 +199,8 @@
            if (record == null)
                continue;
            Long uid2 = record.getUid();
            if (uid2 == null || uid.longValue() != uid2.longValue())
                continue; // 用户id不符合
            if (record.getState() != null && record.getState().intValue() == 1) {
                continue; // 已领取
            }
            IntegralTaskRecord taskRecord = new IntegralTaskRecord();
            taskRecord.setId(record.getId());
            taskRecord.setState(1); // 已领取
            taskRecord.setUpdateTime(new Date());
            integralTaskRecordMapper.updateByPrimaryKeySelective(taskRecord);
            Long taskId = record.getTaskId();
            if (taskId == null)
                continue;
            IntegralTask integralTask = integralTaskService.selectByPrimaryKey(taskId);
            if (integralTask == null)
                continue;
            // 加入明细
            IntegralDetail detail = new IntegralDetail();
            detail.setUid(uid);
            detail.setCreateTime(new Date());
            detail.setMoney(record.getGoldCoin());
            detail.setTitle(integralTask.getName());
            integralDetailService.insertSelective(detail);
            totalGoldCoin += record.getGoldCoin();
            if (addDetail(uid, record))
                totalGoldCoin += record.getGoldCoin();
        }
        Integer goldCoin = userInfoExtra.getGoldCoin();
@@ -279,6 +219,62 @@
        return extra.getGoldCoin();
    }
    public boolean addDetail(Long uid, IntegralTaskRecord record) throws IntegralTaskRecordException {
        Long uid2 = record.getUid();
        if (uid2 == null || uid.longValue() != uid2.longValue())
            return false; // 用户id不符合
        if (record.getState() != null && record.getState().intValue() == 1) {
            return false; // 已领取
        }
        IntegralTaskRecord taskRecord = new IntegralTaskRecord();
        taskRecord.setId(record.getId());
        taskRecord.setState(1); // 已领取
        taskRecord.setUpdateTime(new Date());
        integralTaskRecordMapper.updateByPrimaryKeySelective(taskRecord);
        Long cid = record.getCid();
        if (cid == null)
            return false;
        IntegralTaskClass taskClass = integralTaskClassService.selectByPrimaryKey(cid);
        if (taskClass == null)
            return false;
        Long taskId = record.getTaskId();
        if (taskId == null)
            return false;
        IntegralTask integralTask = integralTaskService.selectByPrimaryKey(taskId);
        if (integralTask == null)
            return false;
        int num = 0;
        FrequencyEnum frequency = integralTask.getFrequency();
        if (frequency == FrequencyEnum.everyday) {
            num = integralTaskRecordMapper.countByTaskIdTodayNum(uid, taskId, TimeUtil.getWholeTime(record.getCreateTime().getTime()));
        } else if (frequency == FrequencyEnum.onlyOne) {
            num = 1;
        }
        if (num <= 0)
            num = 1;
        String title = taskClass.getName() + "-" + integralTask.getName() + "-" + num + "次";
        // 加入明细
        IntegralDetail detail = new IntegralDetail();
        detail.setUid(uid);
        detail.setTitle(title);
        detail.setMoney(record.getGoldCoin());
        detail.setCreateTime(record.getCreateTime());
        integralDetailService.insertSelective(detail);
        return true;
    }
    @Override
    public Integer countGetCountByTaskIdAndDay(Long taskId, Long uid, Date day) {
        if (day == null)
fanli/src/main/java/com/yeshi/fanli/service/impl/tlj/UserTaoLiJinOriginServiceImpl.java
@@ -14,9 +14,11 @@
import org.yeshi.utils.DateUtil;
import com.yeshi.fanli.dao.mybatis.tlj.UserTaoLiJinOriginMapper;
import com.yeshi.fanli.dto.msg.MsgOtherGiveContentDTO;
import com.yeshi.fanli.dto.msg.MsgOtherTaoLiJinContentDTO;
import com.yeshi.fanli.entity.bus.tlj.DeviceTaoLiJinRecord;
import com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinDetail;
import com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinGiveRecord;
import com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinDetail.TaoLiJinDetailTypeEnum;
import com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinOrigin;
import com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinOrigin.TaoLiJinOriginEnum;
@@ -614,10 +616,12 @@
    
    @Override
    @Transactional
    public void  giveSendBack(Long uid, BigDecimal money) throws UserTaoLiJinOriginException{
        if (uid == null || money == null) {
    public void  giveSendBack(Long uid, UserTaoLiJinGiveRecord record) throws UserTaoLiJinOriginException{
        if (uid == null || record == null) {
            throw new UserTaoLiJinOriginException(1, "参数不能为空");
        }
        BigDecimal money = record.getAmount();
        
        // 添加红包余额
        userMoneyExtraService.addTaoLiJin(uid, money, false);
@@ -632,6 +636,24 @@
        detail.setTitle(TaoLiJinDetailTypeEnum.giveBack.getDesc());
        detail.setCreateTime(new Date());
        userTaoLiJinDetailService.insertSelective(detail);
        executor.execute(new Runnable() {
            @Override
            public void run() {
                // 退回消息
                String beiZhu = "请到我的-推广红包查看";
                SimpleDateFormat sd = new SimpleDateFormat("yyyy.MM.dd HH.mm");
                MsgOtherGiveContentDTO msgOther = new MsgOtherGiveContentDTO();
                msgOther.setType(MsgOtherGiveContentDTO.TYEP_TLJ);
                msgOther.setTitle("赠送推广红包退回");
                msgOther.setGiveType("你赠送的"+ money + "推广红包未被成功领取");
                msgOther.setGiveTime(sd.format(record.getGiveTime()));
                msgOther.setReturnTime(sd.format(new Date()));
                userOtherMsgNotificationService.tokenGiveMsg(record.getGiveUid(), beiZhu, msgOther);
            }
        });
    }
    
}
fanli/src/main/java/com/yeshi/fanli/service/impl/user/TokenRecordServiceImpl.java
@@ -373,7 +373,7 @@
                    msgOther.setType(MsgOtherGiveContentDTO.TYEP_COUPON);
                    msgOther.setTitle("赠送免单券");
                    msgOther.setGiveType("你赠送的免单券被成功领取");
                    msgOther.setReceiveInfo("昵称:  " + userName + " ID:" + uid);
                    msgOther.setReceiveInfo("昵称: :" + userName + " ID:" + uid);
                    msgOther.setGiveTime(sd.format(giveRecord.getGiveTime()));
                    msgOther.setReceiveTime(sd.format(new Date()));
                    userOtherMsgNotificationService.tokenGiveMsg(giveUid, beiZhu, msgOther);
@@ -495,7 +495,7 @@
                            userName = user.getNickName();
                        MsgOtherGiveContentDTO msgOther = new MsgOtherGiveContentDTO();
                        msgOther.setType(MsgOtherGiveContentDTO.TYEP_COUPON);
                        msgOther.setType(MsgOtherGiveContentDTO.TYEP_TLJ);
                        msgOther.setTitle("赠送推广红包");
                        msgOther.setGiveType("你赠送的推广红包被成功领取");
                        msgOther.setReceiveInfo("昵称:  " + userName + " ID:" + uid);
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserSystemCouponServiceImpl.java
@@ -1266,7 +1266,6 @@
            userSystemCouponRecordService.updateByPrimaryKeySelective(couponRecord);
            UserSystemCoupon userSystemCoupon = couponRecord.getUserSystemCoupon();
            // 状态初始化
            userSystemCoupon.setState(UserSystemCoupon.STATE_CAN_USE);
            userSystemCoupon.setUseTime(null);
@@ -1367,8 +1366,10 @@
        Date now = new Date();
        Date endTime = userCoupon.getEndTime();
        if (endTime != null && endTime.getTime() < now.getTime()) {
            // TODO 过期
            // 过期
            List<UserSystemCoupon> list = new ArrayList<UserSystemCoupon>();
            list.add(userCoupon);
            updateCounponInvalid(list);
            return;
        }
        
@@ -1730,7 +1731,7 @@
                userCouponVO.setCouponPicture(systemCoupon.getPicture());
            }
            if (UserSystemCoupon.STATE_CAN_USE == state) {
            if (UserSystemCoupon.STATE_CAN_USE == state || UserSystemCoupon.STATE_IN_USE == state) {
                int differentDays = 0;
                if (endTime != null && startTime != null) {
                    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
@@ -1830,12 +1831,19 @@
                            }
                            tips = tips.replace("{口令}", tokenRecord.getToken()).replace("{下载链接}", configService.get("app_down_link"));
                        }
                        Date endTimeGive = record.getEndTime();
                        if (endTimeGive != null) {
                            Map<String, Object> remainDays = new HashMap<String, Object>();
                            remainDays.put("content", "剩余" + DateUtil.dateDiff2(new Date(), endTimeGive) + "过期");
                            remainDays.put("fontColor", "#F14242");
                            userCouponVO.setRemainDays(remainDays);
                        }
                    }
                } else {
                    tips = "";
                }
                userCouponVO.setGiveTips(tips);
            } else if (UserSystemCoupon.STATE_END_USE == state) {
                if (give && CouponTypeEnum.freeCouponGive == type) {
                    userCouponVO.setState(UserSystemCoupon.STATE_GIVE_END);
@@ -1983,8 +1991,9 @@
            Date now = new Date();
            Date endTime = userCoupon.getEndTime();
            if (endTime != null && endTime.getTime() < now.getTime()) {
                // TODO 过期
                List<UserSystemCoupon> list = new ArrayList<UserSystemCoupon>();
                list.add(userCoupon);
                updateCounponInvalid(list);
                continue;
            }
            
fanli/src/main/java/com/yeshi/fanli/service/inter/integral/IntegralTaskClassService.java
@@ -47,5 +47,7 @@
     */
    public IntegralTaskClass getByUniqueKey(String uniqueKey);
    public IntegralTaskClass selectByPrimaryKey(Long id);
}
fanli/src/main/java/com/yeshi/fanli/service/inter/tlj/UserTaoLiJinOriginService.java
@@ -4,6 +4,7 @@
import java.util.Date;
import java.util.List;
import com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinGiveRecord;
import com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinOrigin;
import com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinReport;
import com.yeshi.fanli.entity.bus.user.UserRank;
@@ -153,8 +154,8 @@
    /**
     * 红包赠送退回
     * @param uid
     * @param money
     * @param UserTaoLiJinGiveRecord record
     * @throws UserTaoLiJinOriginException
     */
    public void giveSendBack(Long uid, BigDecimal money) throws UserTaoLiJinOriginException;
    public void giveSendBack(Long uid, UserTaoLiJinGiveRecord record) throws UserTaoLiJinOriginException;
}
fanli/src/main/java/com/yeshi/fanli/util/factory/msg/UserMsgVOFactory.java
@@ -732,6 +732,12 @@
                contentList.add(new ClientTextStyleVO(dto.getReceiveTime() + "", COLOR_CONTENT));
                items.add(new CommonMsgItemVO(new ClientTextStyleVO("领取时间", COLOR_TITLE), contentList));
            }
            if (!StringUtil.isNullOrEmpty(dto.getReturnTime())) {
                contentList = new ArrayList<>();
                contentList.add(new ClientTextStyleVO(dto.getReturnTime() + "", COLOR_CONTENT));
                items.add(new CommonMsgItemVO(new ClientTextStyleVO("退回时间", COLOR_TITLE), contentList));
            }
            contentList = new ArrayList<>();
            contentList.add(new ClientTextStyleVO(StringUtil.isNullOrEmpty(msg.getBeiZhu()) ? "无" : msg.getBeiZhu(),
utils/src/main/java/org/yeshi/utils/DateUtil.java
@@ -37,7 +37,7 @@
    public static String dateDiff2(Date startTime, Date endTime) throws Exception {
        String datatime = 0 + "天" + 0 + "小时" + 0 + "分钟";
        String datatime = "0分钟";
        long nm = 1000 * 60;// 一分钟的毫秒数
        long nh = 1000 * 60 * 60;// 一小时的毫秒数
@@ -45,13 +45,19 @@
        // 获得两个时间的毫秒时间差异
        long diff = endTime.getTime() - startTime.getTime();
        long day = diff / nd;// 计算差多少天
        long hour = diff % nd / nh;// 计算差多少小时
        long min = diff % nd % nh / nm;// 计算差多少分钟
        datatime = day + "天" + hour + "小时" + min + "分钟";
        if (day > 0) {
            datatime = day + "天" + hour + "时" + min + "分";
        } else {
            if (hour > 0 ) {
                datatime = hour + "时" + min + "分";
            } else {
                datatime = min + "分";
            }
        }
        return datatime;
    }