admin
2022-04-26 36681e15e12aaa9135f69260472de65303cdcba3
任务优化
39个文件已修改
7个文件已添加
1424 ■■■■ 已修改文件
app/pom.xml 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/com/yeshi/makemoney/app/Application.java 35 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/com/yeshi/makemoney/app/controller/client/api/ExtractController.java 19 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/com/yeshi/makemoney/app/controller/client/api/GoldCornController.java 86 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/com/yeshi/makemoney/app/controller/client/api/MsgController.java 123 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/com/yeshi/makemoney/app/controller/client/api/UserController.java 56 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/com/yeshi/makemoney/app/dao/msg/AppPageNotifyMsgDao.java 73 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/com/yeshi/makemoney/app/dao/user/UserExtraInfoDao.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/com/yeshi/makemoney/app/dao/user/WXUserInfoMapper.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/com/yeshi/makemoney/app/entity/goldcorn/GoldCornGetType.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/com/yeshi/makemoney/app/entity/msg/AppPageNotifyMsg.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/com/yeshi/makemoney/app/entity/msg/UserMsgType.java 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/com/yeshi/makemoney/app/exception/user/UserAccountException.java 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/com/yeshi/makemoney/app/service/impl/goldcorn/GoldCornGetPriceServiceImpl.java 62 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/com/yeshi/makemoney/app/service/impl/goldcorn/GoldCornMakeServiceImpl.java 129 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/com/yeshi/makemoney/app/service/impl/goldcorn/GoldCornSettleServiceImpl.java 23 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/com/yeshi/makemoney/app/service/impl/money/ExtractServiceImpl.java 29 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/com/yeshi/makemoney/app/service/impl/msg/AppPageNotifyMsgServiceImpl.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/com/yeshi/makemoney/app/service/impl/msg/UserMsgNotifyServiceImpl.java 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/com/yeshi/makemoney/app/service/impl/msg/UserMsgServiceImpl.java 22 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/com/yeshi/makemoney/app/service/impl/user/UserAccountServiceImpl.java 90 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/com/yeshi/makemoney/app/service/impl/user/WXUserInfoServiceImpl.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/com/yeshi/makemoney/app/service/inter/goldcorn/GoldCornGetPriceService.java 50 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/com/yeshi/makemoney/app/service/inter/goldcorn/GoldCornMakeService.java 41 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/com/yeshi/makemoney/app/service/inter/goldcorn/GoldCornSettleService.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/com/yeshi/makemoney/app/service/inter/msg/AppPageNotifyMsgService.java 61 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/com/yeshi/makemoney/app/service/inter/msg/UserMsgNotifyService.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/com/yeshi/makemoney/app/service/inter/msg/UserMsgService.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/com/yeshi/makemoney/app/service/inter/user/UserAccountService.java 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/com/yeshi/makemoney/app/service/inter/user/WXUserInfoService.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/com/yeshi/makemoney/app/service/manager/VerifyCodeManager.java 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/com/yeshi/makemoney/app/utils/Constant.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/com/yeshi/makemoney/app/utils/factory/msg/UserMsgFactory.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/com/yeshi/makemoney/app/utils/goldcorn/GoldCornUtil.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/com/yeshi/makemoney/app/utils/mq/CMQManager.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/com/yeshi/makemoney/app/vo/goldcorn/GoldCornDoTaskVO.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/com/yeshi/makemoney/app/vo/msg/AppPageNotifyMsgVO.java 59 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/com/yeshi/makemoney/app/vo/msg/UserMsgVO.java 127 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/resources/mapper/OrderRecordMapper.xml 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/resources/mapper/QQUserInfoMapper.xml 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/resources/mapper/UserMoneyRecordMapper.xml 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/resources/mapper/UserVIPInfoMapper.xml 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/resources/mapper/WXUserInfoMapper.xml 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/test/java/test/goldcorn/GoldCornTest.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/test/java/test/msg/MsgTest.java 42 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pom.xml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/pom.xml
@@ -249,6 +249,43 @@
            <version>3.3.0</version>
        </dependency>
        <dependency>
            <groupId>com.tencentcloudapi</groupId>
            <artifactId>tencentcloud-sdk-java</artifactId>
            <!-- go to https://search.maven.org/search?q=tencentcloud-sdk-java and get the latest version. -->
            <!-- 请到https://search.maven.org/search?q=tencentcloud-sdk-java查询所有版本,最新版本如下 -->
            <version>3.1.472</version>
            <exclusions>
                <!--<exclusion>-->
                    <!--<groupId>io.netty</groupId>-->
                    <!--<artifactId>*</artifactId>-->
                <!--</exclusion>-->
                <!--<exclusion>-->
                    <!--<groupId>commons-logging</groupId>-->
                    <!--<artifactId>*</artifactId>-->
                <!--</exclusion>-->
                <!--<exclusion>-->
                    <!--<groupId>com.google.code.gson</groupId>-->
                    <!--<artifactId>*</artifactId>-->
                <!--</exclusion>-->
                <!--<exclusion>-->
                    <!--<groupId>javax.xml.bind</groupId>-->
                    <!--<artifactId>*</artifactId>-->
                <!--</exclusion>-->
                <!--<exclusion>-->
                    <!--<groupId>org.ini4j</groupId>-->
                    <!--<artifactId>*</artifactId>-->
                <!--</exclusion>-->
            </exclusions>
        </dependency>
        <dependency>
            <groupId>com.googlecode.json-simple</groupId>
            <artifactId>json-simple</artifactId>
            <version>1.1.1</version>
        </dependency>
    </dependencies>
app/src/main/java/com/yeshi/makemoney/app/Application.java
@@ -1,5 +1,12 @@
package com.yeshi.makemoney.app;
import com.yeshi.makemoney.app.dto.mq.GoldCornSettleMQMsg;
import com.yeshi.makemoney.app.exception.goldcorn.GoldCornConsumeRecordException;
import com.yeshi.makemoney.app.exception.goldcorn.GoldCornMoneyExchangeRateRecordException;
import com.yeshi.makemoney.app.exception.money.UserMoneyRecordException;
import com.yeshi.makemoney.app.exception.user.UserInfoException;
import com.yeshi.makemoney.app.service.inter.goldcorn.GoldCornSettleService;
import com.yeshi.makemoney.app.utils.mq.CMQManager;
import org.mybatis.spring.annotation.MapperScan;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -14,8 +21,11 @@
import org.yeshi.utils.tencentcloud.COSManager;
import org.yeshi.utils.tencentcloud.entity.COSInitParams;
import javax.annotation.Resource;
import javax.servlet.MultipartConfigElement;
import java.io.File;
import java.util.Iterator;
import java.util.Map;
import java.util.Properties;
//不引入数据库
@@ -41,6 +51,9 @@
        initCOS();
    }
    @Resource
    private GoldCornSettleService goldCornSettleService;
    private void initMQMsgConsumer() {
        final int THREAD_NUM = 3;
@@ -49,6 +62,28 @@
            new JobThreadExecutorServiceImpl().run(new Runnable() {
                @Override
                public void run() {
                    Map<String, GoldCornSettleMQMsg> map = CMQManager.getInstance().consumeGoldCornSettleMsg(10);
                    if (map != null) {
                        for (Iterator<String> its = map.keySet().iterator(); its.hasNext(); ) {
                            String key = its.next();
                            GoldCornSettleMQMsg msg = map.get(key);
                            try {
                                goldCornSettleService.settle(msg.getUid(), msg.getDay());
                                CMQManager.getInstance().deleteGoldCornSettleMsg(key);
                            } catch (UserInfoException e) {
                                e.printStackTrace();
                            } catch (GoldCornMoneyExchangeRateRecordException e) {
                                e.printStackTrace();
                            } catch (UserMoneyRecordException e) {
                                e.printStackTrace();
                            } catch (GoldCornConsumeRecordException e) {
                                e.printStackTrace();
                            }catch (Exception e){
                                e.printStackTrace();
                            }
                        }
                    }
                }
            });
app/src/main/java/com/yeshi/makemoney/app/controller/client/api/ExtractController.java
@@ -16,6 +16,7 @@
import com.yeshi.makemoney.app.service.inter.money.ExtractService;
import com.yeshi.makemoney.app.service.inter.money.UserExtractMoneyLimitService;
import com.yeshi.makemoney.app.service.inter.money.UserMoneyService;
import com.yeshi.makemoney.app.service.inter.user.UserInfoService;
import com.yeshi.makemoney.app.service.inter.user.WXUserInfoService;
import com.yeshi.makemoney.app.utils.ApiCodeConstant;
import com.yeshi.makemoney.app.utils.Constant;
@@ -59,9 +60,12 @@
    private ExtractService extractService;
    @Resource
    private UserInfoService userInfoService;
    @Resource
    private UserExtractMoneyLimitService userExtractMoneyLimitService;
    private   Gson gson = JsonUtil.getConvertBigDecimalToStringBuilder(new GsonBuilder()).create();
    private Gson gson = JsonUtil.getConvertBigDecimalToStringBuilder(new GsonBuilder()).create();
    /**
     * @return java.lang.String
@@ -74,13 +78,14 @@
    @RequestMapping("getExtractInfo")
    @ResponseBody
    public String getExtractInfo(AcceptData acceptData, Long uid) {
        UserInfo user = userInfoService.get(uid);
        ExtractInfoVO vo = new ExtractInfoVO();
        vo.setBalance(userMoneyService.getBalance(uid).setScale(2));
        BigDecimal extracting = extractService.getExtractingMoney(uid);
        if (extracting.compareTo(new BigDecimal(0)) > 0) {
            vo.setExtracting(extracting.setScale(2).toString());
        }
        vo.setNeedBindWX(wxUserInfoService.selectByUid(uid) == null);
        vo.setNeedBindWX(user.getWxUser() == null);
        return JsonUtil.loadTrueResult(gson.toJson(vo));
    }
@@ -123,11 +128,17 @@
    @RequestMapping("extract")
    @ResponseBody
    public String extract(AcceptData acceptData, Long uid, BigDecimal money, HttpServletRequest request) {
        WXUserInfo wxUserInfo = wxUserInfoService.selectByUid(uid);
        if (wxUserInfo == null) {
        UserInfo user = userInfoService.get(uid);
        if (user.getWxUser() == null) {
            return JsonUtil.loadFalseResult("尚未绑定微信");
        }
        WXUserInfo wxUserInfo = wxUserInfoService.get(user.getWxUser().getId());
        if (wxUserInfo == null) {
            return JsonUtil.loadFalseResult("请重新绑定微信");
        }
        Extract extract = new Extract();
        extract.setUser(new UserInfo(uid));
        extract.setIp(IPUtil.getRemotIP(request) + ":" + request.getRemotePort());
app/src/main/java/com/yeshi/makemoney/app/controller/client/api/GoldCornController.java
@@ -16,6 +16,7 @@
import com.yeshi.makemoney.app.service.inter.goldcorn.GoldCornGetRecordService;
import com.yeshi.makemoney.app.service.inter.goldcorn.GoldCornMakeService;
import com.yeshi.makemoney.app.service.inter.team.TeamInviteRelationService;
import com.yeshi.makemoney.app.service.inter.user.UserExtraInfoService;
import com.yeshi.makemoney.app.service.query.goldcorn.GoldCornConsumeRecordQuery;
import com.yeshi.makemoney.app.service.query.goldcorn.GoldCornGetRecordQuery;
import com.yeshi.makemoney.app.utils.Constant;
@@ -25,6 +26,7 @@
import com.yeshi.makemoney.app.vo.goldcorn.*;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
@@ -34,6 +36,7 @@
import javax.annotation.Resource;
import java.lang.reflect.Type;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
/**
@@ -60,6 +63,12 @@
    @Resource
    private TeamInviteRelationService teamInviteRelationService;
    @Resource
    private UserExtraInfoService userExtraInfoService;
    @Resource
    private RedisTemplate<String, Object> redisTemplate;
    private Gson gson = JsonUtil.getConvertBigDecimalToStringBuilder(new GsonBuilder()).create();
@@ -194,34 +203,41 @@
    @UserLogin(uid = "#uid")
    @RequestMapping("doTask")
    @ResponseBody
    public String doTask(AcceptData acceptData, Long uid, String taskData) {
        Type type = new TypeToken<List<GoldCornDoTaskVO>>() {
        }.getType();
        List<GoldCornDoTaskVO> list = null;
    public String doTask(AcceptData acceptData, Long uid, GoldCornDoTaskVO vo) {
        if (vo.getType() == null) {
            return JsonUtil.loadFalseResult("参数不完整");
        }
        try {
            list = gson.fromJson(taskData, type);
        } catch (Exception e) {
        }
        if (list == null) {
            return JsonUtil.loadFalseResult("数据为空");
        }
        for (GoldCornDoTaskVO vo : list) {
            try {
                goldCornMakeService.addGoldCorn(uid, vo.getType(), vo.getDouble() == null ? false : vo.getDouble(), new Date(vo.getFinishTime() == null ? System.currentTimeMillis() : vo.getFinishTime()), null);
            } catch (UserInfoException e) {
                e.printStackTrace();
            } catch (GoldCornGetPriceException e) {
                e.printStackTrace();
            } catch (GoldCornGetFrequencyConfigException e) {
                e.printStackTrace();
            } catch (GoldCornMakeException e) {
                e.printStackTrace();
            JSONObject data = new JSONObject();
            Integer result = null;
            if (vo.getType() == GoldCornGetType.watchVideo) {
                result = goldCornMakeService.watchVideo(uid, vo.getDouble(), vo.getFinishTime() == null ? new Date() : new Date(vo.getFinishTime()), vo.getTimeSeconds());
            } else if (vo.getType() == GoldCornGetType.readNovel) {
                result = goldCornMakeService.readNovel(uid, vo.getDouble(), vo.getFinishTime() == null ? new Date() : new Date(vo.getFinishTime()), vo.getTimeSeconds());
            } else if (vo.getType() == GoldCornGetType.scanNews) {
                result = goldCornMakeService.scanNews(uid, vo.getDouble(), vo.getFinishTime() == null ? new Date() : new Date(vo.getFinishTime()), vo.getNum());
            } else {
                return JsonUtil.loadFalseResult("任务类型出错");
            }
            data.put("goldCorn", result);
            return JsonUtil.loadTrueResult(data);
        } catch (GoldCornGetPriceException e) {
            e.printStackTrace();
            return JsonUtil.loadFalseResult("业务错误");
        } catch (UserInfoException e) {
            e.printStackTrace();
            return JsonUtil.loadFalseResult(e.getMessage());
        } catch (GoldCornMakeException e) {
            e.printStackTrace();
            return JsonUtil.loadFalseResult(e.getMessage());
        } catch (GoldCornGetFrequencyConfigException e) {
            e.printStackTrace();
            return JsonUtil.loadFalseResult(e.getMessage());
        }
        return JsonUtil.loadTrueResult("");
    }
@@ -246,6 +262,7 @@
        if (uid != null) {
            vo.setSignIned(goldCornMakeService.isSignIn(uid, now));
            vo.setContinueSignInDay(goldCornMakeService.getContinueSignDay(uid));
            vo.setNotify(userExtraInfoService.getSignInNotify(uid));
        }
        /*************签到日期列表开始**************/
@@ -293,7 +310,7 @@
            } else {
                dayDiff++;
                //未来的时间
                dayInfo.setGoldCorn(goldCornGetPriceService.getSingInPrice(acceptData.getSystem(), vo.getContinueSignInDay() + 1 + dayDiff));
                dayInfo.setGoldCorn(goldCornGetPriceService.getSingInPrice(acceptData.getSystem(), vo.getContinueSignInDay() + (vo.isSignIned() ? 0 : 1) + dayDiff));
                dayInfo.setState(SignInInfoVO.SignInDayInfo.STATE_NOT_GOT);
            }
            //清除临时变量
@@ -354,4 +371,23 @@
    }
    /**
     * @return java.lang.String
     * @author hxh
     * @description 设置签到提醒
     * @date 10:39 2022/4/22
     * @param: acceptData
     * @param: uid
     * @param: notify 是否提醒
     **/
    @UserLogin(uid = "#uid")
    @RequestMapping("setSignInNotify")
    @ResponseBody
    public String setSignInNotify(AcceptData acceptData, Long uid, boolean notify) {
        userExtraInfoService.setSignInNotify(uid, notify);
        return JsonUtil.loadTrueResult("");
    }
}
app/src/main/java/com/yeshi/makemoney/app/controller/client/api/MsgController.java
New file
@@ -0,0 +1,123 @@
package com.yeshi.makemoney.app.controller.client.api;
import com.google.gson.*;
import com.yeshi.makemoney.app.entity.msg.AppPageNotifyMsg;
import com.yeshi.makemoney.app.entity.msg.UserMsg;
import com.yeshi.makemoney.app.entity.team.TeamInviteRelation;
import com.yeshi.makemoney.app.entity.team.UserSpreadImg;
import com.yeshi.makemoney.app.entity.user.UserInfo;
import com.yeshi.makemoney.app.exception.team.SpreadImgException;
import com.yeshi.makemoney.app.exception.team.TeamInviteRelationException;
import com.yeshi.makemoney.app.exception.team.UserSpreadImgException;
import com.yeshi.makemoney.app.exception.user.UserInfoException;
import com.yeshi.makemoney.app.service.inter.goldcorn.GoldCornGetRecordService;
import com.yeshi.makemoney.app.service.inter.msg.AppPageNotifyMsgService;
import com.yeshi.makemoney.app.service.inter.msg.UserMsgService;
import com.yeshi.makemoney.app.service.inter.team.TeamInviteRelationService;
import com.yeshi.makemoney.app.service.inter.team.UserSpreadImgService;
import com.yeshi.makemoney.app.service.inter.user.UserExtraInfoService;
import com.yeshi.makemoney.app.service.inter.user.UserInfoService;
import com.yeshi.makemoney.app.service.query.msg.UserMsgQuery;
import com.yeshi.makemoney.app.utils.Constant;
import com.yeshi.makemoney.app.utils.annotation.UserLogin;
import com.yeshi.makemoney.app.vo.AcceptData;
import com.yeshi.makemoney.app.vo.msg.AppPageNotifyMsgVO;
import com.yeshi.makemoney.app.vo.msg.UserMsgVO;
import com.yeshi.makemoney.app.vo.team.TeamInfoVO;
import com.yeshi.makemoney.app.vo.team.TeamMemberListVO;
import com.yeshi.makemoney.app.vo.user.UserInfoVO;
import net.sf.json.JSONObject;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.yeshi.utils.BigDecimalUtil;
import org.yeshi.utils.JsonUtil;
import org.yeshi.utils.ThreadUtil;
import org.yeshi.utils.TimeUtil;
import javax.annotation.Resource;
import java.lang.reflect.Type;
import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;
/**
 * @author hxh
 * @title: TeamController
 * @description: 团队接口
 * @date 2021/11/16 17:37
 */
@Controller
@RequestMapping("api/v1/msg")
public class MsgController {
    @Resource
    private AppPageNotifyMsgService appPageNotifyMsgService;
    @Resource
    private UserMsgService userMsgService;
    /**
     * @return java.lang.String
     * @author hxh
     * @description 获取应用内通知信息
     * @date 10:50 2022/4/24
     * @param: acceptData
     * @param: type
     **/
    @ResponseBody
    @RequestMapping("getNotifyMsg")
    public String getNotifyMsg(AcceptData acceptData, String type) {
        AppPageNotifyMsg.AppPageNotifyMsgType msgType = AppPageNotifyMsg.AppPageNotifyMsgType.valueOf(type);
        if (msgType == null) {
            return JsonUtil.loadFalseResult("类型错误");
        }
        AppPageNotifyMsg msg = appPageNotifyMsgService.selectByType(acceptData.getSystem(), msgType, new Date());
        if (msg == null) {
            return JsonUtil.loadFalseResult("暂无通知消息");
        }
        return JsonUtil.loadTrueResult(AppPageNotifyMsgVO.create(msg));
    }
    @UserLogin(uid = "#uid")
    @ResponseBody
    @RequestMapping("getUserMsg")
    public String getUserMsg(AcceptData acceptData, Long uid, int page) {
        UserMsgQuery query = new UserMsgQuery();
        query.setUid(uid);
        List<UserMsg> msgList = userMsgService.list(query, page, Constant.PAGE_SIZE);
        long count = userMsgService.count(query);
        Gson gson = new GsonBuilder().registerTypeAdapter(Date.class, new JsonSerializer<Date>() {
            @Override
            public JsonElement serialize(Date value, Type theType, JsonSerializationContext context) {
                return value == null ? new JsonPrimitive("") : new JsonPrimitive(TimeUtil.getGernalTime(value.getTime(), "yyyy.MM.dd HH:mm"));
            }
        }).create();
        List<UserMsgVO> voList = new ArrayList<>();
        if (msgList != null) {
            voList = msgList.stream().map(item -> {
                return UserMsgVO.create(item);
            }).collect(Collectors.toList());
        }
        JSONObject data = new JSONObject();
        data.put("list", gson.toJson(voList));
        data.put("count", count);
        ThreadUtil.run(new Runnable() {
            @Override
            public void run() {
                userMsgService.readAllMsg(uid);
            }
        });
        return JsonUtil.loadTrueResult(data);
    }
}
app/src/main/java/com/yeshi/makemoney/app/controller/client/api/UserController.java
@@ -7,6 +7,7 @@
import com.yeshi.makemoney.app.entity.user.WXUserInfo;
import com.yeshi.makemoney.app.entity.vip.UserVIPInfo;
import com.yeshi.makemoney.app.exception.user.LoginException;
import com.yeshi.makemoney.app.exception.user.UserAccountException;
import com.yeshi.makemoney.app.service.inter.goldcorn.GoldCornGetRecordService;
import com.yeshi.makemoney.app.service.inter.money.UserMoneyService;
import com.yeshi.makemoney.app.service.inter.team.TeamInviteRelationService;
@@ -102,6 +103,25 @@
            return JsonUtil.loadFalseResult("信息不完整");
        }
        loginInfo.setSystem(acceptData.getSystem());
        return login(loginInfo, acceptData);
    }
    @ResponseBody
    @RequestMapping("loginWX")
    public String loginWX(AcceptData acceptData, String code, HttpServletRequest request) {
        LoginInfoDTO loginInfo = new LoginInfoDTO();
        loginInfo.setIpInfo(IPUtil.getRemotIP(request) + ":" + request.getRemotePort());
        loginInfo.setLoginType(UserLoginRecord.TYPE_LOGIN_WX);
        if (StringUtil.isNullOrEmpty(code)) {
            return JsonUtil.loadFalseResult("信息不完整");
        }
        loginInfo.setWxCode(code);
        loginInfo.setSystem(acceptData.getSystem());
        return login(loginInfo, acceptData);
    }
    private String login(LoginInfoDTO loginInfo, AcceptData acceptData) {
        try {
            UserInfo userInfo = userAccountService.login(loginInfo);
            ThreadUtil.run(new Runnable() {
@@ -120,7 +140,6 @@
        } catch (LoginException e) {
            return JsonUtil.loadFalseResult(e.getMessage());
        }
    }
    private String outUserInfoForLogin(UserInfo userInfo) {
@@ -134,6 +153,38 @@
        }
        return JsonUtil.loadTrueResult(JsonUtil.getSimpleGson().toJson(vo));
    }
    @UserLogin(uid = "#uid")
    @ResponseBody
    @RequestMapping("bindWX")
    public String bindWX(AcceptData acceptData, Long uid, String code) {
        try {
            userAccountService.bindWX(uid, code);
        } catch (UserAccountException e) {
            e.printStackTrace();
            return JsonUtil.loadFalseResult(e.getMsg());
        }
        return JsonUtil.loadTrueResult("");
    }
    @UserLogin(uid = "#uid")
    @ResponseBody
    @RequestMapping("bindPhone")
    public String bindPhone(AcceptData acceptData, Long uid, String phone, String vcode, String token) {
        try {
            userAccountService.bindPhone(uid, phone, vcode, token);
        } catch (UserAccountException e) {
            e.printStackTrace();
            return JsonUtil.loadFalseResult(e.getMsg());
        }
        return JsonUtil.loadTrueResult("");
    }
    @UserLogin(uid = "#uid")
    @ResponseBody
@@ -195,7 +246,8 @@
            return JsonUtil.loadFalseResult(ApiCodeConstant.CODE_FAIL_USER_DELETE, "用户已被删除");
        }
        UserInfoVO vo = UserInfoVO.create(user, userExtraInfoService.get(uid), wxUserInfoService.selectByUid(uid));
        UserInfoVO vo = UserInfoVO.create(user, userExtraInfoService.get(uid), user.getWxUser() == null ? null : wxUserInfoService.get(user.getWxUser().getId()));
        return JsonUtil.loadTrueResult(vo);
    }
app/src/main/java/com/yeshi/makemoney/app/dao/msg/AppPageNotifyMsgDao.java
@@ -1,5 +1,6 @@
package com.yeshi.makemoney.app.dao.msg;
import com.yeshi.makemoney.app.entity.SystemEnum;
import com.yeshi.makemoney.app.entity.msg.AppPageNotifyMsg;
import org.springframework.data.domain.Sort;
import org.springframework.data.mongodb.core.query.Criteria;
@@ -14,88 +15,98 @@
@Repository
public class AppPageNotifyMsgDao extends MongodbBaseDao<AppPageNotifyMsg>{
public class AppPageNotifyMsgDao extends MongodbBaseDao<AppPageNotifyMsg> {
  public void updateSelective(AppPageNotifyMsg bean) {
    public void updateSelective(AppPageNotifyMsg bean) {
        Query query = new Query();
        Update update=new Update();
        Update update = new Update();
        query.addCriteria(Criteria.where("id").is(bean.getId()));
        if(bean.getSystem() != null) {
        if (bean.getSystem() != null) {
            update.set("system", bean.getSystem());
        }
        if(bean.getType() != null) {
        if (bean.getType() != null) {
            update.set("type", bean.getType());
        }
        if(bean.getShow() != null) {
        if (bean.getShow() != null) {
            update.set("show", bean.getShow());
        }
        if(bean.getCanClose() != null) {
        if (bean.getCanClose() != null) {
            update.set("canClose", bean.getCanClose());
        }
        if(bean.getContent() != null) {
        if (bean.getContent() != null) {
            update.set("content", bean.getContent());
        }
        if(bean.getContentUrl() != null) {
        if (bean.getContentUrl() != null) {
            update.set("contentUrl", bean.getContentUrl());
        }
        if(bean.getMd5() != null) {
        if (bean.getMd5() != null) {
            update.set("md5", bean.getMd5());
        }
        if(bean.getStartTime() != null) {
        if (bean.getStartTime() != null) {
            update.set("startTime", bean.getStartTime());
        }
        if(bean.getEndTime() != null) {
        if (bean.getEndTime() != null) {
            update.set("endTime", bean.getEndTime());
        }
        if(bean.getCreateTime() != null) {
        if (bean.getCreateTime() != null) {
            update.set("createTime", bean.getCreateTime());
        }
        update.set("updateTime", new Date());
        update(query, update);
  }
    }
  public List<AppPageNotifyMsg> list(DaoQuery daoQuery){
    public List<AppPageNotifyMsg> list(DaoQuery daoQuery) {
        Query query = getQuery(daoQuery);
        if (daoQuery.sortList!=null && daoQuery.sortList.size()>0){
        if (daoQuery.sortList != null && daoQuery.sortList.size() > 0) {
            query.with(Sort.by(daoQuery.sortList));
        }
        query.skip(daoQuery.start);
        query.limit(daoQuery.count);
        return findList(query);
  }
    }
  public long count(DaoQuery daoQuery){
        Query query=getQuery(daoQuery);
    public long count(DaoQuery daoQuery) {
        Query query = getQuery(daoQuery);
        return count(query);
  }
    }
  private Query getQuery(DaoQuery daoQuery){
        List<Criteria> andList=new ArrayList<>();
        if(daoQuery.type!=null){
    private Query getQuery(DaoQuery daoQuery) {
        List<Criteria> andList = new ArrayList<>();
        if (daoQuery.type != null) {
            andList.add(Criteria.where("type").is(daoQuery.type));
        }
        if(daoQuery.show!=null){
        if (daoQuery.show != null) {
            andList.add(Criteria.where("show").is(daoQuery.show));
        }
        if(daoQuery.content!=null){
        if (daoQuery.system != null) {
            andList.add(Criteria.where("system").is(daoQuery.system));
        }
        if (daoQuery.date != null) {
            andList.add(Criteria.where("startTime").lte(daoQuery.date).and("endTime").gt(daoQuery.date));
        }
        if (daoQuery.content != null) {
            andList.add(Criteria.where("content").regex(daoQuery.content));
        }
        Query query=new Query();
        Criteria[]  ands=new Criteria[andList.size()];
        Query query = new Query();
        Criteria[] ands = new Criteria[andList.size()];
        andList.toArray(ands);
        if(ands.length>0){
        if (ands.length > 0) {
            query.addCriteria(new Criteria().andOperator(ands));
        }
        return query;
  }
    }
  public static class DaoQuery{
    public static class DaoQuery {
        public AppPageNotifyMsg.AppPageNotifyMsgType type;
        public Boolean show;
        public SystemEnum system;
        public Date date;
        public String content;
        public int start;
        public int count;
        public List<Sort.Order> sortList;
  }
    }
}
app/src/main/java/com/yeshi/makemoney/app/dao/user/UserExtraInfoDao.java
@@ -26,6 +26,11 @@
        if (bean.getUnReadMsgCount() != null) {
            update.set("unReadMsgCount", bean.getUnReadMsgCount());
        }
        if (bean.getSignInNotify() != null) {
            update.set("signInNotify", bean.getSignInNotify());
        }
        if (bean.getCreateTime() != null) {
            update.set("createTime", bean.getCreateTime());
        }
app/src/main/java/com/yeshi/makemoney/app/dao/user/WXUserInfoMapper.java
@@ -23,7 +23,6 @@
    public static class DaoQuery {
        public SystemEnum system;
        public String unionId;
        public Long uid;
        public long start;
        public int count;
        public List<String> sortList;
app/src/main/java/com/yeshi/makemoney/app/entity/goldcorn/GoldCornGetType.java
@@ -7,7 +7,7 @@
 * @date 2022/3/31 18:29
 */
public enum GoldCornGetType {
    signIn("签到"), watchVideo("观看视频"), readNovel("读小说");
    signIn("签到"), watchVideo("观看视频"), readNovel("读小说"), scanNews("浏览资讯");
    private String name;
    private GoldCornGetType(String name) {
app/src/main/java/com/yeshi/makemoney/app/entity/msg/AppPageNotifyMsg.java
@@ -18,7 +18,7 @@
public class AppPageNotifyMsg {
    public enum AppPageNotifyMsgType {
        mine("我的");
        team("团队"),task("任务");
        private String name;
app/src/main/java/com/yeshi/makemoney/app/entity/msg/UserMsgType.java
@@ -8,15 +8,21 @@
 */
public enum UserMsgType {
    goldcornexchange("金币折算"), extract("余额提现"), system("系统消息");
    goldcornexchange("金币折算",""), extract("余额提现",""), system("系统消息","");
    private String name;
    private String icon;
    private UserMsgType(String name) {
    private UserMsgType(String name, String icon) {
        this.name = name;
        this.icon = icon;
    }
    public String getName() {
        return name;
    }
    public String getIcon() {
        return icon;
    }
}
app/src/main/java/com/yeshi/makemoney/app/exception/user/UserAccountException.java
New file
@@ -0,0 +1,31 @@
package com.yeshi.makemoney.app.exception.user;
import com.ks.lib.common.exception.BaseException;
/**
 * @author hxh
 * @title: LoginException
 * @description: 账户异常
 * @date 2021/11/16 18:23
 */
public class UserAccountException extends BaseException {
    //已经绑定
    public final static int CODE_ALREAD_BIND = 201;
    //微信信息出错
    public final static int CODE_ERROR_WX_INFO = 102;
    //电话号码出错
    public final static int CODE_ERROR_PHONE = 103;
    //用户错误
    public final static int CODE_USER_ERROR = 101;
    public UserAccountException(int code, String msg) {
        super(code, msg);
    }
}
app/src/main/java/com/yeshi/makemoney/app/service/impl/goldcorn/GoldCornGetPriceServiceImpl.java
@@ -8,7 +8,10 @@
import com.yeshi.makemoney.app.entity.SystemEnum;
import com.yeshi.makemoney.app.entity.config.SystemConfigKey;
import com.yeshi.makemoney.app.entity.goldcorn.GoldCornGetType;
import com.yeshi.makemoney.app.entity.user.UserInfo;
import com.yeshi.makemoney.app.exception.goldcorn.GoldCornGetPriceException;
import com.yeshi.makemoney.app.service.inter.config.SystemConfigService;
import com.yeshi.makemoney.app.service.inter.team.TeamInviteRelationService;
import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Service;
@@ -40,6 +43,9 @@
    @Resource
    private SystemConfigService systemConfigService;
    @Resource
    private TeamInviteRelationService teamInviteRelationService;
    @Override
    public List<GoldCornGetPrice> list(GoldCornGetPriceQuery goldCornGetPriceQuery, int page, int pageSize) {
@@ -160,5 +166,61 @@
        return new Gson().fromJson(value, type);
    }
    @Override
    public Integer getWatchVideoPrice(UserInfo user, Date date, int timeSeconds) throws GoldCornGetPriceException {
        //获取价格
        GoldCornGetPrice getPrice = getPrice(user.getSystem(), GoldCornGetType.watchVideo, date);
        if (getPrice == null) {
            throw new GoldCornGetPriceException(GoldCornGetPriceException.CODE_NOT_EXIST, "价格信息缺失");
        }
        int goldCorn = (int) (timeSeconds * getPrice.getCornNum() / 60.0f);
        //加上团队增益比例
        if (teamInviteRelationService.getBossUid(user.getId()) != null) {
            goldCorn = new BigDecimal(goldCorn).multiply(new BigDecimal(1).add(getPrice.getTeamGainRate())).intValue();
        }
        return goldCorn;
    }
    @Override
    public Integer getReadNovelPrice(UserInfo user, Date date, int timeSeconds) throws GoldCornGetPriceException {
        //获取价格
        GoldCornGetPrice getPrice = getPrice(user.getSystem(), GoldCornGetType.readNovel, date);
        if (getPrice == null) {
            throw new GoldCornGetPriceException(GoldCornGetPriceException.CODE_NOT_EXIST, "价格信息缺失");
        }
        int goldCorn = (int) (timeSeconds * getPrice.getCornNum() / 60.0f);
        //加上团队增益比例
        if (teamInviteRelationService.getBossUid(user.getId()) != null) {
            goldCorn = new BigDecimal(goldCorn).multiply(new BigDecimal(1).add(getPrice.getTeamGainRate())).intValue();
        }
        return goldCorn;
    }
    @Override
    public Integer getScanNewsPrice(UserInfo user, Date date, int num) throws GoldCornGetPriceException {
        //获取价格
        GoldCornGetPrice getPrice = getPrice(user.getSystem(), GoldCornGetType.scanNews, date);
        if (getPrice == null) {
            throw new GoldCornGetPriceException(GoldCornGetPriceException.CODE_NOT_EXIST, "价格信息缺失");
        }
        int goldCorn = num * getPrice.getCornNum();
        //加上团队增益比例
        if (teamInviteRelationService.getBossUid(user.getId()) != null) {
            goldCorn = new BigDecimal(goldCorn).multiply(new BigDecimal(1).add(getPrice.getTeamGainRate())).intValue();
        }
        return goldCorn;
    }
}
app/src/main/java/com/yeshi/makemoney/app/service/impl/goldcorn/GoldCornMakeServiceImpl.java
@@ -24,6 +24,7 @@
import com.yeshi.makemoney.app.utils.goldcorn.GoldCornUtil;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.yeshi.utils.TimeUtil;
import org.yeshi.utils.annotation.RequestSerializableByKey;
@@ -32,6 +33,7 @@
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.concurrent.TimeUnit;
/**
 * @author hxh
@@ -49,7 +51,7 @@
    private GoldCornGetRecordService goldCornGetRecordService;
    @Resource
    private RedisTemplate<String, String> redisTemplate;
    private RedisTemplate<String, Object> redisTemplate;
    @Resource
    private GoldCornGetPriceService goldCornGetPriceService;
@@ -121,7 +123,7 @@
    @RequestSerializableByKey(key = "'addgoldcorn-'+#uid+'-'+#type")
    @Override
    public GoldCornGetRecord addGoldCorn(Long uid, GoldCornGetType type, boolean isDouble, Date currentTime, Integer price) throws UserInfoException, GoldCornGetPriceException, GoldCornGetFrequencyConfigException, GoldCornMakeException {
    public GoldCornGetRecord addGoldCorn(Long uid, GoldCornGetType type, boolean isDouble, Date currentTime, Integer price) throws UserInfoException, GoldCornGetFrequencyConfigException, GoldCornMakeException {
        if (uid == null || type == null || currentTime == null) {
            throw new GoldCornMakeException(GoldCornMakeException.CODE_PARAMS_NOT_ENOUGH, "参数不完整");
        }
@@ -131,20 +133,11 @@
        }
        //判断是否超出了次数限制
        frequencyVerify(user, type, currentTime);
        //获取价格
        GoldCornGetPrice getPrice = goldCornGetPriceService.getPrice(user.getSystem(), type, currentTime);
        if (price == null) {
            throw new GoldCornGetPriceException(GoldCornGetPriceException.CODE_NOT_EXIST, "价格信息缺失");
        }
        GoldCornGetPrice getPrice = goldCornGetPriceService.getPrice(user.getSystem(), GoldCornGetType.watchVideo, currentTime);
        //基础价格,外部传入的价格优先
        int baseCornNum = (price != null ? price : getPrice.getCornNum());
        //是否加入团队
        Long bossUid = teamInviteRelationService.getBossUid(uid);
        if (bossUid != null) {
            baseCornNum = new BigDecimal(baseCornNum).multiply(new BigDecimal(1).add(getPrice.getTeamGainRate())).intValue();
        }
        //单价由外面传入
        int baseCornNum = price;
        GoldCornGetRecord record = new GoldCornGetRecord();
        record.setCornNum(baseCornNum);
@@ -174,6 +167,7 @@
            }
            //是否有上级
            if (getPrice.getTeamDivide() != null && getPrice.getTeamDivide()) {
                Long bossUid = teamInviteRelationService.getBossUid(user.getId());
                if (bossUid != null) {
                    BigDecimal rate = new BigDecimal(systemConfigService.getValueCache(user.getSystem(), SystemConfigKey.teamFirstDivideRate));
                    GoldCornGetRecord cRecord = new GoldCornGetRecord();
@@ -189,22 +183,22 @@
                        goldCornGetRecordService.add(cRecord);
                    }
                    //是否有上上级
                    bossUid = teamInviteRelationService.getBossUid(bossUid);
                    if (bossUid != null) {
                        rate = new BigDecimal(systemConfigService.getValueCache(user.getSystem(), SystemConfigKey.teamSecondDivideRate));
                        GoldCornGetRecord ccRecord = new GoldCornGetRecord();
                        ccRecord.setDay(record.getDay());
                        ccRecord.setType(type);
                        ccRecord.setUid(bossUid);
                        ccRecord.setFromId(record.getId());
                        ccRecord.setFromUid(record.getUid());
                        ccRecord.setCornNum(new BigDecimal(baseCornNum).multiply(rate).intValue());
                        ccRecord.setLevel(GoldCornGetRecord.LEVEL_SECOND);
                        ccRecord.setCreateTime(currentTime);
                        if (ccRecord.getCornNum() > 0) {
                            goldCornGetRecordService.add(ccRecord);
                        }
                    }
//                    bossUid = teamInviteRelationService.getBossUid(bossUid);
//                    if (bossUid != null) {
//                        rate = new BigDecimal(systemConfigService.getValueCache(user.getSystem(), SystemConfigKey.teamSecondDivideRate));
//                        GoldCornGetRecord ccRecord = new GoldCornGetRecord();
//                        ccRecord.setDay(record.getDay());
//                        ccRecord.setType(type);
//                        ccRecord.setUid(bossUid);
//                        ccRecord.setFromId(record.getId());
//                        ccRecord.setFromUid(record.getUid());
//                        ccRecord.setCornNum(new BigDecimal(baseCornNum).multiply(rate).intValue());
//                        ccRecord.setLevel(GoldCornGetRecord.LEVEL_SECOND);
//                        ccRecord.setCreateTime(currentTime);
//                        if (ccRecord.getCornNum() > 0) {
//                            goldCornGetRecordService.add(ccRecord);
//                        }
//                    }
                }
            }
        } catch (GoldCornGetRecordException e) {
@@ -256,8 +250,13 @@
        Date now = new Date();
        //查询今日是否已经签到
        boolean isSignIn = isSignIn(uid, now);
        Date deadDate = now;
        if (!isSignIn) {
            deadDate = new Date(TimeUtil.convertToTimeTemp(TimeUtil.getGernalTime(now.getTime(), "yyyyMMdd"), "yyyyMMdd"));
        }
        //今日未签到的,查询连续签到次数应该从前一天开始计算
        int continueDay = goldCornGetRecordService.getContinueDay(uid, GoldCornGetType.signIn, !isSignIn ? new Date(now.getTime() - 1000 * 60 * 60 * 24L) : now);
        int continueDay = goldCornGetRecordService.getContinueDay(uid, GoldCornGetType.signIn, deadDate);
        return continueDay;
    }
@@ -282,5 +281,73 @@
        return addGoldCorn(uid, GoldCornGetType.signIn, false, new Date(), price);
    }
    @Transactional(rollbackFor = Exception.class)
    @Override
    public Integer watchVideo(Long uid, boolean isDouble, Date time, int timeSeconds) throws GoldCornGetPriceException, UserInfoException, GoldCornMakeException, GoldCornGetFrequencyConfigException {
        UserInfo user = userInfoService.get(uid);
        if (user == null) {
            throw new UserInfoException(UserInfoException.CODE_NOT_EXIST, "用户不存在");
        }
        Integer price = goldCornGetPriceService.getWatchVideoPrice(user, time, timeSeconds);
        //价格为0时不加入记录
        if (price == 0) {
            return 0;
        }
        GoldCornGetRecord record = addGoldCorn(uid, GoldCornGetType.watchVideo, isDouble, time, price);
        return record.getCornNum() * (isDouble ? 2 : 1);
    }
    @Transactional(rollbackFor = Exception.class)
    @Override
    public Integer readNovel(Long uid, boolean isDouble, Date time, int timeSeconds) throws GoldCornGetPriceException, UserInfoException, GoldCornMakeException, GoldCornGetFrequencyConfigException {
        String readNovelCacheKey = "task-n-" + uid + "-" + TimeUtil.getGernalTime(System.currentTimeMillis(), "yyyyMMdd");
        Integer readNovelNowSeconds = timeSeconds;
        Integer start = (Integer) redisTemplate.opsForValue().get(readNovelCacheKey);
        if (start == null) {
            start = 0;
        }
        timeSeconds = timeSeconds - start;
        UserInfo user = userInfoService.get(uid);
        if (user == null) {
            throw new UserInfoException(UserInfoException.CODE_NOT_EXIST, "用户不存在");
        }
        Integer price = goldCornGetPriceService.getReadNovelPrice(user, time, timeSeconds);
        //价格为0时不加入记录
        if (price == 0) {
            return 0;
        }
        GoldCornGetRecord record = addGoldCorn(uid, GoldCornGetType.readNovel, isDouble, time, price);
        //记录当天的实时阅读分钟数
        redisTemplate.opsForValue().set(readNovelCacheKey, readNovelNowSeconds, 60 * 60 * 24, TimeUnit.SECONDS);
        return record.getCornNum() * (isDouble ? 2 : 1);
    }
    @Transactional(rollbackFor = Exception.class)
    @Override
    public Integer scanNews(Long uid, boolean isDouble, Date time, int num) throws GoldCornGetPriceException, UserInfoException, GoldCornMakeException, GoldCornGetFrequencyConfigException {
        UserInfo user = userInfoService.get(uid);
        if (user == null) {
            throw new UserInfoException(UserInfoException.CODE_NOT_EXIST, "用户不存在");
        }
        Integer price = goldCornGetPriceService.getScanNewsPrice(user, time, num);
        //价格为0时不加入记录
        if (price == 0) {
            return 0;
        }
        GoldCornGetRecord record = addGoldCorn(uid, GoldCornGetType.scanNews, isDouble, time, price);
        return record.getCornNum() * (isDouble ? 2 : 1);
    }
}
app/src/main/java/com/yeshi/makemoney/app/service/impl/goldcorn/GoldCornSettleServiceImpl.java
@@ -15,9 +15,11 @@
import com.yeshi.makemoney.app.service.inter.goldcorn.GoldCornMoneyExchangeRateRecordService;
import com.yeshi.makemoney.app.service.inter.goldcorn.GoldCornSettleService;
import com.yeshi.makemoney.app.service.inter.money.UserMoneyService;
import com.yeshi.makemoney.app.service.inter.msg.UserMsgNotifyService;
import com.yeshi.makemoney.app.service.inter.user.UserInfoService;
import com.yeshi.makemoney.app.utils.factory.UserMoneyRecordFactory;
import com.yeshi.makemoney.app.utils.factory.goldcorn.GoldCornConsumeRecordFactory;
import com.yeshi.makemoney.app.utils.factory.msg.UserMsgFactory;
import com.yeshi.makemoney.app.utils.goldcorn.GoldCornUtil;
import com.yeshi.makemoney.app.utils.mq.CMQManager;
import org.springframework.stereotype.Service;
@@ -53,9 +55,12 @@
    @Resource
    private UserMoneyService userMoneyService;
    @Resource
    private UserMsgNotifyService userMsgNotifyService;
    @Override
    public void startSettle(Date date) {
        String day= GoldCornUtil.getFormatDay(date);
        String day = GoldCornUtil.getFormatDay(date);
        long count = goldCornGetRecordService.countUidsByDay(day);
        int pageSize = 1000;
        int page = (int) (count % pageSize == 0 ? count / pageSize : count / pageSize + 1);
@@ -70,10 +75,10 @@
    @Transactional(rollbackFor = Exception.class)
    @Override
    public void settle(Long uid, Date day, BigDecimal rate) throws GoldCornConsumeRecordException, UserMoneyRecordException {
        long cornNum = goldCornGetRecordService.getGoldCornByDay(uid, day);
    public void settle(Long uid, String day, BigDecimal rate) throws GoldCornConsumeRecordException, UserMoneyRecordException {
        long cornNum = goldCornGetRecordService.getGoldCornByDay(uid, GoldCornUtil.convertFormatDay(day));
        //金币数量
        GoldCornConsumeRecord record = GoldCornConsumeRecordFactory.createExchange(uid,GoldCornUtil.getFormatDay(day),(int) cornNum,rate);
        GoldCornConsumeRecord record = GoldCornConsumeRecordFactory.createExchange(uid, day, (int) cornNum, rate);
        try {
            UserMoneyRecord moneyRecord = UserMoneyRecordFactory.createGoldCornExchange(record);
            userMoneyService.addUserMoney(moneyRecord);
@@ -81,10 +86,16 @@
            throw new UserMoneyRecordException(e.getCode(), e.getMsg());
        }
        goldCornConsumeRecordService.add(record);
        //添加消息通知
        try {
            userMsgNotifyService.notify(UserMsgFactory.createGoldCornExchange(record, userMoneyService.getBalance(uid)));
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    @Override
    public void settle(Long uid, Date day) throws UserInfoException, GoldCornMoneyExchangeRateRecordException, UserMoneyRecordException, GoldCornConsumeRecordException {
    public void settle(Long uid, String day) throws UserInfoException, GoldCornMoneyExchangeRateRecordException, UserMoneyRecordException, GoldCornConsumeRecordException {
        UserInfo user = userInfoService.get(uid);
        if (user == null) {
            throw new UserInfoException(UserInfoException.CODE_NOT_EXIST, "用户不存在");
@@ -92,7 +103,7 @@
        BigDecimal rate = null;
        try {
            rate = goldCornMoneyExchangeRateRecordService.getRate(GoldCornUtil.getFormatDay(day), user.getSystem(), new Date());
            rate = goldCornMoneyExchangeRateRecordService.getRate(day, user.getSystem(), new Date());
        } catch (ParamsException e) {
            throw new GoldCornMoneyExchangeRateRecordException(GoldCornMoneyExchangeRateRecordException.CODE_PARAMS_NOT_ENOUGH, e.getMsg());
        }
app/src/main/java/com/yeshi/makemoney/app/service/impl/money/ExtractServiceImpl.java
@@ -21,10 +21,12 @@
import com.yeshi.makemoney.app.service.inter.money.UserExtractMoneyLimitService;
import com.yeshi.makemoney.app.service.inter.money.UserMoneyRecordService;
import com.yeshi.makemoney.app.service.inter.money.UserMoneyService;
import com.yeshi.makemoney.app.service.inter.msg.UserMsgNotifyService;
import com.yeshi.makemoney.app.service.inter.user.UserInfoService;
import com.yeshi.makemoney.app.service.query.money.ExtractQuery;
import com.yeshi.makemoney.app.utils.Constant;
import com.yeshi.makemoney.app.utils.factory.UserMoneyRecordFactory;
import com.yeshi.makemoney.app.utils.factory.msg.UserMsgFactory;
import com.yeshi.makemoney.app.utils.mq.CMQManager;
import com.yeshi.makemoney.app.utils.pay.AlipayUtil;
import org.slf4j.Logger;
@@ -67,6 +69,9 @@
    @Resource
    private UserExtractMoneyLimitService userExtractMoneyLimitService;
    @Resource
    private UserMsgNotifyService userMsgNotifyService;
    @Override
    public List<Extract> list(ExtractQuery extractQuery, int page, int pageSize) {
@@ -159,7 +164,7 @@
    @Override
    public boolean canExtractLittleMoney(Long uid, int maxNewerCount, Date date) {
        //判断新人
        long count = countByMaxMoney(uid,Constant.EXTRACT_LITTLE_MONEY_LIMIT, Arrays.asList(new Integer[]{Extract.STATE_NOT_PROCESS, Extract.STATE_PROCESSING, Extract.STATE_PASS}), null);
        long count = countByMaxMoney(uid, Constant.EXTRACT_LITTLE_MONEY_LIMIT, Arrays.asList(new Integer[]{Extract.STATE_NOT_PROCESS, Extract.STATE_PROCESSING, Extract.STATE_PASS}), null);
        if (maxNewerCount > count) {
            return true;
        }
@@ -281,7 +286,12 @@
        updateExtract.setState(Extract.STATE_REJECT);
        updateExtract.setReason(reason);
        extractMapper.updateByPrimaryKeySelective(updateExtract);
        //TODO 消息
        //添加消息通知
        try {
            userMsgNotifyService.notify(UserMsgFactory.createExtractFail(extract.getUser().getId(), extract.getMoney(), reason));
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    @Override
@@ -407,7 +417,12 @@
                userMoneyRecordService.update(update);
            }
        }
        // TODO 通知转账成功
        //添加消息通知
        try {
            userMsgNotifyService.notify(UserMsgFactory.createExtractSuccess(extract.getUser().getId(), extract.getMoney()));
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
@@ -435,8 +450,12 @@
            } catch (Exception e) {
                e.printStackTrace();
            }
            // 新版提现
            //TODO 通知转账被拒绝
            //添加消息通知
            try {
                userMsgNotifyService.notify(UserMsgFactory.createExtractFail(extract.getUser().getId(), extract.getMoney(), null));
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }
app/src/main/java/com/yeshi/makemoney/app/service/impl/msg/AppPageNotifyMsgServiceImpl.java
@@ -3,6 +3,7 @@
import java.lang.Exception;
import javax.annotation.Resource;
import com.yeshi.makemoney.app.entity.SystemEnum;
import org.springframework.stereotype.Service;
import java.util.Date;
@@ -91,5 +92,20 @@
        }
    }
    @Override
    public AppPageNotifyMsg selectByType(SystemEnum system, AppPageNotifyMsg.AppPageNotifyMsgType type, Date date) {
        DaoQuery daoQuery = new DaoQuery();
        daoQuery.type = type;
        daoQuery.date = date;
        daoQuery.show = true;
        daoQuery.system = system;
        daoQuery.count = 1;
        List<AppPageNotifyMsg> list = appPageNotifyMsgDao.list(daoQuery);
        if (list == null || list.size() == 0) {
            return null;
        }
        return list.get(0);
    }
}
app/src/main/java/com/yeshi/makemoney/app/service/impl/msg/UserMsgNotifyServiceImpl.java
New file
@@ -0,0 +1,30 @@
package com.yeshi.makemoney.app.service.impl.msg;
import com.yeshi.makemoney.app.entity.msg.UserMsg;
import com.yeshi.makemoney.app.service.inter.msg.UserMsgNotifyService;
import com.yeshi.makemoney.app.service.inter.msg.UserMsgService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
/**
 * @author hxh
 * @title: UserMsgNotifyServiceImpl
 * @description: 用户消息通知
 * @date 2022/4/24 12:00
 */
@Service
public class UserMsgNotifyServiceImpl implements UserMsgNotifyService {
    @Resource
    private UserMsgService userMsgService;
    @Override
    public void notify(UserMsg userMsg) {
        try {
            userMsgService.add(userMsg);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
app/src/main/java/com/yeshi/makemoney/app/service/impl/msg/UserMsgServiceImpl.java
@@ -3,6 +3,8 @@
import java.lang.Exception;
import javax.annotation.Resource;
import com.yeshi.makemoney.app.entity.user.UserExtraInfo;
import com.yeshi.makemoney.app.service.inter.user.UserExtraInfoService;
import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Service;
@@ -27,6 +29,9 @@
    @Resource
    private UserMsgDao userMsgDao;
    @Resource
    private UserExtraInfoService userExtraInfoService;
    @Override
    public List<UserMsg> list(UserMsgQuery userMsgQuery, int page, int pageSize) {
@@ -60,14 +65,20 @@
    @Override
    public void add(UserMsg userMsg) throws Exception {
        if (userMsg.getCreateTime() == null) {
            userMsg.setCreateTime(new Date());
        }
        if (userMsg.getId() == null) {
            userMsg.setId(userMsg.toId());
        }
        //查询主键ID是否存在
        if (userMsgDao.get(userMsg.getId()) != null) {
            throw new Exception("已存在");
        }
        if (userMsg.getCreateTime() == null) {
            userMsg.setCreateTime(new Date());
        }
        //保存
        userMsgDao.save(userMsg);
    }
@@ -88,5 +99,10 @@
        }
    }
    @Override
    public void readAllMsg(Long uid) {
        userExtraInfoService.setMsgRead(uid);
    }
}
app/src/main/java/com/yeshi/makemoney/app/service/impl/user/UserAccountServiceImpl.java
@@ -1,11 +1,13 @@
package com.yeshi.makemoney.app.service.impl.user;
import com.yeshi.makemoney.app.dto.user.LoginInfoDTO;
import com.yeshi.makemoney.app.entity.SystemEnum;
import com.yeshi.makemoney.app.entity.config.SystemConfigKey;
import com.yeshi.makemoney.app.entity.user.UserInfo;
import com.yeshi.makemoney.app.entity.user.UserLoginRecord;
import com.yeshi.makemoney.app.entity.user.WXUserInfo;
import com.yeshi.makemoney.app.exception.user.LoginException;
import com.yeshi.makemoney.app.exception.user.UserAccountException;
import com.yeshi.makemoney.app.service.inter.config.SystemConfigService;
import com.yeshi.makemoney.app.service.inter.user.*;
import com.yeshi.makemoney.app.service.manager.VerifyCodeManager;
@@ -61,9 +63,9 @@
                    loginInfo.setPhone(mobile);
                } else {
                    //验证码登录
//                    if (!verifyCodeManager.isPhoneCodeRight(loginInfo.getSystem(), loginInfo.getPhone(), loginInfo.getVcode())) {
//                        throw new LoginException("验证码错误");
//                    }
                    if (!verifyCodeManager.isPhoneCodeRight(loginInfo.getSystem(), loginInfo.getPhone(), loginInfo.getVcode())) {
                        throw new LoginException("验证码错误");
                    }
                }
                //执行登录操作
                user = userInfoService.selectByPhoneAndSystemAndStatus(loginInfo.getPhone(), loginInfo.getSystem(), UserInfo.STATUS_NORMAL);
@@ -99,8 +101,11 @@
                //保存微信用户信息
                WXUserInfo wxUserInfo = null;
                try {
                    wxUserInfo = wxUserInfoService.save(WXUserInfo.create(weiXinUser));
                    WXUserInfo temp = WXUserInfo.create(weiXinUser);
                    temp.setSystem(loginInfo.getSystem());
                    wxUserInfo = wxUserInfoService.save(temp);
                } catch (Exception e) {
                    e.printStackTrace();
                    throw new LoginException("保存微信授权信息失败");
                }
                wxUserInfo.setSystem(loginInfo.getSystem());
@@ -111,7 +116,11 @@
                    newUser.setWxUser(wxUserInfo);
                    newUser.setSystem(loginInfo.getSystem());
                    newUser.setNickName(wxUserInfo.getNickName());
                    newUser.setPortrait(wxUserInfo.getHeadImgUrl());
                    if (StringUtil.isNullOrEmpty(wxUserInfo.getHeadImgUrl())) {
                        newUser.setPortrait(systemConfigService.getValueCache(loginInfo.getSystem(), SystemConfigKey.defaultPortrait));
                    } else {
                        newUser.setPortrait(wxUserInfo.getHeadImgUrl());
                    }
                    try {
                        userInfoService.add(newUser);
                    } catch (Exception e) {
@@ -157,6 +166,77 @@
        userInfoService.update(update);
    }
    @Transactional(rollbackFor = Exception.class)
    @Override
    public void bindWX(Long uid, String code) throws UserAccountException {
        UserInfo user = userInfoService.get(uid);
        if (user == null) {
            throw new UserAccountException(UserAccountException.CODE_USER_ERROR, "用户不存在");
        }
        SystemEnum system = user.getSystem();
        String appId = systemConfigService.getValueCache(system, SystemConfigKey.wxAppId);
        String appSecret = systemConfigService.getValueCache(system, SystemConfigKey.wxAppSecret);
        WeiXinUser weiXinUser = WXAppLoginUtil.getWeiXinUser(code, appId, appSecret);
        if (weiXinUser == null) {
            throw new UserAccountException(UserAccountException.CODE_ERROR_WX_INFO, "微信授权信息获取失败");
        }
        //保存微信用户信息
        WXUserInfo wxUserInfo = null;
        try {
            WXUserInfo temp = WXUserInfo.create(weiXinUser);
            temp.setSystem(system);
            wxUserInfo = wxUserInfoService.save(temp);
        } catch (Exception e) {
            throw new UserAccountException(UserAccountException.CODE_ERROR_WX_INFO, "保存微信授权信息失败");
        }
        UserInfo u = userInfoService.selectByWXIdAndSystemAndStatus(wxUserInfo.getId(), system, UserInfo.STATUS_NORMAL);
        if (u != null) {
            throw new UserAccountException(UserAccountException.CODE_ALREAD_BIND, "微信已绑定其他账号");
        }
        //绑定到用户
        UserInfo update = new UserInfo();
        update.setId(uid);
        update.setWxUser(wxUserInfo);
        userInfoService.update(update);
    }
    @Override
    public void bindPhone(Long uid, String phone, String vcode, String token) throws UserAccountException {
        UserInfo user = userInfoService.get(uid);
        if (user == null) {
            throw new UserAccountException(UserAccountException.CODE_USER_ERROR, "用户不存在");
        }
        SystemEnum system = user.getSystem();
        if (!StringUtil.isNullOrEmpty(token)) {
            //一键登录
            //获取电话号码
            String mobile = AliyunOneKeyLoginUtil.getMobile(token, UUID.randomUUID().toString(), systemConfigService.getValueCache(system, SystemConfigKey.aliyunOneKeyAuthAcessKey), systemConfigService.getValueCache(system, SystemConfigKey.aliyunOneKeyAuthAcessSecret));
            if (StringUtil.isNullOrEmpty(mobile)) {
                throw new UserAccountException(UserAccountException.CODE_ERROR_PHONE, "电话号码获取失败");
            }
            phone = mobile;
        } else {
            //验证码登录
            if (!verifyCodeManager.isPhoneCodeRight(system, phone, vcode)) {
                throw new UserAccountException(UserAccountException.CODE_ERROR_PHONE, "验证码错误");
            }
        }
        UserInfo u = userInfoService.selectByPhoneAndSystemAndStatus(phone, system, UserInfo.STATUS_NORMAL);
        if (u != null) {
            throw new UserAccountException(UserAccountException.CODE_ALREAD_BIND, "手机号已绑定其他账号");
        }
        //绑定到用户
        UserInfo update = new UserInfo();
        update.setId(uid);
        update.setPhone(phone);
        userInfoService.update(update);
    }
    /**
     * @return void
app/src/main/java/com/yeshi/makemoney/app/service/impl/user/WXUserInfoServiceImpl.java
@@ -117,17 +117,5 @@
        return list.get(0);
    }
    @Override
    public WXUserInfo selectByUid(Long uid) {
        DaoQuery daoQuery = new DaoQuery();
        daoQuery.uid = uid;
        daoQuery.count = 1;
        List<WXUserInfo> list = wXUserInfoMapper.list(daoQuery);
        if (list == null || list.size() == 0) {
            return null;
        }
        return list.get(0);
    }
}
app/src/main/java/com/yeshi/makemoney/app/service/inter/goldcorn/GoldCornGetPriceService.java
@@ -6,6 +6,8 @@
import com.yeshi.makemoney.app.entity.SystemEnum;
import com.yeshi.makemoney.app.entity.goldcorn.GoldCornGetType;
import com.yeshi.makemoney.app.entity.user.UserInfo;
import com.yeshi.makemoney.app.exception.goldcorn.GoldCornGetPriceException;
import org.yeshi.utils.bean.BeanUtil;
import java.util.List;
@@ -88,13 +90,57 @@
    /**
     * @author hxh
     * @return java.util.List<java.lang.Integer>
     * @author hxh
     * @description 获取连续签到的价格列表
     * @date 16:26 2022/4/21
     * @param: system
     * @return java.util.List<java.lang.Integer>
     **/
    public List<Integer> getSingInPriceList(SystemEnum system);
    /**
     * @return java.lang.Integer
     * @author hxh
     * @description 获取观看视频的单价(按分钟计价)
     * @date 18:18 2022/4/26
     * @param: user
     **/
    /**
     * @return java.lang.Integer
     * @author hxh
     * @description 获取本次观看视频的价格
     * @date 18:23 2022/4/26
     * @param: user 用户信息
     * @param: date 观看的日期
     * @param: timeSeconds 观看的时长
     **/
    public Integer getWatchVideoPrice(UserInfo user, Date date, int timeSeconds) throws GoldCornGetPriceException;
    /**
     * @return java.lang.Integer
     * @author hxh
     * @description 获取本次阅读小说的价格
     * @date 18:28 2022/4/26
     * @param: user
     * @param: date
     * @param: timeSeconds
     **/
    public Integer getReadNovelPrice(UserInfo user, Date date, int timeSeconds) throws GoldCornGetPriceException;
    /**
     * @author hxh
     * @description 获取浏览新闻价格
     * @date 18:34 2022/4/26
     * @param: user
     * @param: date
     * @param: num
     * @return java.lang.Integer
     **/
    public Integer getScanNewsPrice(UserInfo user, Date date, int num) throws GoldCornGetPriceException;
}
app/src/main/java/com/yeshi/makemoney/app/service/inter/goldcorn/GoldCornMakeService.java
@@ -28,7 +28,7 @@
     * @param: isDouble 是否加倍
     * @param: time 发生时间
     **/
    public GoldCornGetRecord addGoldCorn(Long uid, GoldCornGetType type, boolean isDouble, Date time, Integer price) throws UserInfoException, GoldCornGetPriceException, GoldCornGetFrequencyConfigException, GoldCornMakeException;
    public GoldCornGetRecord addGoldCorn(Long uid, GoldCornGetType type, boolean isDouble, Date time, Integer price) throws UserInfoException, GoldCornGetFrequencyConfigException, GoldCornMakeException;
    /**
@@ -82,4 +82,43 @@
    public GoldCornGetRecord signIn(Long uid) throws GoldCornGetFrequencyConfigException, UserInfoException, GoldCornGetPriceException, GoldCornMakeException;
    /**
     * @return com.yeshi.makemoney.app.entity.goldcorn.GoldCornGetRecord
     * @author hxh
     * @description 观看视频
     * @date 18:47 2022/4/26
     * @param: uid
     * @param: isDouble
     * @param: time
     * @param: timeSeconds
     **/
    public Integer watchVideo(Long uid, boolean isDouble, Date time, int timeSeconds) throws GoldCornGetPriceException, UserInfoException, GoldCornMakeException, GoldCornGetFrequencyConfigException;
    /**
     * @return com.yeshi.makemoney.app.entity.goldcorn.GoldCornGetRecord
     * @author hxh
     * @description 阅读小说
     * @date 18:48 2022/4/26
     * @param: uid
     * @param: isDouble
     * @param: time
     * @param: timeSeconds
     **/
    public Integer readNovel(Long uid, boolean isDouble, Date time, int timeSeconds) throws GoldCornGetPriceException, UserInfoException, GoldCornMakeException, GoldCornGetFrequencyConfigException;
    /**
     * @return com.yeshi.makemoney.app.entity.goldcorn.GoldCornGetRecord
     * @author hxh
     * @description 浏览资讯
     * @date 18:48 2022/4/26
     * @param: uid
     * @param: isDouble
     * @param: time
     * @param: num
     **/
    public Integer scanNews(Long uid, boolean isDouble, Date time, int num) throws GoldCornGetPriceException, UserInfoException, GoldCornMakeException, GoldCornGetFrequencyConfigException;
}
app/src/main/java/com/yeshi/makemoney/app/service/inter/goldcorn/GoldCornSettleService.java
@@ -36,7 +36,7 @@
     * @param: day
     * @param: rate 汇率
     **/
    public void settle(Long uid, Date day, BigDecimal rate) throws GoldCornConsumeRecordException, UserMoneyRecordException;
    public void settle(Long uid, String day, BigDecimal rate) throws GoldCornConsumeRecordException, UserMoneyRecordException;
    /**
@@ -47,7 +47,7 @@
     * @param: uid
     * @param: day
     **/
    public void settle(Long uid, Date day) throws UserInfoException, GoldCornMoneyExchangeRateRecordException, UserMoneyRecordException, GoldCornConsumeRecordException;
    public void settle(Long uid, String day) throws UserInfoException, GoldCornMoneyExchangeRateRecordException, UserMoneyRecordException, GoldCornConsumeRecordException;
}
app/src/main/java/com/yeshi/makemoney/app/service/inter/msg/AppPageNotifyMsgService.java
@@ -3,8 +3,12 @@
import java.lang.Exception;
import javax.annotation.Resource;
import java.util.Date;
import com.yeshi.makemoney.app.entity.SystemEnum;
import org.yeshi.utils.bean.BeanUtil;
import java.util.List;
import com.yeshi.makemoney.app.entity.msg.AppPageNotifyMsg;
import com.yeshi.makemoney.app.service.inter.msg.AppPageNotifyMsgService;
import com.yeshi.makemoney.app.service.query.msg.AppPageNotifyMsgQuery;
@@ -13,38 +17,51 @@
public interface AppPageNotifyMsgService {
    /**
     * 获取列表
     * @param appPageNotifyMsgQuery
     * @param page
     * @param pageSize
     * @return
     */
    public List<AppPageNotifyMsg> list(AppPageNotifyMsgQuery appPageNotifyMsgQuery, int page, int pageSize) ;
     * 获取列表
     *
     * @param appPageNotifyMsgQuery
     * @param page
     * @param pageSize
     * @return
     */
    public List<AppPageNotifyMsg> list(AppPageNotifyMsgQuery appPageNotifyMsgQuery, int page, int pageSize);
    /**
     *
     */
    public long count(AppPageNotifyMsgQuery appPageNotifyMsgQuery) ;
     *
     */
    public long count(AppPageNotifyMsgQuery appPageNotifyMsgQuery);
    /**
     *
     */
    public AppPageNotifyMsg get(String id) ;
     *
     */
    public AppPageNotifyMsg get(String id);
    /**
     *
     */
    public void add(AppPageNotifyMsg appPageNotifyMsg)  throws Exception;
     *
     */
    public void add(AppPageNotifyMsg appPageNotifyMsg) throws Exception;
    /**
     *
     */
    public void update(AppPageNotifyMsg appPageNotifyMsg) ;
     *
     */
    public void update(AppPageNotifyMsg appPageNotifyMsg);
    /**
     *
     */
    public void delete(List<String> idList) ;
     *
     */
    public void delete(List<String> idList);
    /**
     * @return com.yeshi.makemoney.app.entity.msg.AppPageNotifyMsg
     * @author hxh
     * @description 根据类型查询
     * @date 10:53 2022/4/24
     * @param: system
     * @param: type
     * @param: date
     **/
    public AppPageNotifyMsg selectByType(SystemEnum system, AppPageNotifyMsg.AppPageNotifyMsgType type, Date date);
}
app/src/main/java/com/yeshi/makemoney/app/service/inter/msg/UserMsgNotifyService.java
New file
@@ -0,0 +1,15 @@
package com.yeshi.makemoney.app.service.inter.msg;
import com.yeshi.makemoney.app.entity.msg.UserMsg;
/**
 * @author hxh
 * @title: UserMsgNotifyService
 * @description: 用户消息通知
 * @date 2022/4/24 11:59
 */
public interface UserMsgNotifyService {
    public void notify(UserMsg userMsg);
}
app/src/main/java/com/yeshi/makemoney/app/service/inter/msg/UserMsgService.java
@@ -47,4 +47,14 @@
    public void delete(List<String> idList) ;
    /**
     * @author hxh
     * @description 消息已读
     * @date 14:13 2022/4/24
     * @param: uid
     * @return void
     **/
    public void readAllMsg(Long uid);
}
app/src/main/java/com/yeshi/makemoney/app/service/inter/user/UserAccountService.java
@@ -3,6 +3,7 @@
import com.yeshi.makemoney.app.dto.user.LoginInfoDTO;
import com.yeshi.makemoney.app.entity.user.UserInfo;
import com.yeshi.makemoney.app.exception.user.LoginException;
import com.yeshi.makemoney.app.exception.user.UserAccountException;
/**
 * @author hxh
@@ -16,13 +17,33 @@
    /**
     * @return void
     * @description 主注销
     * @date 13:56 2021/12/6
     * @param: uid
     * @return void
     **/
    public void unRegister(Long uid);
    /**
     * @return void
     * @author hxh
     * @description 绑定微信
     * @date 14:37 2022/4/22
     * @param: uid
     * @param: code
     **/
    public void bindWX(Long uid, String code) throws UserAccountException;
    /**
     * @return void
     * @author hxh
     * @description 绑定电话号码
     * @date 14:37 2022/4/22
     * @param: uid
     * @param: phone
     **/
    public void bindPhone(Long uid,String phone, String vcode, String token) throws UserAccountException;
}
app/src/main/java/com/yeshi/makemoney/app/service/inter/user/WXUserInfoService.java
@@ -61,7 +61,5 @@
    WXUserInfo selectBySystemAndUnionId(SystemEnum system, String unionId);
    WXUserInfo selectByUid(Long uid);
}
app/src/main/java/com/yeshi/makemoney/app/service/manager/VerifyCodeManager.java
@@ -3,6 +3,7 @@
import com.yeshi.makemoney.app.entity.SystemEnum;
import com.yeshi.makemoney.app.entity.config.SystemConfigKey;
import com.yeshi.makemoney.app.service.inter.config.SystemConfigService;
import com.yeshi.makemoney.app.utils.Constant;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;
import org.yeshi.utils.StringUtil;
@@ -62,7 +63,9 @@
     * @param: code
     **/
    public boolean isPhoneCodeRight(SystemEnum system, String phone, String code) {
        if (!Constant.VERIFY_VCODE) {
            return true;
        }
        String value = systemConfigService.getValueCache(system, SystemConfigKey.testAccount);
        //测试账号
        if (!StringUtil.isNullOrEmpty(value)) {
app/src/main/java/com/yeshi/makemoney/app/utils/Constant.java
@@ -15,6 +15,10 @@
 */
public class Constant {
    //是否需要验证验证码
    public final static boolean VERIFY_VCODE = false;
    public static AlipayConfig alipayConfig;
    public static WXTransferConfig wxTransferConfig;
app/src/main/java/com/yeshi/makemoney/app/utils/factory/msg/UserMsgFactory.java
@@ -3,6 +3,7 @@
import com.yeshi.makemoney.app.entity.goldcorn.GoldCornConsumeRecord;
import com.yeshi.makemoney.app.entity.msg.UserMsg;
import com.yeshi.makemoney.app.entity.msg.UserMsgType;
import org.yeshi.utils.StringUtil;
import java.math.BigDecimal;
import java.util.ArrayList;
@@ -65,13 +66,16 @@
     * @param: money
     **/
    public static UserMsg createExtractFail(Long uid, BigDecimal money) {
    public static UserMsg createExtractFail(Long uid, BigDecimal money,String beizhu) {
        UserMsg userMsg = new UserMsg();
        userMsg.setType(UserMsgType.extract);
        userMsg.setUid(uid);
        List<UserMsg.UserMsgItem> contentList = new ArrayList<>();
        contentList.add(new UserMsg.UserMsgItem("提现金额", money.toString() + "元"));
        contentList.add(new UserMsg.UserMsgItem("提现状态", "提现失败"));
        if(!StringUtil.isNullOrEmpty(beizhu)){
            contentList.add(new UserMsg.UserMsgItem("备注", beizhu));
        }
        userMsg.setContentList(contentList);
        return userMsg;
    }
app/src/main/java/com/yeshi/makemoney/app/utils/goldcorn/GoldCornUtil.java
@@ -23,4 +23,9 @@
        return TimeUtil.getGernalTime(day.getTime(), "yyyy-MM-dd");
    }
    public static Date convertFormatDay(String day) {
        return new Date(TimeUtil.convertToTimeTemp(day, "yyyy-MM-dd"));
    }
}
app/src/main/java/com/yeshi/makemoney/app/utils/mq/CMQManager.java
@@ -123,11 +123,11 @@
     **/
    public void addGoldCornSettleMsg(GoldCornSettleMQMsg msg) {
        String content = new Gson().toJson(msg);
        tdmqUtil.sendMsg(QUEUE_GOLDCORN_SETTLE, content);
        TDMQUtil.getInstance().sendMsg(QUEUE_GOLDCORN_SETTLE, content);
    }
    public Map<String, GoldCornSettleMQMsg> consumeGoldCornSettleMsg(int count) {
        List<Message> list = tdmqUtil.recieveMsg(count, QUEUE_GOLDCORN_SETTLE);
        List<Message> list =  TDMQUtil.getInstance().recieveMsg(count, QUEUE_GOLDCORN_SETTLE);
        Map<String, GoldCornSettleMQMsg> map = new HashMap<>();
        if (list != null) {
            for (Message msg : list) {
@@ -143,7 +143,7 @@
    }
    public void deleteGoldCornSettleMsg(String receiptHandle) {
        tdmqUtil.deleteMsg(QUEUE_GOLDCORN_SETTLE, receiptHandle);
        TDMQUtil.getInstance().deleteMsg(QUEUE_GOLDCORN_SETTLE, receiptHandle);
    }
app/src/main/java/com/yeshi/makemoney/app/vo/goldcorn/GoldCornDoTaskVO.java
@@ -13,6 +13,10 @@
    private GoldCornGetType type;
    private Boolean isDouble;
    private Long finishTime;
    //数量
    private Integer num;
    //持续时间
    private Integer timeSeconds;
    public GoldCornGetType getType() {
@@ -38,4 +42,20 @@
    public void setFinishTime(Long finishTime) {
        this.finishTime = finishTime;
    }
    public Integer getNum() {
        return num;
    }
    public void setNum(Integer num) {
        this.num = num;
    }
    public Integer getTimeSeconds() {
        return timeSeconds;
    }
    public void setTimeSeconds(Integer timeSeconds) {
        this.timeSeconds = timeSeconds;
    }
}
app/src/main/java/com/yeshi/makemoney/app/vo/msg/AppPageNotifyMsgVO.java
New file
@@ -0,0 +1,59 @@
package com.yeshi.makemoney.app.vo.msg;
import com.yeshi.makemoney.app.entity.msg.AppPageNotifyMsg;
/**
 * @author hxh
 * @title: AppPageNotifyMsgVO
 * @description: 客户端提醒消息
 * @date 2022/4/24 11:02
 */
public class AppPageNotifyMsgVO {
    private String content;
    private String md5;
    private boolean close;
    private String link;
    public static AppPageNotifyMsgVO create(AppPageNotifyMsg msg) {
        AppPageNotifyMsgVO vo = new AppPageNotifyMsgVO();
        vo.setClose(msg.getCanClose() == null ? false : msg.getCanClose());
        vo.setContent(msg.getContent());
        vo.setLink(msg.getContentUrl());
        vo.setMd5(msg.getMd5());
        return vo;
    }
    public String getContent() {
        return content;
    }
    public void setContent(String content) {
        this.content = content;
    }
    public String getMd5() {
        return md5;
    }
    public void setMd5(String md5) {
        this.md5 = md5;
    }
    public boolean isClose() {
        return close;
    }
    public void setClose(boolean close) {
        this.close = close;
    }
    public String getLink() {
        return link;
    }
    public void setLink(String link) {
        this.link = link;
    }
}
app/src/main/java/com/yeshi/makemoney/app/vo/msg/UserMsgVO.java
New file
@@ -0,0 +1,127 @@
package com.yeshi.makemoney.app.vo.msg;
import com.yeshi.makemoney.app.entity.msg.UserMsg;
import com.yeshi.makemoney.app.entity.msg.UserMsgType;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
/**
 * @author hxh
 * @title: UserMsgVO
 * @description: 用户消息
 * @date 2022/4/24 11:36
 */
public class UserMsgVO {
    private String id;
    private UserMsgTypeVO type;
    private List<UserMsgItemVO> contentList;
    private Date createTime;
    public static UserMsgVO create(UserMsg msg) {
        UserMsgVO vo = new UserMsgVO();
        vo.setCreateTime(msg.getCreateTime());
        vo.setId(msg.getId());
        vo.setType(UserMsgTypeVO.create(msg.getType()));
        vo.setContentList(msg.getContentList().stream().map(item -> {
            UserMsgItemVO itemVO = new UserMsgItemVO();
            itemVO.setTitle(item.getKey());
            itemVO.setContent(item.getValue());
            return itemVO;
        }).collect(Collectors.toList()));
        return vo;
    }
    public String getId() {
        return id;
    }
    public void setId(String id) {
        this.id = id;
    }
    public UserMsgTypeVO getType() {
        return type;
    }
    public void setType(UserMsgTypeVO type) {
        this.type = type;
    }
    public List<UserMsgItemVO> getContentList() {
        return contentList;
    }
    public void setContentList(List<UserMsgItemVO> contentList) {
        this.contentList = contentList;
    }
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    static class UserMsgItemVO {
        private String title;
        private String content;
        public static UserMsgItemVO create(UserMsg.UserMsgItem item) {
            UserMsgItemVO vo = new UserMsgItemVO();
            vo.setContent(item.getValue());
            vo.setTitle(item.getValue());
            return vo;
        }
        public String getTitle() {
            return title;
        }
        public void setTitle(String title) {
            this.title = title;
        }
        public String getContent() {
            return content;
        }
        public void setContent(String content) {
            this.content = content;
        }
    }
    static class UserMsgTypeVO {
        private String icon;
        private String name;
        public static UserMsgTypeVO create(UserMsgType type) {
            UserMsgTypeVO vo = new UserMsgTypeVO();
            vo.setIcon(type.getIcon());
            vo.setName(type.getName());
            return vo;
        }
        public String getIcon() {
            return icon;
        }
        public void setIcon(String icon) {
            this.icon = icon;
        }
        public String getName() {
            return name;
        }
        public void setName(String name) {
            this.name = name;
        }
    }
}
app/src/main/resources/mapper/OrderRecordMapper.xml
@@ -214,23 +214,23 @@
    <sql id="listWhere">
        <if test="query.state!=null">
            state=#{query.state}
         and   state=#{query.state}
        </if>
        <if test="query.orderType!=null">
            order_type=#{query.orderType}
          and  order_type=#{query.orderType}
        </if>
        <if test="query.uid!=null">
            uid=#{query.uid}
           and uid=#{query.uid}
        </if>
        <if test="query.minCreateTime!=null">
            create_time>= #{query.minCreateTime}
           and create_time>= #{query.minCreateTime}
        </if>
        <if test="query.maxCreateTime!=null">
            #{query.maxCreateTime}>create_time
          and  #{query.maxCreateTime}>create_time
        </if>
    </sql>
app/src/main/resources/mapper/QQUserInfoMapper.xml
@@ -119,11 +119,11 @@
    <sql id="listWhere">
        <if test="query.system!=null">
            system= #{query.system}
        and    system= #{query.system}
        </if>
        <if test="query.openId!=null">
            open_id= #{query.openId}
          and  open_id= #{query.openId}
        </if>
    </sql>
app/src/main/resources/mapper/UserMoneyRecordMapper.xml
@@ -9,7 +9,7 @@
        <result column="serial_no" property="serialNo" jdbcType="VARCHAR"/>
        <result column="money" property="money" jdbcType="DECIMAL"/>
        <result column="`add`" property="add" jdbcType="BOOLEAN"/>
        <result column="show" property="show" jdbcType="BOOLEAN"/>
        <result column="`show`" property="show" jdbcType="BOOLEAN"/>
        <result column="remarks" property="remarks" jdbcType="VARCHAR"/>
        <result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
        <result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/>
@@ -21,7 +21,7 @@
    <sql id="Base_Column_List">
        <trim suffixOverrides=",">
            id,uid,`type`,serial_no,money,`add`,show,remarks,create_time,update_time,
            id,uid,`type`,serial_no,money,`add`,`show`,remarks,create_time,update_time,
        </trim>
    </sql>
@@ -55,7 +55,7 @@
            serial_no,
            money,
            `add`,
            show,
            `show`,
            remarks,
            create_time,
            update_time,
@@ -87,7 +87,7 @@
            <if test="serialNo != null">serial_no,</if>
            <if test="money != null">money,</if>
            <if test="add != null">`add`,</if>
            <if test="show != null">show,</if>
            <if test="show != null">`show`,</if>
            <if test="remarks != null">remarks,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateTime != null">update_time,</if>
@@ -116,7 +116,7 @@
            <if test="serialNo != null">serial_no = #{serialNo,jdbcType=VARCHAR},</if>
            <if test="money != null">money = #{money,jdbcType=DECIMAL},</if>
            <if test="add != null">`add` = #{add,jdbcType=BOOLEAN},</if>
            <if test="show != null">show = #{show,jdbcType=BOOLEAN},</if>
            <if test="show != null">`show` = #{show,jdbcType=BOOLEAN},</if>
            <if test="remarks != null">remarks = #{remarks,jdbcType=VARCHAR},</if>
            <if test="createTime != null">create_time = #{createTime,jdbcType=TIMESTAMP},</if>
            <if test="updateTime != null">update_time = #{updateTime,jdbcType=TIMESTAMP},</if>
@@ -132,7 +132,7 @@
            <if test="serialNo != null">serial_no = #{serialNo,jdbcType=VARCHAR},</if>
            <if test="money != null">money = #{money,jdbcType=DECIMAL},</if>
            <if test="add != null">`add` = #{add,jdbcType=BOOLEAN},</if>
            <if test="show != null">show = #{show,jdbcType=BOOLEAN},</if>
            <if test="show != null">`show` = #{show,jdbcType=BOOLEAN},</if>
            <if test="remarks != null">remarks = #{remarks,jdbcType=VARCHAR},</if>
            <if test="createTime != null">create_time = #{createTime,jdbcType=TIMESTAMP},</if>
            <if test="updateTime != null">update_time = #{updateTime,jdbcType=TIMESTAMP},</if>
@@ -154,7 +154,7 @@
            and `add` = #{query.add}
        </if>
        <if test="query.show!=null">
            and show = #{query.show}
            and `show` = #{query.show}
        </if>
    </sql>
app/src/main/resources/mapper/UserVIPInfoMapper.xml
@@ -97,11 +97,11 @@
    <sql id="listWhere">
        <if test="query.minExpireDate!=null">
            expire_date>=#{query.minExpireDate}
         and   expire_date>=#{query.minExpireDate}
        </if>
        <if test="query.maxExpireDate!=null">
            #{query.maxExpireDate}>expire_date
          and  #{query.maxExpireDate}>expire_date
        </if>
    </sql>
app/src/main/resources/mapper/WXUserInfoMapper.xml
@@ -160,17 +160,13 @@
    <sql id="listWhere">
        <if test="query.system!=null">
            system=#{query.system}
            and system=#{query.system}
        </if>
        <if test="query.unionId!=null">
            union_id=#{query.unionId}
            and union_id=#{query.unionId}
        </if>
        <if test="query.uid!=null">
            uid=#{query.uid}
        </if>
    </sql>
    <select id="list"
app/src/test/java/test/goldcorn/GoldCornTest.java
@@ -10,6 +10,7 @@
import com.yeshi.makemoney.app.exception.user.UserInfoException;
import com.yeshi.makemoney.app.service.inter.goldcorn.GoldCornGetRecordService;
import com.yeshi.makemoney.app.service.inter.goldcorn.GoldCornMakeService;
import com.yeshi.makemoney.app.service.inter.goldcorn.GoldCornSettleService;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@@ -31,6 +32,9 @@
    @Resource
    private GoldCornMakeService goldCornMakeService;
    @Resource
    private GoldCornSettleService goldCornSettleService;
    @Test
    public void addGoldRecord() throws GoldCornGetRecordException {
@@ -83,5 +87,10 @@
        }
    }
    @Test
    public void settle(){
        goldCornSettleService.startSettle(new Date(System.currentTimeMillis()-1000*60*60*24L));
    }
}
app/src/test/java/test/msg/MsgTest.java
New file
@@ -0,0 +1,42 @@
package test.msg;
import com.yeshi.makemoney.app.Application;
import com.yeshi.makemoney.app.entity.goldcorn.GoldCornGetRecord;
import com.yeshi.makemoney.app.entity.goldcorn.GoldCornGetType;
import com.yeshi.makemoney.app.exception.goldcorn.GoldCornGetFrequencyConfigException;
import com.yeshi.makemoney.app.exception.goldcorn.GoldCornGetPriceException;
import com.yeshi.makemoney.app.exception.goldcorn.GoldCornGetRecordException;
import com.yeshi.makemoney.app.exception.goldcorn.GoldCornMakeException;
import com.yeshi.makemoney.app.exception.user.UserInfoException;
import com.yeshi.makemoney.app.service.inter.goldcorn.GoldCornGetRecordService;
import com.yeshi.makemoney.app.service.inter.goldcorn.GoldCornMakeService;
import com.yeshi.makemoney.app.service.inter.goldcorn.GoldCornSettleService;
import com.yeshi.makemoney.app.service.inter.msg.UserMsgNotifyService;
import com.yeshi.makemoney.app.utils.factory.msg.UserMsgFactory;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
/**
 * @author hxh
 * @title: GoldCornTest
 * @description: TODO
 * @date 2022/4/7 10:13
 */
@SpringBootTest(classes = Application.class)
public class MsgTest {
    @Resource
    private UserMsgNotifyService userMsgNotifyService;
    @Test
    public void addMsg() {
        userMsgNotifyService.notify(UserMsgFactory.createExtractFail(22384L, new BigDecimal(10), "这是测试备注,测试备注,测试备注"));
    }
}
pom.xml
@@ -160,7 +160,7 @@
        <dependency>
            <groupId>com.yeshi</groupId>
            <artifactId>utils</artifactId>
            <version>0.3.5</version>
            <version>0.3.6</version>
            <exclusions>
                <exclusion>
                    <groupId>org.springframework.data</groupId>