1个文件已删除
162 文件已重命名
36个文件已修改
1 文件已复制
13个文件已添加
| | |
| | | <version>1.0.2</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>redis.clients</groupId> |
| | | <artifactId>jedis</artifactId> |
| | | <version>3.2.0</version> |
| | | </dependency> |
| | | |
| | | |
| | | |
| | | </dependencies> |
| | |
| | | package com.yeshi.makemoney.app; |
| | | |
| | | import com.ks.lib.common.exception.ParamsException; |
| | | import com.yeshi.makemoney.app.dto.mq.ExtractTransferResultMQMsg; |
| | | 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.service.inter.money.ExtractService; |
| | | import com.yeshi.makemoney.app.utils.Constant; |
| | | import com.yeshi.makemoney.app.utils.mq.CMQManager; |
| | | import org.mybatis.spring.annotation.MapperScan; |
| | | import org.slf4j.Logger; |
| | |
| | | |
| | | public static void main(String[] args) { |
| | | SpringApplication.run(Application.class, args); |
| | | logger.info(Constant.wxTransferConfig.toString()); |
| | | logger.info("应用启动成功"); |
| | | } |
| | | |
| | |
| | | |
| | | @Resource |
| | | private GoldCornSettleService goldCornSettleService; |
| | | |
| | | @Resource |
| | | private ExtractService extractService; |
| | | |
| | | private void initMQMsgConsumer() { |
| | | final int THREAD_NUM = 3; |
| | |
| | | String key = its.next(); |
| | | GoldCornSettleMQMsg msg = map.get(key); |
| | | try { |
| | | goldCornSettleService.settle(msg.getUid(), msg.getDay()); |
| | | goldCornSettleService.settle(msg.getUid(), msg.getDay(),msg.getSettleId()); |
| | | CMQManager.getInstance().deleteGoldCornSettleMsg(key); |
| | | } catch (UserInfoException e) { |
| | | e.printStackTrace(); |
| | |
| | | e.printStackTrace(); |
| | | } catch (GoldCornConsumeRecordException e) { |
| | | e.printStackTrace(); |
| | | }catch (Exception e){ |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | |
| | | } |
| | | }); |
| | | } |
| | | |
| | | //处理提现结果 |
| | | new JobThreadExecutorServiceImpl().run(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | Map<String, ExtractTransferResultMQMsg> map = CMQManager.getInstance().consumeExtractResultMsg(10); |
| | | if (map != null) { |
| | | for (Iterator<String> its = map.keySet().iterator(); its.hasNext(); ) { |
| | | String key = its.next(); |
| | | ExtractTransferResultMQMsg msg = map.get(key); |
| | | try { |
| | | extractService.processExtractResult(msg); |
| | | CMQManager.getInstance().deleteExtractResultMsg(key); |
| | | } catch (ParamsException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }); |
| | | |
| | | } |
| | | |
| | | |
| | |
| | | package com.yeshi.makemoney.app.aop; |
| | | |
| | | import com.yeshi.makemoney.app.entity.AdminUser; |
| | | import com.yeshi.makemoney.app.entity.config.SystemConfigKey; |
| | | import com.yeshi.makemoney.app.service.inter.config.SystemConfigService; |
| | | import com.yeshi.makemoney.app.utils.ApiCodeConstant; |
| | |
| | | import org.aspectj.lang.ProceedingJoinPoint; |
| | | import org.aspectj.lang.annotation.Around; |
| | | import org.aspectj.lang.annotation.Aspect; |
| | | import org.springframework.boot.web.servlet.server.Session; |
| | | import org.springframework.core.annotation.Order; |
| | | import org.springframework.security.core.Authentication; |
| | | import org.springframework.security.core.context.SecurityContext; |
| | | import org.springframework.security.core.context.SecurityContextHolder; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.web.context.request.RequestContextHolder; |
| | | import org.springframework.web.context.request.ServletRequestAttributes; |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpSession; |
| | | import java.io.IOException; |
| | | import java.io.PrintWriter; |
| | | import java.util.*; |
| | |
| | | } |
| | | |
| | | if (acceptAdminData != null) { |
| | | acceptAdminData.setSystem(SystemInfoUtil.getAdminSelectedSystem(servletContainer.getRequest().getSession())); |
| | | if(acceptAdminData.getSystem()==null){ |
| | | HttpSession session = servletContainer.getRequest().getSession(); |
| | | |
| | | acceptAdminData.setSystem(SystemInfoUtil.getAdminSelectedSystem(session)); |
| | | if (acceptAdminData.getSystem() == null) { |
| | | PrintWriter out = servletContainer.getResponse().getWriter(); |
| | | out.print(JsonUtil.loadFalseResult(ApiCodeConstant.CODE_ERROR_IN_SERVER, "未选择系统")); |
| | | out.close(); |
| | | return null; |
| | | } |
| | | //如果用户登录了将用户信息加入进去 |
| | | SecurityContext contextSession = (SecurityContext) session.getAttribute("SPRING_SECURITY_CONTEXT"); |
| | | if (contextSession != null) { |
| | | Authentication authentication = contextSession.getAuthentication(); |
| | | AdminUser adminUser = (AdminUser) authentication.getPrincipal(); |
| | | acceptAdminData.setAdminUser(adminUser); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | try { |
| | |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer; |
| | | import org.springframework.data.redis.serializer.StringRedisSerializer; |
| | | import redis.clients.jedis.JedisPool; |
| | | import redis.clients.jedis.JedisPoolConfig; |
| | | |
| | | import java.time.Duration; |
| | | |
| | |
| | | return template; |
| | | } |
| | | |
| | | |
| | | @Bean |
| | | public JedisPool jedisPool() { |
| | | JedisPoolConfig poolConfig = new JedisPoolConfig(); |
| | | poolConfig.setMaxTotal(maxActive); |
| | | poolConfig.setMaxIdle(maxIdle); |
| | | poolConfig.setTestOnBorrow(true); |
| | | return new JedisPool(poolConfig, addr, port, timeout, auth, database); |
| | | } |
| | | |
| | | } |
| | |
| | | import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; |
| | | import org.springframework.security.core.Authentication; |
| | | import org.springframework.security.core.AuthenticationException; |
| | | import org.springframework.security.core.context.SecurityContextHolder; |
| | | import org.springframework.security.core.userdetails.UserDetails; |
| | | import org.springframework.security.core.userdetails.UserDetailsService; |
| | | import org.springframework.security.core.userdetails.UsernameNotFoundException; |
| | |
| | | private AdminUserService adminUserService; |
| | | |
| | | private final String LOGIN_PROCESSING_URL = "/admin/api/login"; |
| | | |
| | | private final String LOGIN_PAGE_PATH="/7aed59d33d777100/login.html"; |
| | | |
| | | //图形验证码配置 |
| | | @Bean |
| | |
| | | .and() |
| | | .formLogin() |
| | | //自定义登录界面 |
| | | .loginPage("/login.html") |
| | | .loginPage(LOGIN_PAGE_PATH) |
| | | //处理登录逻辑的url |
| | | .loginProcessingUrl(LOGIN_PROCESSING_URL) |
| | | //登录成功后的跳转 |
| | |
| | | if (url.contains("/admin/api/")) { |
| | | response.setStatus(HttpStatus.UNAUTHORIZED.value()); |
| | | } else { |
| | | response.sendRedirect("/login.html"); |
| | | response.sendRedirect(LOGIN_PAGE_PATH); |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | import com.google.gson.*; |
| | | import com.yeshi.makemoney.app.entity.goldcorn.GoldCornGetType; |
| | | import com.yeshi.makemoney.app.vo.AcceptAdminData; |
| | | import net.sf.json.JSONArray; |
| | | import net.sf.json.JSONObject; |
| | | import org.springframework.stereotype.Controller; |
| | |
| | | import com.yeshi.makemoney.app.entity.goldcorn.GoldCornGetRecord; |
| | | import com.yeshi.makemoney.app.service.inter.goldcorn.GoldCornGetRecordService; |
| | | import com.yeshi.makemoney.app.service.query.goldcorn.GoldCornGetRecordQuery; |
| | | import org.yeshi.utils.statistic.BaseStatisticTimeQuery; |
| | | import org.yeshi.utils.statistic.StatisticNumberResult; |
| | | import org.yeshi.utils.statistic.StatisticResulterFilterUtil; |
| | | import org.yeshi.utils.statistic.StatisticTimeSpan; |
| | | |
| | | @Controller |
| | | @RequestMapping("admin/api/goldcorn/get/record") |
| | |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @RequestMapping("statistic") |
| | | public String statistic(AcceptAdminData acceptAdminData, long startTime, long endTime, String span, String callback) { |
| | | if (endTime < startTime) { |
| | | return JsonUtil.loadFalseResult("开始时间不能大于结束时间"); |
| | | } |
| | | |
| | | if (StatisticTimeSpan.valueOf(span) == null) { |
| | | return JsonUtil.loadFalseResult("时间间隔不存在"); |
| | | } |
| | | |
| | | BaseStatisticTimeQuery timeQuery = new BaseStatisticTimeQuery(); |
| | | timeQuery.setStartTime(new Date(startTime)); |
| | | timeQuery.setEndTime(new Date(endTime)); |
| | | timeQuery.setTimeSpan(StatisticTimeSpan.valueOf(span)); |
| | | |
| | | List<StatisticNumberResult> list = goldCornGetRecordService.statistic(acceptAdminData.getSystem(), timeQuery); |
| | | list = StatisticResulterFilterUtil.filterNumberResult(list, timeQuery); |
| | | JSONObject data = new JSONObject(); |
| | | data.put("list", new Gson().toJson(list)); |
| | | data.put("count", list.size()); |
| | | return JsonUtil.loadTrueResult(data); |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.makemoney.app.controller.admin.goldcorn; |
| | | |
| | | import com.google.gson.*; |
| | | import com.ks.lib.common.exception.ParamsException; |
| | | import com.yeshi.makemoney.app.exception.goldcorn.GoldCornSettleRecordException; |
| | | import com.yeshi.makemoney.app.service.inter.goldcorn.GoldCornSettleService; |
| | | import com.yeshi.makemoney.app.utils.goldcorn.GoldCornUtil; |
| | | import com.yeshi.makemoney.app.vo.AcceptAdminData; |
| | | import net.sf.json.JSONArray; |
| | | 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.JsonUtil; |
| | | import org.yeshi.utils.StringUtil; |
| | | import org.yeshi.utils.TimeUtil; |
| | | import com.google.gson.reflect.TypeToken; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpSession; |
| | | import java.lang.reflect.Type; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | import com.yeshi.makemoney.app.entity.goldcorn.GoldCornSettleRecord; |
| | | import com.yeshi.makemoney.app.service.inter.goldcorn.GoldCornSettleRecordService; |
| | | import com.yeshi.makemoney.app.service.query.goldcorn.GoldCornSettleRecordQuery; |
| | | |
| | | @Controller |
| | | @RequestMapping("/admin/api/goldcorn/settle") |
| | | public class GoldCornSettleRecordAdminController { |
| | | |
| | | @Resource |
| | | private GoldCornSettleRecordService goldCornSettleRecordService; |
| | | |
| | | @Resource |
| | | private GoldCornSettleService goldCornSettleService; |
| | | |
| | | @ResponseBody |
| | | @RequestMapping("list") |
| | | public String list(GoldCornSettleRecordQuery query, int page, int limit) { |
| | | List<GoldCornSettleRecord> list = goldCornSettleRecordService.list(query, page, limit); |
| | | long count = goldCornSettleRecordService.count(query); |
| | | JSONObject data = new JSONObject(); |
| | | Gson gson = new GsonBuilder().registerTypeAdapter(Date.class, new JsonSerializer<Date>() { |
| | | |
| | | @Override |
| | | public JsonElement serialize(Date date, Type type, JsonSerializationContext jsonSerializationContext) { |
| | | return date == null ? new JsonPrimitive("") : new JsonPrimitive(TimeUtil.getGernalTime(date.getTime(), "yyyy.MM.dd HH:mm")); |
| | | } |
| | | }).create(); |
| | | |
| | | data.put("list", gson.toJson(list)); |
| | | data.put("count", count); |
| | | return JsonUtil.loadTrueResult(data); |
| | | |
| | | } |
| | | |
| | | @ResponseBody |
| | | @RequestMapping("delete") |
| | | public String delete(String ids) { |
| | | Type type = new TypeToken<List<String>>() { |
| | | }.getType(); |
| | | List<String> idList = new Gson().fromJson(ids, type); |
| | | goldCornSettleRecordService.delete(idList); |
| | | return JsonUtil.loadTrueResult(""); |
| | | |
| | | } |
| | | |
| | | @ResponseBody |
| | | @RequestMapping("add") |
| | | public String add(GoldCornSettleRecord bean, AcceptAdminData acceptAdminData) { |
| | | if (StringUtil.isNullOrEmpty(bean.getDay())) { |
| | | return JsonUtil.loadFalseResult("day不能为空"); |
| | | } |
| | | try { |
| | | goldCornSettleService.startSettle(GoldCornUtil.convertFormatDay(bean.getDay()), bean.getRemarks(), acceptAdminData.getSystem()); |
| | | return JsonUtil.loadTrueResult(""); |
| | | } catch (GoldCornSettleRecordException e) { |
| | | e.printStackTrace(); |
| | | return JsonUtil.loadFalseResult(e.getMessage()); |
| | | } catch (ParamsException e) { |
| | | e.printStackTrace(); |
| | | return JsonUtil.loadFalseResult(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | @ResponseBody |
| | | @RequestMapping("get") |
| | | public String get(String id, HttpSession session) { |
| | | GoldCornSettleRecord entity = goldCornSettleRecordService.get(id); |
| | | if (entity != null) { |
| | | return JsonUtil.loadTrueResult(entity); |
| | | |
| | | } else { |
| | | return JsonUtil.loadFalseResult("ID不存在"); |
| | | |
| | | } |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @RequestMapping("update") |
| | | public String update(GoldCornSettleRecord bean, HttpSession session) { |
| | | if (bean.getId() == null) { |
| | | return JsonUtil.loadFalseResult("ID不能为空"); |
| | | |
| | | } |
| | | try { |
| | | goldCornSettleRecordService.update(bean); |
| | | } catch (Exception e) { |
| | | return JsonUtil.loadFalseResult(e.getMessage()); |
| | | |
| | | } |
| | | return JsonUtil.loadTrueResult(""); |
| | | |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | package com.yeshi.makemoney.app.controller.admin.money; |
| | | |
| | | import com.google.gson.*; |
| | | import com.ks.lib.common.exception.ParamsException; |
| | | import com.yeshi.makemoney.app.aop.AdminApiFilter; |
| | | import com.yeshi.makemoney.app.dto.money.ExtractConfig; |
| | | import com.yeshi.makemoney.app.entity.config.SystemConfig; |
| | | import com.yeshi.makemoney.app.entity.config.SystemConfigKey; |
| | | import com.yeshi.makemoney.app.entity.money.ExtractPayType; |
| | | import com.yeshi.makemoney.app.exception.money.ExtractException; |
| | | import com.yeshi.makemoney.app.exception.money.UserMoneyBalanceException; |
| | | import com.yeshi.makemoney.app.service.inter.AdminUserService; |
| | | import com.yeshi.makemoney.app.service.inter.config.SystemConfigService; |
| | | import com.yeshi.makemoney.app.service.inter.user.UserInfoService; |
| | | import com.yeshi.makemoney.app.service.manager.VerifyCodeManager; |
| | | import com.yeshi.makemoney.app.vo.AcceptAdminData; |
| | | import net.sf.json.JSONArray; |
| | | import net.sf.json.JSONObject; |
| | |
| | | import com.yeshi.makemoney.app.entity.money.Extract; |
| | | import com.yeshi.makemoney.app.service.inter.money.ExtractService; |
| | | import com.yeshi.makemoney.app.service.query.money.ExtractQuery; |
| | | import org.yeshi.utils.exception.MailSendException; |
| | | import org.yeshi.utils.mail.EmailApiUtil; |
| | | import org.yeshi.utils.mail.EmailInfo; |
| | | |
| | | @Controller |
| | | @RequestMapping("admin/api/money/extract") |
| | | public class ExtractAdminController { |
| | | |
| | | private final String SESSION_KEY_EXTRACT_EMAIL_VERIFIED = "admin-do-extract"; |
| | | |
| | | |
| | | @Resource |
| | | private ExtractService extractService; |
| | | |
| | | @Resource |
| | | private SystemConfigService systemConfigService; |
| | | |
| | | @Resource |
| | | private AdminUserService adminUserService; |
| | | |
| | | @Resource |
| | | private VerifyCodeManager verifyCodeManager; |
| | | |
| | | @Resource |
| | | private UserInfoService userInfoService; |
| | | |
| | | |
| | | @ResponseBody |
| | |
| | | |
| | | @ResponseBody |
| | | @RequestMapping("get") |
| | | public String get(Long id, HttpSession session, String callback) { |
| | | public String get(Long id) { |
| | | Extract entity = extractService.get(id); |
| | | if (entity != null) { |
| | | return JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(entity)); |
| | | |
| | | entity.setUser(userInfoService.get(entity.getUser().getId())); |
| | | return JsonUtil.loadTrueResult(JsonUtil.getSimpleGson().toJson(entity)); |
| | | } else { |
| | | return JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("ID不存在")); |
| | | |
| | | return JsonUtil.loadFalseResult("ID不存在"); |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * @return java.lang.String |
| | | * @author hxh |
| | | * @description 发送提现的邮箱验证码 |
| | | * @date 14:14 2022/5/9 |
| | | * @param: extractConfig |
| | | * @param: acceptAdminData |
| | | **/ |
| | | @ResponseBody |
| | | @RequestMapping("sendExtractEmail") |
| | | public String sendExtractEmail(AcceptAdminData acceptAdminData) { |
| | | if (acceptAdminData.getAdminUser() == null) { |
| | | return JsonUtil.loadFalseResult("管理员信息为空"); |
| | | } |
| | | |
| | | if (StringUtil.isNullOrEmpty(acceptAdminData.getAdminUser().getEmail())) { |
| | | return JsonUtil.loadFalseResult("管理员邮件地址为空"); |
| | | } |
| | | |
| | | String emailSender = systemConfigService.getValueCache(acceptAdminData.getSystem(), SystemConfigKey.emailSender); |
| | | |
| | | if (StringUtil.isNullOrEmpty(emailSender)) { |
| | | return JsonUtil.loadFalseResult("系统尚未配置邮件发送账号信息"); |
| | | } |
| | | String[] sts = emailSender.split(","); |
| | | if (sts.length != 2) { |
| | | return JsonUtil.loadFalseResult("邮件发送账号信息格式有误"); |
| | | } |
| | | |
| | | String code = StringUtil.getVerifyCode(); |
| | | EmailInfo emailInfo = new EmailInfo(); |
| | | emailInfo.setFromEmail(sts[0]); |
| | | emailInfo.setFormEmailPwd(sts[1]); |
| | | emailInfo.setApp(systemConfigService.getValueCache(acceptAdminData.getSystem(), SystemConfigKey.androidPushAppCode)); |
| | | emailInfo.setTitle("提现审核验证码:" + code); |
| | | emailInfo.setContent("提现审核验证码:" + code + ",5分钟内有效,请尽快验证。"); |
| | | emailInfo.setToEmail(acceptAdminData.getAdminUser().getEmail()); |
| | | try { |
| | | EmailApiUtil.sendEmail(emailInfo); |
| | | verifyCodeManager.sendEmailCodeSuccess(emailInfo.getToEmail(), code); |
| | | return JsonUtil.loadTrueResult(""); |
| | | } catch (MailSendException e) { |
| | | return JsonUtil.loadFalseResult(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @RequestMapping("verifyExtractEmail") |
| | | public String verifyExtractEmail(String code, AcceptAdminData acceptAdminData, HttpSession session) { |
| | | if (acceptAdminData.getAdminUser() == null) { |
| | | return JsonUtil.loadFalseResult("管理员信息为空"); |
| | | } |
| | | |
| | | if (StringUtil.isNullOrEmpty(acceptAdminData.getAdminUser().getEmail())) { |
| | | return JsonUtil.loadFalseResult("管理员邮件地址为空"); |
| | | } |
| | | |
| | | boolean isRight = verifyCodeManager.isEMailCodeRight(acceptAdminData.getAdminUser().getEmail(), code); |
| | | if (isRight) { |
| | | session.setAttribute(SESSION_KEY_EXTRACT_EMAIL_VERIFIED, true); |
| | | return JsonUtil.loadTrueResult(""); |
| | | } else { |
| | | return JsonUtil.loadFalseResult("验证码错误"); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * @return java.lang.String |
| | | * @author hxh |
| | | * @description 通过提现 |
| | | * @date 15:04 2022/5/9 |
| | | * @param: id |
| | | * @param: acceptAdminData |
| | | **/ |
| | | |
| | | @ResponseBody |
| | | @RequestMapping("passExtract") |
| | | public String passExtract(Long id, AcceptAdminData acceptAdminData, HttpSession session) { |
| | | |
| | | if (!isVerifiedEmailCode(session)) { |
| | | return JsonUtil.loadFalseResult(50002, "邮箱未验证"); |
| | | } |
| | | |
| | | try { |
| | | extractService.passExtract(id, acceptAdminData.getAdminUser().getAccount()); |
| | | return JsonUtil.loadTrueResult(""); |
| | | } catch (ExtractException e) { |
| | | e.printStackTrace(); |
| | | return JsonUtil.loadFalseResult(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | @ResponseBody |
| | | @RequestMapping("rejectExtract") |
| | | public String rejectExtract(Long id, String reason, AcceptAdminData acceptAdminData, HttpSession session) { |
| | | if (!isVerifiedEmailCode(session)) { |
| | | return JsonUtil.loadFalseResult(50002, "邮箱未验证"); |
| | | } |
| | | try { |
| | | extractService.rejectExtract(id, reason, acceptAdminData.getAdminUser().getAccount()); |
| | | return JsonUtil.loadTrueResult(""); |
| | | } catch (ExtractException e) { |
| | | e.printStackTrace(); |
| | | return JsonUtil.loadFalseResult(e.getMessage()); |
| | | } catch (UserMoneyBalanceException e) { |
| | | e.printStackTrace(); |
| | | return JsonUtil.loadFalseResult(e.getMessage()); |
| | | } catch (ParamsException e) { |
| | | e.printStackTrace(); |
| | | return JsonUtil.loadFalseResult(e.getMessage()); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * @return boolean |
| | | * @author hxh |
| | | * @description 是否已经验证了邮件验证码 |
| | | * @date 15:02 2022/5/9 |
| | | * @param: session |
| | | **/ |
| | | private boolean isVerifiedEmailCode(HttpSession session) { |
| | | Boolean verified = (Boolean) session.getAttribute(SESSION_KEY_EXTRACT_EMAIL_VERIFIED); |
| | | if (verified != null && verified) { |
| | | return true; |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.yeshi.utils.JsonUtil; |
| | | import org.yeshi.utils.StringUtil; |
| | | import org.yeshi.utils.TimeUtil; |
| | | import org.yeshi.utils.annotation.RequestSerializableByKey; |
| | | import redis.clients.jedis.Jedis; |
| | | import redis.clients.jedis.JedisPool; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.lang.reflect.Type; |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.util.*; |
| | | import java.util.concurrent.TimeUnit; |
| | | import java.util.stream.Collectors; |
| | |
| | | |
| | | @Resource |
| | | private RedisTemplate<String, Object> redisTemplate; |
| | | |
| | | @Resource |
| | | private JedisPool jedisPool; |
| | | |
| | | @Resource |
| | | private GoldCornTaskTypeInfoService goldCornTaskTypeInfoService; |
| | |
| | | List<GoldCornExchangeRecordVO> voList = new ArrayList<>(); |
| | | for (GoldCornConsumeRecord record : recordList) { |
| | | GoldCornExchangeRecordVO vo = new GoldCornExchangeRecordVO(); |
| | | vo.setDateTime(TimeUtil.getGernalTime(record.getCreateTime().getTime(), "yyyy.MM.dd HH:mm")); |
| | | if (record.getEventTime() == null) { |
| | | vo.setDateTime(TimeUtil.getGernalTime(record.getCreateTime().getTime(), "yyyy.MM.dd HH:mm")); |
| | | } else { |
| | | vo.setDateTime(TimeUtil.getGernalTime(record.getEventTime().getTime(), "yyyy.MM.dd")); |
| | | } |
| | | vo.setNum(record.getCornNum()); |
| | | vo.setMoney(record.getMoney().setScale(2).toString()); |
| | | vo.setMoney(new BigDecimal(record.getMoney()).divide(new BigDecimal(100), 2, RoundingMode.FLOOR).toString()); |
| | | voList.add(vo); |
| | | } |
| | | |
| | |
| | | return JsonUtil.loadFalseResult("参数不完整"); |
| | | } |
| | | |
| | | try { |
| | | JSONObject data = new JSONObject(); |
| | | GoldCornMakeResultDTO result = null; |
| | | if (vo.getType() == GoldCornGetType.watchVideo) { |
| | | result = goldCornMakeService.watchVideo(uid, vo.getDoubles(), vo.getFinishTime() == null ? new Date() : new Date(vo.getFinishTime()), vo.getTimeSeconds()); |
| | | } else if (vo.getType() == GoldCornGetType.readNovel) { |
| | | result = goldCornMakeService.readNovel(uid, vo.getDoubles() == null ? false : vo.getDoubles(), vo.getFinishTime() == null ? new Date() : new Date(vo.getFinishTime()), vo.getTimeSeconds()); |
| | | } else if (vo.getType() == GoldCornGetType.scanNews) { |
| | | result = goldCornMakeService.scanNews(uid, vo.getDoubles() == null ? false : vo.getDoubles(), vo.getFinishTime() == null ? new Date() : new Date(vo.getFinishTime()), vo.getNum()); |
| | | } else { |
| | | return JsonUtil.loadFalseResult("任务类型出错"); |
| | | } |
| | | data.put("goldCorn", result.getGoldCorn()); |
| | | data.put("leftCount", result.getLeftEventCount()); |
| | | 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()); |
| | | String key = "dotask-" + acceptData.getSign(); |
| | | Jedis jedis = jedisPool.getResource(); |
| | | try { |
| | | if (!StringUtil.isNullOrEmpty(jedis.get(key))) { |
| | | return JsonUtil.loadFalseResult("重复的请求"); |
| | | } |
| | | jedis.set(key, "1"); |
| | | //30分钟有效期 |
| | | jedis.expire(key, 60 * 30); |
| | | |
| | | try { |
| | | JSONObject data = new JSONObject(); |
| | | GoldCornMakeResultDTO result = null; |
| | | if (vo.getType() == GoldCornGetType.watchVideo) { |
| | | result = goldCornMakeService.watchVideo(uid, vo.getDoubles(), vo.getFinishTime() == null ? new Date() : new Date(vo.getFinishTime()), vo.getTimeSeconds()); |
| | | } else if (vo.getType() == GoldCornGetType.readNovel) { |
| | | result = goldCornMakeService.readNovel(uid, vo.getDoubles() == null ? false : vo.getDoubles(), vo.getFinishTime() == null ? new Date() : new Date(vo.getFinishTime()), vo.getTimeSeconds()); |
| | | } else if (vo.getType() == GoldCornGetType.scanNews) { |
| | | result = goldCornMakeService.scanNews(uid, vo.getDoubles() == null ? false : vo.getDoubles(), vo.getFinishTime() == null ? new Date() : new Date(vo.getFinishTime()), vo.getNum()); |
| | | } else { |
| | | return JsonUtil.loadFalseResult("任务类型出错"); |
| | | } |
| | | data.put("goldCorn", result.getGoldCorn()); |
| | | data.put("leftCount", result.getLeftEventCount()); |
| | | 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()); |
| | | } |
| | | } finally { |
| | | jedis.close(); |
| | | } |
| | | } |
| | | |
| | |
| | | e.printStackTrace(); |
| | | } catch (GoldCornMakeException e) { |
| | | e.printStackTrace(); |
| | | finish=false; |
| | | finish = false; |
| | | } |
| | | } else { |
| | | finish = false; |
| | |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | import com.yeshi.makemoney.app.entity.goldcorn.GoldCornConsumeType; |
| | | |
| | | import java.lang.Long; |
| | | import java.util.Date; |
| | | |
| | | import org.yeshi.utils.mongo.MongodbBaseDao; |
| | | |
| | | import java.lang.String; |
| | | import java.lang.Integer; |
| | | |
| | | import com.yeshi.makemoney.app.entity.goldcorn.GoldCornConsumeRecord; |
| | | |
| | | import java.util.ArrayList; |
| | | |
| | | |
| | | @Repository |
| | | public class GoldCornConsumeRecordDao extends MongodbBaseDao<GoldCornConsumeRecord>{ |
| | | public class GoldCornConsumeRecordDao extends MongodbBaseDao<GoldCornConsumeRecord> { |
| | | |
| | | public void updateSelective(GoldCornConsumeRecord bean) { |
| | | public void updateSelective(GoldCornConsumeRecord bean) { |
| | | Query query = new Query(); |
| | | Update update=new Update(); |
| | | Update update = new Update(); |
| | | query.addCriteria(Criteria.where("id").is(bean.getId())); |
| | | if(bean.getUid() != null) { |
| | | if (bean.getUid() != null) { |
| | | update.set("uid", bean.getUid()); |
| | | } |
| | | if(bean.getCornNum() != null) { |
| | | if (bean.getCornNum() != null) { |
| | | update.set("cornNum", bean.getCornNum()); |
| | | } |
| | | if(bean.getType() != null) { |
| | | if (bean.getType() != null) { |
| | | update.set("type", bean.getType()); |
| | | } |
| | | if(bean.getMoney() != null) { |
| | | if (bean.getMoney() != null) { |
| | | update.set("money", bean.getMoney()); |
| | | } |
| | | if(bean.getRemarks() != null) { |
| | | if (bean.getRemarks() != null) { |
| | | update.set("remarks", bean.getRemarks()); |
| | | } |
| | | if(bean.getCreateTime() != null) { |
| | | if (bean.getCreateTime() != null) { |
| | | update.set("createTime", bean.getCreateTime()); |
| | | } |
| | | update.set("updateTime", new Date()); |
| | | update(query, update); |
| | | } |
| | | } |
| | | |
| | | |
| | | public List<GoldCornConsumeRecord> list(DaoQuery daoQuery){ |
| | | public List<GoldCornConsumeRecord> 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.uid!=null){ |
| | | public Criteria getCriteria(DaoQuery daoQuery) { |
| | | List<Criteria> andList = new ArrayList<>(); |
| | | if (daoQuery.uid != null) { |
| | | andList.add(Criteria.where("uid").is(daoQuery.uid)); |
| | | } |
| | | if(daoQuery.type!=null){ |
| | | if (daoQuery.type != null) { |
| | | andList.add(Criteria.where("type").is(daoQuery.type)); |
| | | } |
| | | if(daoQuery.maxCreateTime!=null){ |
| | | if (daoQuery.maxCreateTime != null) { |
| | | andList.add(Criteria.where("createTime").lt(daoQuery.maxCreateTime)); |
| | | } |
| | | if(daoQuery.minCreateTime!=null){ |
| | | if (daoQuery.minCreateTime != null) { |
| | | andList.add(Criteria.where("createTime").gte(daoQuery.minCreateTime)); |
| | | } |
| | | Query query=new Query(); |
| | | Criteria[] ands=new Criteria[andList.size()]; |
| | | |
| | | Criteria[] ands = new Criteria[andList.size()]; |
| | | andList.toArray(ands); |
| | | if(ands.length>0){ |
| | | query.addCriteria(new Criteria().andOperator(ands)); |
| | | if (andList.size() > 0) { |
| | | return new Criteria().andOperator(ands); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | private Query getQuery(DaoQuery daoQuery) { |
| | | Query query = new Query(); |
| | | Criteria criteria = getCriteria(daoQuery); |
| | | if (criteria != null) { |
| | | query.addCriteria(criteria); |
| | | } |
| | | return query; |
| | | } |
| | | } |
| | | |
| | | public static class DaoQuery{ |
| | | public static class DaoQuery { |
| | | public Long uid; |
| | | public GoldCornConsumeType type; |
| | | public Date maxCreateTime; |
| | |
| | | public int start; |
| | | public int count; |
| | | public List<Sort.Order> sortList; |
| | | } |
| | | public String eventId; |
| | | } |
| | | } |
New file |
| | |
| | | package com.yeshi.makemoney.app.dao.goldcorn; |
| | | |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.data.mongodb.core.query.Update; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | import java.lang.Long; |
| | | import java.util.Date; |
| | | import com.yeshi.makemoney.app.entity.goldcorn.GoldCornSettleRecord; |
| | | import org.yeshi.utils.mongo.MongodbBaseDao; |
| | | import java.lang.String; |
| | | import com.yeshi.makemoney.app.entity.SystemEnum; |
| | | import java.util.ArrayList; |
| | | |
| | | |
| | | @Repository |
| | | public class GoldCornSettleRecordDao extends MongodbBaseDao<GoldCornSettleRecord>{ |
| | | |
| | | public void updateSelective(GoldCornSettleRecord bean) { |
| | | Query query = new Query(); |
| | | Update update=new Update(); |
| | | query.addCriteria(Criteria.where("id").is(bean.getId())); |
| | | if(bean.getDay() != null) { |
| | | update.set("day", bean.getDay()); |
| | | } |
| | | if(bean.getSystem() != null) { |
| | | update.set("system", bean.getSystem()); |
| | | } |
| | | if(bean.getRate() != null) { |
| | | update.set("rate", bean.getRate()); |
| | | } |
| | | if(bean.getCornNum() != null) { |
| | | update.set("cornNum", bean.getCornNum()); |
| | | } |
| | | if(bean.getTotalMoney() != null) { |
| | | update.set("totalMoney", bean.getTotalMoney()); |
| | | } |
| | | if(bean.getRemarks() != null) { |
| | | update.set("remarks", bean.getRemarks()); |
| | | } |
| | | if(bean.getCreateTime() != null) { |
| | | update.set("createTime", bean.getCreateTime()); |
| | | } |
| | | update.set("updateTime", new Date()); |
| | | update(query, update); |
| | | } |
| | | |
| | | |
| | | public List<GoldCornSettleRecord> list(DaoQuery daoQuery){ |
| | | Query query = getQuery(daoQuery); |
| | | 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); |
| | | return count(query); |
| | | } |
| | | |
| | | private Query getQuery(DaoQuery daoQuery){ |
| | | List<Criteria> andList=new ArrayList<>(); |
| | | if(daoQuery.day!=null){ |
| | | andList.add(Criteria.where("day").is(daoQuery.day)); |
| | | } |
| | | if(daoQuery.system!=null){ |
| | | andList.add(Criteria.where("system").is(daoQuery.system)); |
| | | } |
| | | if(daoQuery.maxCreateTime!=null){ |
| | | andList.add(Criteria.where("createTime").lt(daoQuery.maxCreateTime)); |
| | | } |
| | | if(daoQuery.minCreateTime!=null){ |
| | | andList.add(Criteria.where("createTime").gte(daoQuery.minCreateTime)); |
| | | } |
| | | Query query=new Query(); |
| | | Criteria[] ands=new Criteria[andList.size()]; |
| | | andList.toArray(ands); |
| | | if(ands.length>0){ |
| | | query.addCriteria(new Criteria().andOperator(ands)); |
| | | } |
| | | return query; |
| | | } |
| | | |
| | | public static class DaoQuery{ |
| | | public String day; |
| | | public SystemEnum system; |
| | | public Date maxCreateTime; |
| | | public Date minCreateTime; |
| | | public int start; |
| | | public int count; |
| | | public List<Sort.Order> sortList; |
| | | } |
| | | } |
| | |
| | | /** |
| | | * ID |
| | | **/ |
| | | private Long adminId; |
| | | private String adminId; |
| | | |
| | | public ExtractTransferResultMQMsg() { |
| | | |
| | | } |
| | | |
| | | public ExtractTransferResultMQMsg(Long extractId, AlipayFundTransUniTransferResponse alipayResult, Long adminId) { |
| | | public ExtractTransferResultMQMsg(Long extractId, AlipayFundTransUniTransferResponse alipayResult, String adminId) { |
| | | this.extractId = extractId; |
| | | this.alipayResult = alipayResult; |
| | | this.adminId = adminId; |
| | | } |
| | | |
| | | public ExtractTransferResultMQMsg(Long extractId, String wxResult, Long adminId) { |
| | | public ExtractTransferResultMQMsg(Long extractId, String wxResult, String adminId) { |
| | | this.extractId = extractId; |
| | | this.wxResult = wxResult; |
| | | this.adminId = adminId; |
| | |
| | | this.wxResult = wxResult; |
| | | } |
| | | |
| | | public Long getAdminId() { |
| | | public String getAdminId() { |
| | | return adminId; |
| | | } |
| | | |
| | | public void setAdminId(Long adminId) { |
| | | public void setAdminId(String adminId) { |
| | | this.adminId = adminId; |
| | | } |
| | | } |
| | |
| | | */ |
| | | public class GoldCornSettleMQMsg { |
| | | |
| | | private String settleId; |
| | | private Long uid; |
| | | private String day; |
| | | private long createTime; |
| | |
| | | } |
| | | |
| | | |
| | | public GoldCornSettleMQMsg(Long uid, String day, long createTime) { |
| | | public GoldCornSettleMQMsg(String settleId, Long uid, String day, long createTime) { |
| | | this.settleId = settleId; |
| | | this.uid = uid; |
| | | this.day = day; |
| | | this.createTime = createTime; |
| | |
| | | public void setCreateTime(long createTime) { |
| | | this.createTime = createTime; |
| | | } |
| | | |
| | | public String getSettleId() { |
| | | return settleId; |
| | | } |
| | | |
| | | public void setSettleId(String settleId) { |
| | | this.settleId = settleId; |
| | | } |
| | | } |
| | |
| | | |
| | | private String name; |
| | | |
| | | /** |
| | | * 邮箱 |
| | | **/ |
| | | private String email; |
| | | |
| | | private Date createTime; |
| | | |
| | | |
| | | public String getEmail() { |
| | | return email; |
| | | } |
| | | |
| | | public void setEmail(String email) { |
| | | this.email = email; |
| | | } |
| | | |
| | | public String getAccount() { |
| | | return account; |
| | | } |
| | |
| | | tencentSMSAppKey(SystemConfigType.system, "腾讯云短信APPKey"), |
| | | tencentVerifySMSTemplate(SystemConfigType.system, "腾讯云验证码短信模板"), |
| | | testAccount(SystemConfigType.system, "测试账号"), |
| | | emailSender(SystemConfigType.system, "发送邮件的账号与密码"), |
| | | appLink(SystemConfigType.system, "应用二合一链接"), |
| | | androidPushAppCode(SystemConfigType.system, "android推送应用编码"), |
| | | androidPushActivity(SystemConfigType.system, "android推送落地页Activity"), |
| | |
| | | /** |
| | | * 兑换的人民币(当兑换类型为人民币时有效) |
| | | */ |
| | | private BigDecimal money; |
| | | private Long money; |
| | | |
| | | private String remarks; |
| | | |
| | | /** |
| | | * 事件时间 |
| | | */ |
| | | private Date eventTime; |
| | | |
| | | /** |
| | | * 事件ID |
| | | */ |
| | | private String eventId; |
| | | |
| | | |
| | | @Indexed |
| | | private Date createTime; |
| | | private Date updateTime; |
| | | |
| | | public String toId() { |
| | | public String toId() { |
| | | return uid + "-" + type.name() + "-" + createTime.getTime(); |
| | | } |
| | | |
| | |
| | | this.type = type; |
| | | } |
| | | |
| | | public BigDecimal getMoney() { |
| | | public Long getMoney() { |
| | | return money; |
| | | } |
| | | |
| | | public void setMoney(BigDecimal money) { |
| | | public void setMoney(Long money) { |
| | | this.money = money; |
| | | } |
| | | |
| | |
| | | public void setUpdateTime(Date updateTime) { |
| | | this.updateTime = updateTime; |
| | | } |
| | | |
| | | public Date getEventTime() { |
| | | return eventTime; |
| | | } |
| | | |
| | | public void setEventTime(Date eventTime) { |
| | | this.eventTime = eventTime; |
| | | } |
| | | |
| | | public String getEventId() { |
| | | return eventId; |
| | | } |
| | | |
| | | public void setEventId(String eventId) { |
| | | this.eventId = eventId; |
| | | } |
| | | } |
| | |
| | | package com.yeshi.makemoney.app.entity.goldcorn; |
| | | |
| | | import com.yeshi.makemoney.app.entity.SystemEnum; |
| | | import org.springframework.data.annotation.Id; |
| | | import org.springframework.data.mongodb.core.index.Indexed; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | |
| | | @Indexed |
| | | private String day; |
| | | private Integer cornNum; |
| | | |
| | | private SystemEnum system; |
| | | |
| | | /** |
| | | * 时间数量(单位为次/个/秒) |
| | |
| | | return st; |
| | | } |
| | | |
| | | public SystemEnum getSystem() { |
| | | return system; |
| | | } |
| | | |
| | | public void setSystem(SystemEnum system) { |
| | | this.system = system; |
| | | } |
| | | |
| | | public String getId() { |
| | | return id; |
New file |
| | |
| | | package com.yeshi.makemoney.app.entity.goldcorn; |
| | | |
| | | import com.yeshi.makemoney.app.entity.SystemEnum; |
| | | import org.springframework.data.annotation.Id; |
| | | import org.springframework.data.mongodb.core.index.Indexed; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | import javax.validation.constraints.NotEmpty; |
| | | import javax.validation.constraints.NotNull; |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author hxh |
| | | * @title: GoldCornSettleRecord |
| | | * @description: 金币结算记录 |
| | | * @date 2022/5/10 15:31 |
| | | */ |
| | | @Document(collection = "goldCornSettleRecord") |
| | | public class GoldCornSettleRecord { |
| | | |
| | | @Id |
| | | private String id; |
| | | /** |
| | | * 结算日期 |
| | | **/ |
| | | @NotEmpty(message = "日期不能为空") |
| | | @Indexed |
| | | private String day; |
| | | /** |
| | | * 系统 |
| | | **/ |
| | | @NotNull(message = "系统不能为空") |
| | | private SystemEnum system; |
| | | |
| | | /** |
| | | * 汇率1金币兑换的人命币数量 |
| | | **/ |
| | | private BigDecimal rate; |
| | | |
| | | /** |
| | | * 总共的金币数量 |
| | | **/ |
| | | private Long cornNum; |
| | | |
| | | /** |
| | | * 总共兑换的资金 |
| | | **/ |
| | | private BigDecimal totalMoney; |
| | | |
| | | /** |
| | | * 备注 |
| | | **/ |
| | | private String remarks; |
| | | |
| | | private Date createTime; |
| | | |
| | | private Date updateTime; |
| | | |
| | | public String toId() { |
| | | return day + "-" + system.name(); |
| | | } |
| | | |
| | | |
| | | public String getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(String id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getDay() { |
| | | return day; |
| | | } |
| | | |
| | | public void setDay(String day) { |
| | | this.day = day; |
| | | } |
| | | |
| | | public SystemEnum getSystem() { |
| | | return system; |
| | | } |
| | | |
| | | public void setSystem(SystemEnum system) { |
| | | this.system = system; |
| | | } |
| | | |
| | | public BigDecimal getRate() { |
| | | return rate; |
| | | } |
| | | |
| | | public void setRate(BigDecimal rate) { |
| | | this.rate = rate; |
| | | } |
| | | |
| | | public Long getCornNum() { |
| | | return cornNum; |
| | | } |
| | | |
| | | public void setCornNum(Long cornNum) { |
| | | this.cornNum = cornNum; |
| | | } |
| | | |
| | | public BigDecimal getTotalMoney() { |
| | | return totalMoney; |
| | | } |
| | | |
| | | public void setTotalMoney(BigDecimal totalMoney) { |
| | | this.totalMoney = totalMoney; |
| | | } |
| | | |
| | | public Date getCreateTime() { |
| | | return createTime; |
| | | } |
| | | |
| | | public void setCreateTime(Date createTime) { |
| | | this.createTime = createTime; |
| | | } |
| | | |
| | | public Date getUpdateTime() { |
| | | return updateTime; |
| | | } |
| | | |
| | | public void setUpdateTime(Date updateTime) { |
| | | this.updateTime = updateTime; |
| | | } |
| | | |
| | | public String getRemarks() { |
| | | return remarks; |
| | | } |
| | | |
| | | public void setRemarks(String remarks) { |
| | | this.remarks = remarks; |
| | | } |
| | | } |
New file |
| | |
| | | package com.yeshi.makemoney.app.exception.goldcorn; |
| | | |
| | | import com.ks.lib.common.exception.BaseException; |
| | | |
| | | public class GoldCornSettleRecordException extends BaseException{ |
| | | |
| | | public GoldCornSettleRecordException(int code, String msg) { |
| | | super(code, msg); |
| | | } |
| | | |
| | | } |
| | |
| | | import javax.annotation.Resource; |
| | | |
| | | import com.yeshi.makemoney.app.exception.goldcorn.GoldCornConsumeRecordException; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.data.mongodb.core.aggregation.Aggregation; |
| | | import org.springframework.data.mongodb.core.aggregation.AggregationOperation; |
| | | import org.springframework.data.mongodb.core.aggregation.AggregationResults; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Date; |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.util.*; |
| | | |
| | | import org.yeshi.utils.StringUtil; |
| | | import org.yeshi.utils.TimeUtil; |
| | | import org.yeshi.utils.bean.BeanUtil; |
| | | |
| | | import java.util.List; |
| | | |
| | | import com.yeshi.makemoney.app.dao.goldcorn.GoldCornConsumeRecordDao; |
| | | import com.yeshi.makemoney.app.entity.goldcorn.GoldCornConsumeRecord; |
| | |
| | | @Resource |
| | | private GoldCornConsumeRecordDao goldCornConsumeRecordDao; |
| | | |
| | | @Override |
| | | public List<GoldCornConsumeRecord> list(GoldCornConsumeRecordQuery goldCornConsumeRecordQuery, int page, int pageSize) { |
| | | private DaoQuery createDaoQuery(GoldCornConsumeRecordQuery goldCornConsumeRecordQuery) { |
| | | DaoQuery daoQuery = new DaoQuery(); |
| | | daoQuery.type = goldCornConsumeRecordQuery.getType(); |
| | | daoQuery.uid = goldCornConsumeRecordQuery.getUid(); |
| | | daoQuery.minCreateTime = goldCornConsumeRecordQuery.toStartTime(); |
| | | daoQuery.maxCreateTime = goldCornConsumeRecordQuery.toEndTime(); |
| | | daoQuery.sortList = Arrays.asList(new Sort.Order[]{Sort.Order.desc("createTime")}); |
| | | daoQuery.eventId = goldCornConsumeRecordQuery.getEventId(); |
| | | return daoQuery; |
| | | } |
| | | |
| | | @Override |
| | | public List<GoldCornConsumeRecord> list(GoldCornConsumeRecordQuery goldCornConsumeRecordQuery, int page, int pageSize) { |
| | | DaoQuery daoQuery = createDaoQuery(goldCornConsumeRecordQuery); |
| | | daoQuery.start = (page - 1) * pageSize; |
| | | daoQuery.count = pageSize; |
| | | return goldCornConsumeRecordDao.list(daoQuery); |
| | |
| | | |
| | | @Override |
| | | public long count(GoldCornConsumeRecordQuery goldCornConsumeRecordQuery) { |
| | | DaoQuery daoQuery = new DaoQuery(); |
| | | daoQuery.type = goldCornConsumeRecordQuery.getType(); |
| | | daoQuery.uid = goldCornConsumeRecordQuery.getUid(); |
| | | daoQuery.minCreateTime = goldCornConsumeRecordQuery.toStartTime(); |
| | | daoQuery.maxCreateTime = goldCornConsumeRecordQuery.toEndTime(); |
| | | DaoQuery daoQuery = createDaoQuery(goldCornConsumeRecordQuery); |
| | | return goldCornConsumeRecordDao.count(daoQuery); |
| | | } |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public BigDecimal sumMoney(GoldCornConsumeRecordQuery query) { |
| | | Criteria criteria = goldCornConsumeRecordDao.getCriteria(createDaoQuery(query)); |
| | | List<AggregationOperation> list = new ArrayList<>(); |
| | | if (criteria != null) { |
| | | list.add(Aggregation.match(criteria)); |
| | | } |
| | | list.add(Aggregation.project("money")); |
| | | |
| | | list.add(Aggregation.group().sum("money").as("money")); |
| | | AggregationResults<Map> results = goldCornConsumeRecordDao.aggregate(list, Map.class); |
| | | Object money = results.getUniqueMappedResult().get("money"); |
| | | return money == null ? new BigDecimal(0) : new BigDecimal(money + "").divide(new BigDecimal(100), 2, RoundingMode.FLOOR); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | |
| | | import com.yeshi.makemoney.app.dao.goldcorn.GoldCornGetRecordDao; |
| | | import com.yeshi.makemoney.app.dao.goldcorn.GoldCornGetRecordDao.DaoQuery; |
| | | import com.yeshi.makemoney.app.entity.SystemEnum; |
| | | import com.yeshi.makemoney.app.entity.goldcorn.GoldCornGetRecord; |
| | | import com.yeshi.makemoney.app.entity.goldcorn.GoldCornGetType; |
| | | import com.yeshi.makemoney.app.exception.goldcorn.GoldCornGetRecordException; |
| | |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.stereotype.Service; |
| | | import org.yeshi.utils.TimeUtil; |
| | | import org.yeshi.utils.statistic.BaseStatisticTimeQuery; |
| | | import org.yeshi.utils.statistic.StatisticNumberResult; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.*; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public Map<String, Long> sumGoldCornNum(GoldCornGetRecordQuery goldCornGetRecordQuery) { |
| | | |
| | | List<AggregationOperation> list = new ArrayList<>(); |
| | | list.add(Aggregation.match(goldCornGetRecordDao.getCriteria(createDaoQuery(goldCornGetRecordQuery)))); |
| | | list.add(Aggregation.group("day").sum("cornNum").as("cornNum")); |
| | | AggregationResults<Map<String, Object>> results = goldCornGetRecordDao.aggregate(list, Map.class); |
| | | List<Map<String, Object>> resultList = results.getMappedResults(); |
| | | Map<String, Long> resultMap = new HashMap<>(); |
| | | for (Map<String, Object> result : resultList) { |
| | | String day = result.get("_id") + ""; |
| | | Long count = Long.parseLong(result.get("cornNum") + ""); |
| | | resultMap.put(day, count); |
| | | } |
| | | return resultMap; |
| | | } |
| | | |
| | | @Override |
| | | public List<Long> listUids(Date minCreateTime, Date maxCreateTime, int page, int pageSize) { |
| | | List<AggregationOperation> list = new ArrayList<>(); |
| | | list.add(Aggregation.match(Criteria.where("createTime").gte(minCreateTime).lt(maxCreateTime))); |
| | | list.add(Aggregation.group("uid")); |
| | | list.add(Aggregation.sort(Sort.Direction.DESC,"_id")); |
| | | list.add(Aggregation.sort(Sort.Direction.DESC, "_id")); |
| | | list.add(Aggregation.skip(Long.parseLong((page - 1) * pageSize + ""))); |
| | | list.add(Aggregation.limit(pageSize)); |
| | | AggregationResults<Map<String, Object>> results = goldCornGetRecordDao.aggregate(list, Map.class); |
| | |
| | | return uidList.stream().collect(Collectors.toMap(uid -> uid, uid -> signInedList.contains(uid))); |
| | | } |
| | | |
| | | @Override |
| | | public List<StatisticNumberResult> statistic(SystemEnum system, BaseStatisticTimeQuery query) { |
| | | GoldCornGetRecordQuery q = new GoldCornGetRecordQuery(); |
| | | q.setStartTime(TimeUtil.getGernalTime(query.getStartTime().getTime(), "yyyy.MM.dd HH:mm:ss")); |
| | | q.setEndTime(TimeUtil.getGernalTime(query.getEndTime().getTime(), "yyyy.MM.dd HH:mm:ss")); |
| | | q.setFormat("yyyy.MM.dd HH:mm:ss"); |
| | | Map<String, Long> map = sumGoldCornNum(q); |
| | | List<StatisticNumberResult> resultList = new ArrayList<>(); |
| | | for (String key : map.keySet()) { |
| | | StatisticNumberResult numberResult = new StatisticNumberResult(); |
| | | numberResult.setTime(key); |
| | | numberResult.setNumber(map.get(key)); |
| | | resultList.add(numberResult); |
| | | } |
| | | |
| | | Comparator<StatisticNumberResult> cm = (o1, o2) -> |
| | | GoldCornUtil.convertFormatDay(o1.getTime()).getTime() - GoldCornUtil.convertFormatDay(o2.getTime()).getTime() > 0 ? 1 : -1; |
| | | |
| | | Collections.sort(resultList, cm); |
| | | return resultList; |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | record.setDay(TimeUtil.getGernalTime(currentTime.getTime(), "yyyy-MM-dd")); |
| | | record.setType(type); |
| | | record.setUid(uid); |
| | | record.setSystem(user.getSystem()); |
| | | record.setLevel(GoldCornGetRecord.LEVEL_OWN); |
| | | record.setCreateTime(currentTime); |
| | | record.setEventCount(eventCount); |
| | |
| | | if (isDouble) { |
| | | recordD = new GoldCornGetRecord(); |
| | | recordD.setCornNum(baseCornNum); |
| | | record.setSystem(user.getSystem()); |
| | | recordD.setDay(TimeUtil.getGernalTime(currentTime.getTime(), "yyyy-MM-dd")); |
| | | recordD.setType(type); |
| | | recordD.setUid(uid); |
| | |
| | | cRecord.setDay(record.getDay()); |
| | | cRecord.setType(type); |
| | | cRecord.setUid(bossUid); |
| | | record.setSystem(user.getSystem()); |
| | | cRecord.setCornNum(new BigDecimal(baseCornNum).multiply(rate).intValue()); |
| | | cRecord.setFromId(record.getId()); |
| | | cRecord.setFromUid(record.getUid()); |
| | |
| | | if (count == 0L) { |
| | | continue; |
| | | } |
| | | //获取兑换记录的主键ID |
| | | GoldCornConsumeRecord record = GoldCornConsumeRecordFactory.createExchange(uid, GoldCornUtil.getFormatDay(date), 0, new BigDecimal(0.1)); |
| | | //获取兑换记录的主键ID,不需要多余的数据 |
| | | GoldCornConsumeRecord record = GoldCornConsumeRecordFactory.createExchange(uid, GoldCornUtil.getFormatDay(date), 0, new BigDecimal(0.1),null); |
| | | //查询资金记录是否有该记录 |
| | | try { |
| | | UserMoneyRecord userMoneyRecord = UserMoneyRecordFactory.createGoldCornExchange(record); |
New file |
| | |
| | | package com.yeshi.makemoney.app.service.impl.goldcorn; |
| | | |
| | | import java.lang.Exception; |
| | | import javax.annotation.Resource; |
| | | import javax.validation.Valid; |
| | | |
| | | import com.ks.lib.common.exception.ParamsException; |
| | | import com.yeshi.makemoney.app.exception.goldcorn.GoldCornSettleRecordException; |
| | | import com.yeshi.makemoney.app.utils.ValidatorUtils; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Arrays; |
| | | import java.util.Date; |
| | | |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.yeshi.utils.StringUtil; |
| | | import org.yeshi.utils.bean.BeanUtil; |
| | | |
| | | import java.util.List; |
| | | |
| | | import com.yeshi.makemoney.app.dao.goldcorn.GoldCornSettleRecordDao; |
| | | import com.yeshi.makemoney.app.entity.goldcorn.GoldCornSettleRecord; |
| | | import com.yeshi.makemoney.app.service.inter.goldcorn.GoldCornSettleRecordService; |
| | | import com.yeshi.makemoney.app.service.query.goldcorn.GoldCornSettleRecordQuery; |
| | | import com.yeshi.makemoney.app.dao.goldcorn.GoldCornSettleRecordDao.DaoQuery; |
| | | |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | |
| | | @Service |
| | | public class GoldCornSettleRecordServiceImpl implements GoldCornSettleRecordService { |
| | | |
| | | @Resource |
| | | private GoldCornSettleRecordDao goldCornSettleRecordDao; |
| | | |
| | | @Override |
| | | public List<GoldCornSettleRecord> list(GoldCornSettleRecordQuery goldCornSettleRecordQuery, int page, int pageSize) { |
| | | DaoQuery daoQuery = new DaoQuery(); |
| | | daoQuery.day = goldCornSettleRecordQuery.getDay(); |
| | | daoQuery.sortList = Arrays.asList(new Sort.Order[]{Sort.Order.desc("createTime")}); |
| | | daoQuery.start = (page - 1) * pageSize; |
| | | daoQuery.count = pageSize; |
| | | return goldCornSettleRecordDao.list(daoQuery); |
| | | } |
| | | |
| | | @Override |
| | | public long count(GoldCornSettleRecordQuery goldCornSettleRecordQuery) { |
| | | DaoQuery daoQuery = new DaoQuery(); |
| | | daoQuery.day = goldCornSettleRecordQuery.getDay(); |
| | | return goldCornSettleRecordDao.count(daoQuery); |
| | | } |
| | | |
| | | @Override |
| | | public GoldCornSettleRecord get(String id) { |
| | | Query query = new Query(); |
| | | query.addCriteria(Criteria.where("_id").is(id)); |
| | | return goldCornSettleRecordDao.findOne(query); |
| | | } |
| | | |
| | | @Override |
| | | public void add(GoldCornSettleRecord goldCornSettleRecord) throws ParamsException, GoldCornSettleRecordException { |
| | | ValidatorUtils.validateEntity(goldCornSettleRecord); |
| | | |
| | | if (goldCornSettleRecord.getId() == null) { |
| | | goldCornSettleRecord.setId(goldCornSettleRecord.toId()); |
| | | } |
| | | |
| | | //查询主键ID是否存在 |
| | | if (goldCornSettleRecordDao.get(goldCornSettleRecord.getId()) != null) { |
| | | throw new GoldCornSettleRecordException(GoldCornSettleRecordException.CODE_EXIST, "已存在"); |
| | | } |
| | | |
| | | if (goldCornSettleRecord.getCreateTime() == null) { |
| | | goldCornSettleRecord.setCreateTime(new Date()); |
| | | } |
| | | //保存 |
| | | goldCornSettleRecordDao.save(goldCornSettleRecord); |
| | | } |
| | | |
| | | @Override |
| | | public void update(GoldCornSettleRecord goldCornSettleRecord) { |
| | | if (goldCornSettleRecord.getUpdateTime() == null) { |
| | | goldCornSettleRecord.setUpdateTime(new Date()); |
| | | } |
| | | //更新 |
| | | goldCornSettleRecordDao.updateSelective(goldCornSettleRecord); |
| | | } |
| | | |
| | | @Override |
| | | public void delete(List<String> idList) { |
| | | for (String id : idList) { |
| | | goldCornSettleRecordDao.delete(id); |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | import com.ks.lib.common.exception.ParamsException; |
| | | import com.ks.push.exception.BPushTaskException; |
| | | import com.yeshi.makemoney.app.dto.mq.GoldCornSettleMQMsg; |
| | | import com.yeshi.makemoney.app.entity.SystemEnum; |
| | | import com.yeshi.makemoney.app.entity.goldcorn.GoldCornConsumeRecord; |
| | | import com.yeshi.makemoney.app.entity.goldcorn.GoldCornConsumeType; |
| | | import com.yeshi.makemoney.app.entity.goldcorn.GoldCornSettleRecord; |
| | | import com.yeshi.makemoney.app.entity.money.UserMoneyRecord; |
| | | import com.yeshi.makemoney.app.entity.user.UserInfo; |
| | | import com.yeshi.makemoney.app.exception.goldcorn.GoldCornConsumeRecordException; |
| | | import com.yeshi.makemoney.app.exception.goldcorn.GoldCornMoneyExchangeRateRecordException; |
| | | import com.yeshi.makemoney.app.exception.goldcorn.GoldCornSettleRecordException; |
| | | import com.yeshi.makemoney.app.exception.money.UserMoneyRecordException; |
| | | import com.yeshi.makemoney.app.exception.user.UserInfoException; |
| | | import com.yeshi.makemoney.app.service.inter.goldcorn.GoldCornConsumeRecordService; |
| | | import com.yeshi.makemoney.app.service.inter.goldcorn.GoldCornGetRecordService; |
| | | 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.goldcorn.*; |
| | | 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.manager.PushManager; |
| | | import com.yeshi.makemoney.app.service.query.goldcorn.GoldCornGetRecordQuery; |
| | | 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 java.math.RoundingMode; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author hxh |
| | |
| | | @Resource |
| | | private PushManager pushManager; |
| | | |
| | | @Resource |
| | | private GoldCornSettleRecordService goldCornSettleRecordService; |
| | | |
| | | @Override |
| | | public void startSettle(Date date) { |
| | | public void startSettle(Date date, String remarks, SystemEnum system) throws GoldCornSettleRecordException, ParamsException { |
| | | String day = GoldCornUtil.getFormatDay(date); |
| | | |
| | | if (GoldCornUtil.convertFormatDay(day).getTime() >= GoldCornUtil.convertFormatDay(GoldCornUtil.getFormatDay(new Date())).getTime()) { |
| | | throw new ParamsException(ParamsException.CODE_PARAMS_NOT_ENOUGH, "只能结算今天以前的日期"); |
| | | } |
| | | |
| | | BigDecimal rate = goldCornMoneyExchangeRateRecordService.getRate(day, system, new Date()); |
| | | if (rate == null) { |
| | | throw new ParamsException(ParamsException.CODE_PARAMS_NOT_ENOUGH, "汇率为空"); |
| | | } |
| | | |
| | | //统计金币数量 |
| | | GoldCornGetRecordQuery query = new GoldCornGetRecordQuery(); |
| | | query.setDay(day); |
| | | Map<String, Long> numMap = goldCornGetRecordService.sumGoldCornNum(query); |
| | | if (numMap.get(day) == null) { |
| | | throw new ParamsException(ParamsException.CODE_PARAMS_NOT_ENOUGH, "金币数量统计出错"); |
| | | } |
| | | |
| | | |
| | | GoldCornSettleRecord record = new GoldCornSettleRecord(); |
| | | record.setSystem(system); |
| | | record.setDay(day); |
| | | record.setRate(rate); |
| | | record.setCornNum(numMap.get(day)); |
| | | record.setTotalMoney(new BigDecimal(0)); |
| | | |
| | | goldCornSettleRecordService.add(record); |
| | | |
| | | long count = goldCornGetRecordService.countUidsByDay(day); |
| | | int pageSize = 1000; |
| | | int page = (int) (count % pageSize == 0 ? count / pageSize : count / pageSize + 1); |
| | |
| | | List<Long> list = goldCornGetRecordService.getUidsByDay(day, i + 1, pageSize); |
| | | for (Long uid : list) { |
| | | //加入到CMQ |
| | | CMQManager.getInstance().addGoldCornSettleMsg(new GoldCornSettleMQMsg(uid, day, System.currentTimeMillis())); |
| | | CMQManager.getInstance().addGoldCornSettleMsg(new GoldCornSettleMQMsg(record.getId(), uid, day, System.currentTimeMillis())); |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Override |
| | | public void settle(Long uid, String day, BigDecimal rate) throws GoldCornConsumeRecordException, UserMoneyRecordException { |
| | | public void settle(Long uid, String day, BigDecimal rate, String settleId) throws GoldCornConsumeRecordException, UserMoneyRecordException { |
| | | long cornNum = goldCornGetRecordService.getGoldCornByDay(uid, GoldCornUtil.convertFormatDay(day)); |
| | | //金币数量 |
| | | GoldCornConsumeRecord record = GoldCornConsumeRecordFactory.createExchange(uid, day, (int) cornNum, rate); |
| | | GoldCornConsumeRecord record = GoldCornConsumeRecordFactory.createExchange(uid, day, (int) cornNum, rate, settleId); |
| | | try { |
| | | UserMoneyRecord moneyRecord = UserMoneyRecordFactory.createGoldCornExchange(record); |
| | | userMoneyService.addUserMoney(moneyRecord); |
| | |
| | | if (user == null) { |
| | | return; |
| | | } |
| | | pushManager.pushGoldCornSettle(user.getSystem(), record.getUid(), Math.abs(record.getCornNum()), record.getMoney()); |
| | | pushManager.pushGoldCornSettle(user.getSystem(), record.getUid(), Math.abs(record.getCornNum()), new BigDecimal(record.getMoney()).divide(new BigDecimal(100), 2, RoundingMode.FLOOR)); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public void settle(Long uid, String day) throws UserInfoException, GoldCornMoneyExchangeRateRecordException, UserMoneyRecordException, GoldCornConsumeRecordException { |
| | | public void settle(Long uid, String day, String settleId) throws UserInfoException, GoldCornMoneyExchangeRateRecordException, UserMoneyRecordException, GoldCornConsumeRecordException { |
| | | UserInfo user = userInfoService.get(uid); |
| | | if (user == null) { |
| | | throw new UserInfoException(UserInfoException.CODE_NOT_EXIST, "用户不存在"); |
| | |
| | | throw new GoldCornMoneyExchangeRateRecordException(GoldCornMoneyExchangeRateRecordException.CODE_NOT_EXIST, "未获取到汇率"); |
| | | } |
| | | |
| | | settle(uid, day, rate); |
| | | settle(uid, day, rate, settleId); |
| | | } |
| | | } |
| | |
| | | public List<Extract> list(ExtractQuery extractQuery, int page, int pageSize) { |
| | | DaoQuery daoQuery = new DaoQuery(); |
| | | daoQuery.uid = extractQuery.getUid(); |
| | | daoQuery.state = extractQuery.getState(); |
| | | daoQuery.minCreateTime = extractQuery.toStartTime(); |
| | | daoQuery.maxCreateTime = extractQuery.toEndTime(); |
| | | daoQuery.sortList = Arrays.asList(new String[]{"create_time desc"}); |
| | |
| | | public long count(ExtractQuery extractQuery) { |
| | | DaoQuery daoQuery = new DaoQuery(); |
| | | daoQuery.uid = extractQuery.getUid(); |
| | | daoQuery.state = extractQuery.getState(); |
| | | daoQuery.minCreateTime = extractQuery.toStartTime(); |
| | | daoQuery.maxCreateTime = extractQuery.toEndTime(); |
| | | return extractMapper.count(daoQuery); |
| | |
| | | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Override |
| | | public void passExtract(Long id, Long adminId) throws ExtractException { |
| | | public void passExtract(Long id, String adminId) throws ExtractException { |
| | | Extract extract = extractMapper.selectByPrimaryKeyForUpdate(id); |
| | | if (extract == null) { |
| | | throw new ExtractException(ExtractException.CODE_NOT_EXIST, "提现记录不存在"); |
| | |
| | | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Override |
| | | public void rejectExtract(Long id, Long adminId, String reason) throws ExtractException, UserMoneyBalanceException, ParamsException { |
| | | public void rejectExtract(Long id, String adminId, String reason) throws ExtractException, UserMoneyBalanceException, ParamsException { |
| | | Extract extract = extractMapper.selectByPrimaryKeyForUpdate(id); |
| | | if (extract == null) { |
| | | throw new ExtractException(ExtractException.CODE_NOT_EXIST, "提现记录不存在"); |
| | |
| | | * @param extract |
| | | * @param adminId |
| | | */ |
| | | private void transferByAlipay(Extract extract, Long adminId) { |
| | | private void transferByAlipay(Extract extract, String adminId) { |
| | | //获取用户的系统 |
| | | UserInfo user = userInfoService.get(extract.getUser().getId()); |
| | | String appName = user.getSystem().getName(); |
| | |
| | | } |
| | | } |
| | | |
| | | private void transferByWX(Extract extract, Long adminId, String wxAPPId) { |
| | | private void transferByWX(Extract extract, String adminId, String wxAPPId) { |
| | | //获取用户的系统 |
| | | UserInfo user = userInfoService.get(extract.getUser().getId()); |
| | | String appName = user.getSystem().getName(); |
| | |
| | | import com.yeshi.makemoney.app.exception.goldcorn.GoldCornConsumeRecordException; |
| | | import com.yeshi.makemoney.app.service.query.goldcorn.GoldCornConsumeRecordQuery; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | |
| | |
| | | */ |
| | | public void delete(List<String> idList) ; |
| | | |
| | | /** |
| | | * @author hxh |
| | | * @description 计算资金 |
| | | * @date 18:06 2022/5/10 |
| | | * @param: query |
| | | * @return java.math.BigDecimal |
| | | **/ |
| | | public BigDecimal sumMoney(GoldCornConsumeRecordQuery query); |
| | | |
| | | |
| | | } |
| | |
| | | import com.yeshi.makemoney.app.entity.goldcorn.GoldCornGetType; |
| | | import com.yeshi.makemoney.app.exception.goldcorn.GoldCornGetRecordException; |
| | | import com.yeshi.makemoney.app.service.query.goldcorn.GoldCornGetRecordQuery; |
| | | import org.yeshi.utils.statistic.BaseStatisticTimeQuery; |
| | | import org.yeshi.utils.statistic.StatisticNumberResult; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | |
| | | |
| | | |
| | | /** |
| | | * @return java.util.Map<java.lang.Long , java.math.BigDecimal> |
| | | * @return java.util.Map<java.lang.Long , java.math.BigDecimal> |
| | | * @author hxh |
| | | * @description 统计FromUid产生的金币数量 |
| | | * @date 15:36 2022/4/8 |
| | |
| | | |
| | | |
| | | /** |
| | | * @author hxh |
| | | * @description 统计金币数量 |
| | | * @date 14:59 2022/5/10 |
| | | * @param: goldCornGetRecordQuery |
| | | * @return java.util.Map<java.lang.String,java.lang.Long> |
| | | **/ |
| | | public Map<String, Long> sumGoldCornNum(GoldCornGetRecordQuery goldCornGetRecordQuery); |
| | | |
| | | |
| | | /** |
| | | * @return java.util.List<java.lang.Long> |
| | | * @author hxh |
| | | * @description 获取活跃用户列表 |
| | |
| | | |
| | | |
| | | /** |
| | | * @return java.util.List<java.util.Map < java.lang.Long , java.lang.Boolean>> |
| | | * @return java.util.List<java.util.Map < java.lang.Long , java.lang.Boolean>> |
| | | * @author hxh |
| | | * @description 批量查询用户是否签到 |
| | | * @date 18:42 2022/5/7 |
| | |
| | | **/ |
| | | public Map<Long, Boolean> isSignIned(List<Long> uidList, String day); |
| | | |
| | | /** |
| | | * @return org.yeshi.utils.statistic.StatisticNumberResult |
| | | * @author hxh |
| | | * @description 统计 |
| | | * @date 14:55 2022/5/10 |
| | | * @param: system |
| | | * @param: query |
| | | **/ |
| | | public List<StatisticNumberResult> statistic(SystemEnum system, BaseStatisticTimeQuery query); |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.makemoney.app.service.inter.goldcorn; |
| | | |
| | | import com.ks.lib.common.exception.ParamsException; |
| | | import com.yeshi.makemoney.app.entity.goldcorn.GoldCornSettleRecord; |
| | | import com.yeshi.makemoney.app.exception.goldcorn.GoldCornSettleRecordException; |
| | | import com.yeshi.makemoney.app.service.query.goldcorn.GoldCornSettleRecordQuery; |
| | | |
| | | import java.util.List; |
| | | |
| | | |
| | | public interface GoldCornSettleRecordService { |
| | | |
| | | /** |
| | | * 获取列表 |
| | | * @param goldCornSettleRecordQuery |
| | | * @param page |
| | | * @param pageSize |
| | | * @return |
| | | */ |
| | | public List<GoldCornSettleRecord> list(GoldCornSettleRecordQuery goldCornSettleRecordQuery, int page, int pageSize) ; |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | public long count(GoldCornSettleRecordQuery goldCornSettleRecordQuery) ; |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | public GoldCornSettleRecord get(String id) ; |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | public void add(GoldCornSettleRecord goldCornSettleRecord) throws ParamsException, GoldCornSettleRecordException; |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | public void update(GoldCornSettleRecord goldCornSettleRecord) ; |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | public void delete(List<String> idList) ; |
| | | |
| | | |
| | | } |
| | |
| | | package com.yeshi.makemoney.app.service.inter.goldcorn; |
| | | |
| | | import com.ks.lib.common.exception.ParamsException; |
| | | import com.yeshi.makemoney.app.entity.SystemEnum; |
| | | import com.yeshi.makemoney.app.exception.goldcorn.GoldCornConsumeRecordException; |
| | | import com.yeshi.makemoney.app.exception.goldcorn.GoldCornMoneyExchangeRateRecordException; |
| | | import com.yeshi.makemoney.app.exception.goldcorn.GoldCornSettleRecordException; |
| | | import com.yeshi.makemoney.app.exception.money.UserMoneyRecordException; |
| | | import com.yeshi.makemoney.app.exception.user.UserInfoException; |
| | | |
| | |
| | | * @date 11:46 2022/4/7 |
| | | * @param: day |
| | | **/ |
| | | public void startSettle(Date day); |
| | | public void startSettle(Date day, String remarks, SystemEnum system) throws GoldCornSettleRecordException, ParamsException; |
| | | |
| | | |
| | | /** |
| | |
| | | * @param: day |
| | | * @param: rate 汇率 |
| | | **/ |
| | | public void settle(Long uid, String day, BigDecimal rate) throws GoldCornConsumeRecordException, UserMoneyRecordException; |
| | | public void settle(Long uid, String day, BigDecimal rate,String settleId) throws GoldCornConsumeRecordException, UserMoneyRecordException; |
| | | |
| | | |
| | | /** |
| | |
| | | * @param: uid |
| | | * @param: day |
| | | **/ |
| | | public void settle(Long uid, String day) throws UserInfoException, GoldCornMoneyExchangeRateRecordException, UserMoneyRecordException, GoldCornConsumeRecordException; |
| | | public void settle(Long uid, String day,String settleId) throws UserInfoException, GoldCornMoneyExchangeRateRecordException, UserMoneyRecordException, GoldCornConsumeRecordException; |
| | | |
| | | |
| | | } |
| | |
| | | * @param: id |
| | | * @param: adminId |
| | | **/ |
| | | public void passExtract(Long id, Long adminId) throws ExtractException; |
| | | public void passExtract(Long id, String adminId) throws ExtractException; |
| | | |
| | | |
| | | /** |
| | |
| | | * @param: adminId |
| | | * @param: reason |
| | | **/ |
| | | public void rejectExtract(Long id, Long adminId, String reason) throws ExtractException, UserMoneyBalanceException, ParamsException; |
| | | public void rejectExtract(Long id, String adminId, String reason) throws ExtractException, UserMoneyBalanceException, ParamsException; |
| | | |
| | | |
| | | /** |
| | |
| | | |
| | | private Long uid; |
| | | |
| | | private String eventId; |
| | | |
| | | |
| | | public GoldCornConsumeType getType() { |
| | | return type; |
| | |
| | | public void setUid(Long uid) { |
| | | this.uid = uid; |
| | | } |
| | | |
| | | public String getEventId() { |
| | | return eventId; |
| | | } |
| | | |
| | | public void setEventId(String eventId) { |
| | | this.eventId = eventId; |
| | | } |
| | | } |
New file |
| | |
| | | package com.yeshi.makemoney.app.service.query.goldcorn; |
| | | |
| | | public class GoldCornSettleRecordQuery { |
| | | //搜索关键词 |
| | | private String day; |
| | | |
| | | |
| | | public String getDay() { |
| | | return day; |
| | | } |
| | | |
| | | public void setDay(String day) { |
| | | this.day = day; |
| | | } |
| | | } |
| | |
| | | public class ExtractQuery extends BaseQuery { |
| | | private Long uid; |
| | | |
| | | private Integer state; |
| | | |
| | | |
| | | |
| | | public Long getUid() { |
| | | return uid; |
| | |
| | | this.uid = uid; |
| | | } |
| | | |
| | | public Integer getState() { |
| | | return state; |
| | | } |
| | | |
| | | |
| | | public void setState(Integer state) { |
| | | this.state = state; |
| | | } |
| | | } |
| | |
| | | package com.yeshi.makemoney.app.utils; |
| | | |
| | | import com.google.gson.Gson; |
| | | import com.yeshi.makemoney.app.dto.config.AlipayConfig; |
| | | import com.yeshi.makemoney.app.dto.config.WXTransferConfig; |
| | | import org.yeshi.utils.annotation.MapUtil; |
| | |
| | | public static WXTransferConfig wxTransferConfig; |
| | | |
| | | static { |
| | | //TODO |
| | | // if (alipayConfig == null) { |
| | | // Properties ps = org.yeshi.utils.PropertiesUtil |
| | | // .getProperties(Constant.class.getClassLoader().getResourceAsStream("alipay.properties")); |
| | | // alipayConfig = (AlipayConfig) MapUtil.parseMap(AlipayConfig.class, ps); |
| | | // } |
| | | // if (wxTransferConfig == null) { |
| | | // Properties ps = org.yeshi.utils.PropertiesUtil |
| | | // .getProperties(Constant.class.getClassLoader().getResourceAsStream("wx_transfer.properties")); |
| | | // wxTransferConfig = (WXTransferConfig) MapUtil.parseMap(WXTransferConfig.class, ps); |
| | | // } |
| | | if (alipayConfig == null) { |
| | | Properties ps = org.yeshi.utils.PropertiesUtil |
| | | .getProperties(Constant.class.getClassLoader().getResourceAsStream("alipay.properties")); |
| | | alipayConfig = (AlipayConfig) MapUtil.parseMapByJson(AlipayConfig.class, ps, null); |
| | | } |
| | | if (wxTransferConfig == null) { |
| | | Properties ps = org.yeshi.utils.PropertiesUtil |
| | | .getProperties(Constant.class.getClassLoader().getResourceAsStream("wx_transfer.properties")); |
| | | wxTransferConfig = (WXTransferConfig) MapUtil.parseMapByJson(WXTransferConfig.class, ps, null); |
| | | } |
| | | } |
| | | |
| | | |
| | |
| | | public final static BigDecimal EXTRACT_LITTLE_MONEY_LIMIT = new BigDecimal(1); |
| | | |
| | | |
| | | public static void main(String[] args) { |
| | | AlipayConfig config = Constant.alipayConfig; |
| | | System.out.println(config); |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.makemoney.app.utils; |
| | | |
| | | import org.springframework.stereotype.Component; |
| | | import redis.clients.jedis.Jedis; |
| | | import redis.clients.jedis.JedisPool; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | /** |
| | | * @author hxh |
| | | * @title: JedisUtil |
| | | * @description: Jedis工具类 |
| | | * @date 2022/5/9 11:53 |
| | | */ |
| | | @Component |
| | | public class JedisUtil { |
| | | |
| | | |
| | | @Resource |
| | | private JedisPool jedisPool; |
| | | |
| | | /** |
| | | * 执行 |
| | | * |
| | | * @param jedisExcuter |
| | | */ |
| | | public void excute(JedisExcuter jedisExcuter) throws Exception { |
| | | Jedis jedis = jedisPool.getResource(); |
| | | try { |
| | | if (jedisExcuter != null) { |
| | | jedisExcuter.execute(jedis); |
| | | } |
| | | } finally { |
| | | jedis.close(); |
| | | } |
| | | } |
| | | |
| | | public interface JedisExcuter { |
| | | public void execute(Jedis jedis) throws Exception; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.makemoney.app.utils; |
| | | |
| | | |
| | | import com.ks.lib.common.exception.ParamsException; |
| | | |
| | | import javax.validation.ConstraintViolation; |
| | | import javax.validation.Validation; |
| | | import javax.validation.Validator; |
| | | import java.util.Set; |
| | | |
| | | /** |
| | | * @author hxh |
| | | * @title: ValidatorUtils |
| | | * @description: 验证工具 |
| | | * @date 2022/5/10 16:37 |
| | | */ |
| | | public class ValidatorUtils { |
| | | |
| | | private static Validator validator; |
| | | |
| | | static { |
| | | validator = Validation.buildDefaultValidatorFactory().getValidator(); |
| | | } |
| | | |
| | | public static void validateEntity(Object object, Class<?>... groups) throws ParamsException { |
| | | Set<ConstraintViolation<Object>> constraintViolations = validator.validate(object, groups); |
| | | if (!constraintViolations.isEmpty()) { |
| | | for (ConstraintViolation<Object> o : constraintViolations) { |
| | | throw new ParamsException(ParamsException.CODE_PARAMS_NOT_ENOUGH, o.getMessage()); |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | import org.yeshi.utils.StringUtil; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | |
| | | UserMoneyRecord detail = new UserMoneyRecord(); |
| | | detail.setCreateTime(new Date()); |
| | | detail.setSerialNo(UserMoneyType.goldCorn.name().toLowerCase() + "_" + record.getId()); |
| | | detail.setMoney(record.getMoney()); |
| | | detail.setMoney(new BigDecimal(record.getMoney()).divide(new BigDecimal(100), 2, RoundingMode.FLOOR)); |
| | | detail.setType(UserMoneyType.goldCorn); |
| | | detail.setUpdateTime(new Date()); |
| | | detail.setUser(new UserInfo(record.getUid())); |
| | |
| | | |
| | | import com.yeshi.makemoney.app.entity.goldcorn.GoldCornConsumeRecord; |
| | | import com.yeshi.makemoney.app.entity.goldcorn.GoldCornConsumeType; |
| | | import com.yeshi.makemoney.app.utils.goldcorn.GoldCornUtil; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | |
| | | */ |
| | | public class GoldCornConsumeRecordFactory { |
| | | |
| | | public static GoldCornConsumeRecord createExchange(Long uid, String day, int cornNum, BigDecimal rate) { |
| | | public static GoldCornConsumeRecord createExchange(Long uid, String day, int cornNum, BigDecimal rate, String settleId) { |
| | | GoldCornConsumeRecord record = new GoldCornConsumeRecord(); |
| | | record.setUid(uid); |
| | | record.setCornNum(cornNum); |
| | | record.setMoney(rate.multiply(new BigDecimal(record.getCornNum())).setScale(2, RoundingMode.FLOOR)); |
| | | record.setMoney(rate.multiply(new BigDecimal(record.getCornNum())).setScale(2, RoundingMode.FLOOR).multiply(new BigDecimal(100)).longValue()); |
| | | record.setType(GoldCornConsumeType.changeMoney); |
| | | record.setId(uid + "-" + record.getType().name() + "-" + day); |
| | | //积分兑换少于1分的按照1分计算 |
| | | if (record.getMoney().compareTo(new BigDecimal(0)) == 0 && cornNum > 0) { |
| | | record.setMoney(new BigDecimal("0.01")); |
| | | if (record.getMoney() == 0L && cornNum > 0) { |
| | | record.setMoney(1L); |
| | | } |
| | | record.setEventTime(GoldCornUtil.convertFormatDay(day)); |
| | | record.setEventId(settleId); |
| | | return record; |
| | | } |
| | | |
| | |
| | | package com.yeshi.makemoney.app.vo; |
| | | |
| | | import com.yeshi.makemoney.app.entity.APPPlatform; |
| | | import com.yeshi.makemoney.app.entity.AdminUser; |
| | | import com.yeshi.makemoney.app.entity.SystemEnum; |
| | | |
| | | /** |
| | |
| | | */ |
| | | public class AcceptAdminData { |
| | | private SystemEnum system; |
| | | private AdminUser adminUser; |
| | | |
| | | public SystemEnum getSystem() { |
| | | return system; |
| | |
| | | public void setSystem(SystemEnum system) { |
| | | this.system = system; |
| | | } |
| | | |
| | | public AdminUser getAdminUser() { |
| | | return adminUser; |
| | | } |
| | | |
| | | public void setAdminUser(AdminUser adminUser) { |
| | | this.adminUser = adminUser; |
| | | } |
| | | } |
| | |
| | | addresses: http://1.14.235.17:9000/xxl-job-admin |
| | | |
| | | #buddo配置参数 |
| | | #dubbo: |
| | | # application: |
| | | # name: app-consumer |
| | | # registry: |
| | | # protocol: zookeeper |
| | | # address: zookeeper://172.16.16.46:2181 # 134.175.68.214 134.175.68.214:2181 |
| | | # client: curator |
| | | dubbo: |
| | | application: |
| | | name: app-consumer |
| | | registry: |
| | | protocol: zookeeper |
| | | address: zookeeper://193.112.35.168:2182 # 134.175.68.214 134.175.68.214:2181 |
| | | client: curator |
| | | |
| | |
| | | spring: |
| | | profiles: |
| | | active: pro |
| | | active: dev |
| | |
| | | <?xml version='1.0' encoding='UTF-8'?> |
| | | <!DOCTYPE generator-config PUBLIC "-//yeshitv.com//DTD generator_code 1.0//EN" |
| | | "http://dtd.yeshitv.com/generator_code/1.4.dtd"> |
| | | <generator-config class="com.yeshi.makemoney.app.entity.goldcorn.GoldCornTaskTypeInfo"> |
| | | <generator-config class="com.yeshi.makemoney.app.entity.goldcorn.GoldCornSettleRecord"> |
| | | |
| | | <dao package="com.yeshi.makemoney.app.dao.goldcorn"> |
| | | <queryList> |
| | | <query name="system" type="equal"/> |
| | | <query name="type" type="equal"/> |
| | | <query name="day" type="equal"/> |
| | | <query name="createTime" type="equal"/> |
| | | </queryList> |
| | | </dao> |
| | | |
| | |
| | | |
| | | <admin> |
| | | <controller package="com.yeshi.makemoney.app.controller.admin.goldcorn" |
| | | mapping="/admin/api/goldcorn/task" adminVOPackage="com.yeshi.makemoney.app.vo.admin.goldcorn" |
| | | mapping="/admin/api/goldcorn/settle" adminVOPackage="com.yeshi.makemoney.app.vo.admin.goldcorn" |
| | | jsonp="false"> |
| | | </controller> |
| | | <pages title="金币任务信息" |
| | | <pages title="资金结算记录" |
| | | pageDir="D:/workspace/makemoney/server/MakeMoney/app/src/main/resources/static/goldcorn"> |
| | | <list> |
| | | <searchForm> |
| | | <columns> |
| | | <column property="kw" title="关键词"> |
| | | <text inputType="TEXT" placeHolder="内容关键词"></text> |
| | | <column property="day" title="日期"> |
| | | <text inputType="DATE" placeHolder="请选择日期"></text> |
| | | </column> |
| | | </columns> |
| | | </searchForm> |
| | | <columns> |
| | | <column property="id" title="ID" showType="TEXT"></column> |
| | | <column property="name" title="任务名称" showType="TEXT"></column> |
| | | <column property="icon" title="任务图标" showType="IMG"></column> |
| | | <column property="type" title="任务类型" showType="TEXT"></column> |
| | | <column property="show" title="是否显示" showType="SWITCH"></column> |
| | | <column property="startTime" title="显示开始时间" showType="DATETIME"></column> |
| | | <column property="endTime" title="显示结束时间" showType="DATETIME"></column> |
| | | <column property="day" title="结算日期" showType="TEXT"></column> |
| | | <column property="rate" title="汇率" showType="TEXT"></column> |
| | | <column property="cornNum" title="金币数量" showType="TEXT"></column> |
| | | <column property="totalMoney" title="结算金额" showType="TEXT"></column> |
| | | <column property="remarks" title="备注" showType="TEXT"></column> |
| | | <column property="createTime" title="创建时间" showType="DATETIME"></column> |
| | | <column property="updateTime" title="修改时间" showType="DATETIME"></column> |
| | | </columns> |
| | |
| | | |
| | | <add> |
| | | |
| | | <column property="name" title="任务名称"> |
| | | <text inputType="TEXT"></text> |
| | | </column> |
| | | |
| | | <column property="type" title="任务类型"> |
| | | <select> |
| | | <api path="/admin/api/goldcorn/getTypeList"></api> |
| | | </select> |
| | | </column> |
| | | |
| | | |
| | | <column property="icon" title="图标"> |
| | | <img height="100"> |
| | | <api path="/admin/api/file/uploadImg"> |
| | | <params> |
| | | <value key="type">goldcorn_task</value> |
| | | </params> |
| | | </api> |
| | | </img> |
| | | </column> |
| | | |
| | | |
| | | <column property="show" title="是否显示"> |
| | | <switch></switch> |
| | | </column> |
| | | |
| | | <column property="startTime" title="显示开始时间"> |
| | | <text inputType="DATETIME"> |
| | | <verify type="datetime" require="true"></verify> |
| | | <column property="name" title="结算日期"> |
| | | <text inputType="DATE"> |
| | | <verify type="date" require="true"></verify> |
| | | </text> |
| | | </column> |
| | | <column property="endTime" title="显示结束时间"> |
| | | <text inputType="DATETIME"> |
| | | <verify type="datetime" require="true"></verify> |
| | | |
| | | <column property="remarks" title="备注"> |
| | | <text inputType="TEXT" isTextArea="true"> |
| | | </text> |
| | | </column> |
| | | |
| | | </add> |
| | | |
| | | <update> |
| | | <column property="name" title="任务名称"> |
| | | <column property="day" title="任务名称"> |
| | | <text inputType="TEXT"> |
| | | </text> |
| | | </column> |
| | | |
| | | <column property="type" title="任务类型"> |
| | | <select enable="false"> |
| | | <api path="/admin/api/goldcorn/getTypeList"></api> |
| | | </select> |
| | | </column> |
| | | |
| | | |
| | | <column property="icon" title="图标"> |
| | | <img height="100"> |
| | | <api path="/admin/api/file/uploadImg"> |
| | | <params> |
| | | <value key="type">goldcorn_task</value> |
| | | </params> |
| | | </api> |
| | | </img> |
| | | </column> |
| | | |
| | | |
| | | <column property="show" title="是否显示"> |
| | | <switch></switch> |
| | | </column> |
| | | |
| | | <column property="startTime" title="显示开始时间"> |
| | | <text inputType="DATETIME"> |
| | | <verify type="datetime" require="true"></verify> |
| | | </text> |
| | | </column> |
| | | <column property="endTime" title="显示结束时间"> |
| | | <text inputType="DATETIME"> |
| | | <verify type="datetime" require="true"></verify> |
| | | </text> |
| | | </column> |
| | | |
| | |
| | | </where> |
| | | <if test="query.sortList!=null"> |
| | | <foreach collection="query.sortList" open=" order by " separator="," item="item"> |
| | | #{item} |
| | | ${item} |
| | | </foreach> |
| | | </if> |
| | | limit #{query.start},#{query.count} |
New file |
| | |
| | | <!DOCTYPE html> |
| | | <html class="x-admin-sm"> |
| | | |
| | | <head> |
| | | <meta charset="UTF-8"> |
| | | <title>新增资金结算记录</title> |
| | | <meta name="renderer" content="webkit"> |
| | | <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> |
| | | <meta name="viewport" |
| | | content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi"/> |
| | | <link rel="stylesheet" href="../css/font.css"> |
| | | <link rel="stylesheet" href="../css/xadmin.css"> |
| | | <script type="text/javascript" src="../lib/layui/layui.js" charset="utf-8"></script> |
| | | <script type="text/javascript" src="../js/xadmin.js"></script> |
| | | <script src="../js/vue.min.js" type="text/javascript" charset="utf-8"></script> |
| | | <script src="../js/http.js" type="text/javascript" charset="utf-8"></script> |
| | | <script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script> |
| | | <!-- 让IE8/9支持媒体查询,从而兼容栅格 --> |
| | | <!--[if lt IE 9]> |
| | | <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script> |
| | | <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script> |
| | | <![endif]--> |
| | | </head> |
| | | <body> |
| | | <div class="layui-fluid"> |
| | | <div class="layui-row"> |
| | | <form class="layui-form" lay-filter="add"> |
| | | |
| | | <div class="layui-form-item"> |
| | | <label for="L_appCode" class="layui-form-label"> |
| | | <span class="x-red">*</span> |
| | | 结算日期</label> |
| | | <div class="layui-input-block"> |
| | | <input type="date" name="day" lay-verify="required|date" placeholder="" autocomplete="off" |
| | | class="layui-input"> |
| | | </div> |
| | | |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label for="L_appCode" class="layui-form-label"> |
| | | 备注</label> |
| | | <div class="layui-input-block"> |
| | | <textarea name="remarks" lay-verify="" cols="5" placeholder="" autocomplete="off" |
| | | class="layui-textarea"></textarea> |
| | | |
| | | </div> |
| | | |
| | | </div> |
| | | |
| | | <div class="layui-form-item"> |
| | | <label for="L_remarks" class="layui-form-label"></label> |
| | | <button class="layui-btn" lay-filter="add" lay-submit="">确定</button> |
| | | </div> |
| | | </form> |
| | | </div> |
| | | </div> |
| | | <script> |
| | | //初始化上传控件 |
| | | var uploadTool = { |
| | | callback: null, |
| | | chooseImage: {}, |
| | | uploadArray: new Array(), |
| | | init: function (upload) { |
| | | this.uploadArray = new Array(); |
| | | |
| | | }, |
| | | upload: function (result) { |
| | | if (this.uploadArray.length > 0) { |
| | | this.callback = result; |
| | | //同时上传 |
| | | for (var i = 0; i < this.uploadArray.length; i++) { |
| | | this.uploadArray[i].upload(); |
| | | } |
| | | } else { |
| | | result(); |
| | | } |
| | | } |
| | | }; |
| | | |
| | | |
| | | </script> |
| | | |
| | | <script> |
| | | layui.use(['form', 'layer', 'jquery', 'upload', 'laydate'], function () { |
| | | $ = layui.jquery; |
| | | var form = layui.form, |
| | | layer = layui.layer, |
| | | upload = layui.upload, |
| | | laydate = layui.laydate; |
| | | |
| | | var verify = {}; |
| | | //自定义验证规则 |
| | | form.verify(verify); |
| | | |
| | | //渲染上传控件 |
| | | uploadTool.init(upload); |
| | | |
| | | laydate.render({ |
| | | elem: "input[name=day]", //指定元素 |
| | | type: 'date' |
| | | }); |
| | | |
| | | |
| | | //监听提交 |
| | | form.on('submit(add)', |
| | | function (data) { |
| | | console.log(data.field); |
| | | //转换json对象 |
| | | for (key in data.field) { |
| | | if (key.indexOf(".") > -1) { |
| | | var value = data.field[key]; |
| | | delete data.field[key]; |
| | | var onkeys = key.split("."); |
| | | //创建对象 |
| | | if (data.field[onkeys[0]] == undefined) { |
| | | data.field[onkeys[0]] = {}; |
| | | } |
| | | data.field[onkeys[0]][onkeys[1]] = value; |
| | | } |
| | | } |
| | | uploadTool.upload(function () { |
| | | //发异步,把数据提交给php |
| | | ksapp.post('/admin/api/goldcorn/settle/add', data.field, function (res) { |
| | | if (res.code == 0) { |
| | | layer.alert("加入结算任务队列成功", { |
| | | icon: 6 |
| | | }, |
| | | function () { |
| | | //关闭当前frame |
| | | xadmin.close(); |
| | | // 可以对父窗口进行刷新 |
| | | // xadmin.father_reload(); |
| | | }); |
| | | } else { |
| | | layer.msg(res.msg); |
| | | } |
| | | |
| | | }, function (res) { |
| | | }); |
| | | }); |
| | | return false; |
| | | }); |
| | | //请求select的数据API |
| | | }) |
| | | ; |
| | | </script> |
| | | </body> |
| | | |
| | | </html> |
copy from app/src/main/resources/static/money/extract_list.html
copy to app/src/main/resources/static/7aed59d33d777100/goldcorn/gold_corn_settle_record_list.html
File was copied from app/src/main/resources/static/money/extract_list.html |
| | |
| | | |
| | | <head> |
| | | <meta charset="UTF-8"> |
| | | <title>提现列表</title> |
| | | <title>资金结算记录列表</title> |
| | | <meta name="renderer" content="webkit"> |
| | | <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> |
| | | <meta name="viewport" |
| | |
| | | <div class="layui-card-body"> |
| | | <form class="layui-form layui-col-space5"> |
| | | <div class="layui-inline layui-show-xs-block"> |
| | | <input type="date" name="startTime" lay-verify="" placeholder="" autocomplete="off" |
| | | class="layui-input"> |
| | | </div> |
| | | <div class="layui-inline layui-show-xs-block"> |
| | | <input type="date" name="endTime" lay-verify="" placeholder="" autocomplete="off" |
| | | class="layui-input"> |
| | | </div> |
| | | <div class="layui-inline layui-show-xs-block"> |
| | | <input type="text" name="uid" lay-verify="" placeholder="请输入用户ID" autocomplete="off" |
| | | <input type="text" name="day" lay-verify="" placeholder="请选择日期" autocomplete="off" |
| | | class="layui-input"> |
| | | </div> |
| | | <div class="layui-inline layui-show-xs-block"> |
| | |
| | | </div> |
| | | </div> |
| | | </body> |
| | | |
| | | <script type="text/html" id="toolbar"> |
| | | <div class="layui-btn-container"> |
| | | |
| | | <button class="layui-btn" onclick="xadmin.open('添加资金结算记录','gold_corn_settle_record_add.html',500,400)"><i |
| | | class="layui-icon"></i>添加结算 |
| | | </button> |
| | | </div> |
| | | </script> |
| | | |
| | | |
| | | <script type="text/html" id="optContainer"> |
| | | <div class="layui-btn-container"> |
| | | <a title="删除" onclick="member_del(this,{{d.LAY_INDEX }},'{{d.id}}')" href="javascript:;"> |
| | | <i class="layui-icon"></i> |
| | | <div class="layui-btn-container" lay-filter="refresh"> |
| | | <a title="" href="javascript:;" lay-event="refresh"> |
| | | <i class="layui-icon"></i> |
| | | </a> |
| | | </div> |
| | | </script> |
| | |
| | | </script> |
| | | |
| | | <script> |
| | | var tableIns = null; |
| | | $(function () { |
| | | |
| | | var app = new Vue({ |
| | | function member_del(obj, index, id) { |
| | | layer.confirm('确认要删除吗?', function (index) { |
| | | //发异步删除数据 |
| | | app.delete(obj, index, id); |
| | | }); |
| | | } |
| | | |
| | | </script> |
| | | |
| | | <script> |
| | | var tableIns = null; |
| | | var app = null; |
| | | $(function () { |
| | | app = new Vue({ |
| | | el: "#app", |
| | | data: { |
| | | key: '', |
| | |
| | | var laydate = layui.laydate, |
| | | form = layui.form, |
| | | table = layui.table; |
| | | |
| | | //渲染日期输入框 |
| | | laydate.render({ |
| | | elem: "input[name=day]" //指定元素 |
| | | }); |
| | | //搜索条件 |
| | | form.on('submit(search)', function (data) { |
| | | app.search(data.field); |
| | |
| | | |
| | | tableIns = table.render({ |
| | | elem: '#table_list', |
| | | url: "/admin/api/money/extract/list", |
| | | url: "/admin/api/goldcorn/settle/list", |
| | | toolbar: "#toolbar", |
| | | totalRow: true, |
| | | cols: [[{type: 'checkbox', title: "ID"}, |
| | | {field: 'id', width: 100, sort: false, title: "ID"}, |
| | | {field: 'user', width: 80, sort: false, title: "用户ID"}, |
| | | {field: 'money', width: 100, sort: false, title: "提现金额"}, |
| | | {field: 'type', width: 120, sort: false, title: "付款渠道"}, |
| | | {field: 'name', width: 120, sort: false, title: "姓名(支付宝)"}, |
| | | {field: 'account', width: 120, sort: false, title: "账号/OpenId"}, |
| | | {field: 'ip', width: 120, sort: false, title: "提现IP"}, |
| | | { |
| | | field: 'state', width: 80, sort: false, title: "状态", templet: function (res) { |
| | | if (res.state == 0) { |
| | | return "未处理"; |
| | | } else if (res.state == 1) { |
| | | return "通过"; |
| | | } else if (res.state == 2) { |
| | | return "已拒绝"; |
| | | } else if (res.state == 3) { |
| | | return "正在处理"; |
| | | } |
| | | return "未知"; |
| | | } |
| | | }, |
| | | {field: 'reason', width: 200, sort: false, title: "原因"}, |
| | | {field: 'successTime', width: 120, sort: false, title: "通过时间"}, |
| | | {field: 'createTime', width: 120, sort: false, title: "创建时间"}, |
| | | {fixed: 'right', width: 80, title: "操作", toolbar: '#optContainer'}]], |
| | | {field: 'id', width: 150, sort: false, title: "ID"}, |
| | | {field: 'day', width: 120, sort: false, title: "结算日期"}, |
| | | {field: 'rate', width: 120, sort: false, title: "汇率"}, |
| | | {field: 'cornNum', width: 120, sort: false, title: "金币数量"}, |
| | | {field: 'totalMoney', width: 120, sort: false, title: "结算金额"}, |
| | | {field: 'remarks', width: 120, sort: false, title: "备注"}, |
| | | {field: 'createTime', width: 150, sort: false, title: "创建时间"}, |
| | | {field: 'updateTime', width: 150, sort: false, title: "修改时间"}, |
| | | {fixed: 'right', width: 80, title: "刷新数据", toolbar: '#optContainer'}]], |
| | | page: true, |
| | | parseData: function (res) { //res 即为原始返回的数据 |
| | | if (res.code != 0) |
| | |
| | | } |
| | | //,…… //其他参数 |
| | | }); |
| | | |
| | | table.on('tool(app)', |
| | | function (obj) { |
| | | var data = obj.data; |
| | | if (obj.event === 'refresh') { |
| | | alert("刷新item"); |
| | | app.refreshItem(data.id, function (res) { |
| | | obj.update(res); |
| | | }); |
| | | } |
| | | }); |
| | | |
| | | //头工具栏事件 |
| | | table.on('toolbar(app)', |
| | |
| | | }); |
| | | }, |
| | | deleteList: function (ids, success) { |
| | | ksapp.post("/admin/api/money/extract/delete", {ids: JSON.stringify(ids)}, function (e) { |
| | | ksapp.post("/admin/api/goldcorn/settle/delete", {ids: JSON.stringify(ids)}, function (e) { |
| | | if (e.code == 0) { |
| | | success(); |
| | | } else { |
| | |
| | | }); |
| | | }, |
| | | search: function (params) { |
| | | if (params["startTime"].length == 0) { |
| | | delete params["startTime"]; |
| | | } |
| | | |
| | | if (params["endTime"].length == 0) { |
| | | delete params["endTime"]; |
| | | var ps = {}; |
| | | for (var key in params) { |
| | | if (params[key].length > 0) { |
| | | ps[key] = params[key]; |
| | | } |
| | | } |
| | | |
| | | if (params["uid"].length == 0) { |
| | | delete params["uid"]; |
| | | } |
| | | |
| | | //数据重载 |
| | | tableIns.reload({ |
| | | where: params, |
| | | where: ps, |
| | | page: { |
| | | curr: 1 //重新从第 1 页开始 |
| | | } |
| | | }); |
| | | }, |
| | | |
| | | refreshItem: function (id, callback) { |
| | | //TODO 刷新内容 |
| | | |
| | | } |
| | | |
| | | |
| | | } |
| | | }); |
| | | app.init(); |
File was renamed from app/src/main/resources/static/index.html |
| | |
| | | </li> |
| | | |
| | | |
| | | |
| | | </ul> |
| | | </li> |
| | | |
| | |
| | | <cite>金币消耗记录</cite></a> |
| | | </li> |
| | | |
| | | <li> |
| | | <a onclick="xadmin.add_tab('金币结算','goldcorn/gold_corn_settle_record_list.html')"> |
| | | <i class="iconfont"></i> |
| | | <cite>金币结算</cite></a> |
| | | </li> |
| | | |
| | | </ul> |
| | | </li> |
| | | |
File was renamed from app/src/main/resources/static/js/http.js |
| | |
| | | //未登录 |
| | | if (e.status == 401) { |
| | | //打开登录窗口 |
| | | xadmin.open('登录', '/login.html?from=page', 500, 530) |
| | | xadmin.open('登录', '/7aed59d33d777100/login.html?from=page', 500, 530) |
| | | }else{ |
| | | layer.msg("网络请求出错"); |
| | | } |
New file |
| | |
| | | <!DOCTYPE html> |
| | | <html class="x-admin-sm"> |
| | | |
| | | <head> |
| | | <meta charset="UTF-8"> |
| | | <title>新增系统配置信息</title> |
| | | <meta name="renderer" content="webkit"> |
| | | <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> |
| | | <meta name="viewport" |
| | | content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi"/> |
| | | <link rel="stylesheet" href="../css/font.css"> |
| | | <link rel="stylesheet" href="../css/xadmin.css"> |
| | | <script type="text/javascript" src="../lib/layui/layui.js" charset="utf-8"></script> |
| | | <script type="text/javascript" src="../js/xadmin.js"></script> |
| | | <script src="../js/vue.min.js" type="text/javascript" charset="utf-8"></script> |
| | | <script src="../js/http.js" type="text/javascript" charset="utf-8"></script> |
| | | <script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script> |
| | | <!-- 让IE8/9支持媒体查询,从而兼容栅格 --> |
| | | <!--[if lt IE 9]> |
| | | <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script> |
| | | <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script> |
| | | |
| | | |
| | | <![endif]--> |
| | | |
| | | <style> |
| | | |
| | | body { |
| | | padding: 10px; |
| | | background: white; |
| | | box-sizing: border-box; |
| | | } |
| | | |
| | | .content { |
| | | width: 300px; |
| | | text-align: right; |
| | | } |
| | | |
| | | .code { |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: right; |
| | | } |
| | | |
| | | .code input { |
| | | width: 100px !important; |
| | | margin: 0 10px; |
| | | } |
| | | |
| | | .sure { |
| | | margin-left: 205px; |
| | | margin-top: 20px; |
| | | } |
| | | |
| | | </style> |
| | | </head> |
| | | <body> |
| | | |
| | | <div class="content"> |
| | | <div class="code"> |
| | | <span>验证码:</span> |
| | | <input class="layui-input" placeholder="请输入验证码" v-model="code"> |
| | | <button class="layui-btn" :class="{'layui-btn-disabled': time>0,'layui-btn-normal':time<=0 }" |
| | | @click="sendVerifyCode">{{time<=0?'发送验证码': |
| | | time+'s后发送'}} |
| | | </button> |
| | | </div> |
| | | <button class="layui-btn sure" @click="verifyCode">确定</button> |
| | | </div> |
| | | |
| | | <script> |
| | | |
| | | var app = new Vue({ |
| | | el: ".content", |
| | | data: |
| | | { |
| | | time: -1, |
| | | code: '' |
| | | }, |
| | | created: function () { |
| | | setInterval(function () { |
| | | if (app.time > 0) { |
| | | app.time = app.time - 1; |
| | | } |
| | | }, 1000); |
| | | }, |
| | | methods: { |
| | | sendVerifyCode: function () { |
| | | if (this.time > 0) { |
| | | return; |
| | | } |
| | | this.time = 30; |
| | | ksapp.post('/admin/api/money/extract/sendExtractEmail', {}, function (res) { |
| | | if (res.code == 0) { |
| | | layer.msg("发送成功"); |
| | | } else { |
| | | layer.msg(res.msg); |
| | | } |
| | | |
| | | }, function (res) { |
| | | }); |
| | | }, |
| | | verifyCode: function () { |
| | | if (this.code.length < 4) { |
| | | layer.msg("请输入正确的验证码"); |
| | | return; |
| | | } |
| | | ksapp.post('/admin/api/money/extract/verifyExtractEmail', { |
| | | code: app.code |
| | | }, function (res) { |
| | | if (res.code == 0) { |
| | | layer.msg("验证成功"); |
| | | xadmin.close(); |
| | | } else { |
| | | layer.msg(res.msg); |
| | | } |
| | | |
| | | }, function (res) { |
| | | }); |
| | | } |
| | | |
| | | |
| | | } |
| | | } |
| | | ); |
| | | |
| | | </script> |
| | | </body> |
| | | |
| | | </html> |
File was renamed from app/src/main/resources/static/money/extract_list.html |
| | |
| | | <div class="layui-col-md12"> |
| | | <div class="layui-card"> |
| | | <div class="layui-card-body"> |
| | | <form class="layui-form layui-col-space5"> |
| | | <form class="layui-form layui-col-space5" lay-filter="search"> |
| | | <div class="layui-inline layui-show-xs-block"> |
| | | <input type="date" name="startTime" lay-verify="" placeholder="" autocomplete="off" |
| | | class="layui-input"> |
| | |
| | | <input type="date" name="endTime" lay-verify="" placeholder="" autocomplete="off" |
| | | class="layui-input"> |
| | | </div> |
| | | |
| | | <div class="layui-inline layui-show-xs-block"> |
| | | |
| | | <select name="state"> |
| | | <option value="">--请选择状态--</option> |
| | | <option value="0">未处理</option> |
| | | <option value="1">已通过</option> |
| | | <option value="2">已拒绝</option> |
| | | <option value="3">处理中</option> |
| | | </select> |
| | | |
| | | </div> |
| | | |
| | | <div class="layui-inline layui-show-xs-block"> |
| | | <input type="text" name="uid" lay-verify="" placeholder="请输入用户ID" autocomplete="off" |
| | | class="layui-input"> |
| | |
| | | |
| | | <script type="text/html" id="toolbar"> |
| | | <div class="layui-btn-container"> |
| | | |
| | | <button class="layui-btn" lay-event="process">去处理 |
| | | </button> |
| | | </div> |
| | | </script> |
| | | |
| | | |
| | | <script type="text/html" id="optContainer"> |
| | | <div class="layui-btn-container"> |
| | | <a title="删除" onclick="member_del(this,{{d.LAY_INDEX }},'{{d.id}}')" href="javascript:;"> |
| | | <i class="layui-icon"></i> |
| | | </a> |
| | | </div> |
| | | |
| | | </script> |
| | | |
| | | <script type="text/html" id="statusContainer"> |
| | |
| | | |
| | | <script> |
| | | var tableIns = null; |
| | | var app = null; |
| | | $(function () { |
| | | |
| | | var app = new Vue({ |
| | | app = new Vue({ |
| | | el: "#app", |
| | | data: { |
| | | key: '', |
| | |
| | | form = layui.form, |
| | | table = layui.table; |
| | | |
| | | |
| | | form.render(); |
| | | |
| | | //搜索条件 |
| | | form.on('submit(search)', function (data) { |
| | | app.search(data.field); |
| | |
| | | toolbar: "#toolbar", |
| | | totalRow: true, |
| | | cols: [[{type: 'checkbox', title: "ID"}, |
| | | {field: 'id', width: 100, sort: false, title: "ID"}, |
| | | {field: 'user', width: 80, sort: false, title: "用户ID"}, |
| | | {field: 'money', width: 100, sort: false, title: "提现金额"}, |
| | | {field: 'type', width: 120, sort: false, title: "付款渠道"}, |
| | | {field: 'name', width: 120, sort: false, title: "姓名(支付宝)"}, |
| | | {field: 'id', width: 80, sort: false, title: "ID"}, |
| | | { |
| | | field: 'user', width: 80, sort: false, title: "用户ID", templet: function (res) { |
| | | |
| | | return res.user.id; |
| | | } |
| | | }, |
| | | {field: 'money', width: 80, sort: false, title: "提现金额"}, |
| | | {field: 'type', width: 80, sort: false, title: "付款渠道"}, |
| | | {field: 'name', width: 80, sort: false, title: "姓名(支付宝)"}, |
| | | {field: 'account', width: 120, sort: false, title: "账号/OpenId"}, |
| | | {field: 'ip', width: 120, sort: false, title: "提现IP"}, |
| | | {field: 'ip', width: 150, sort: false, title: "提现IP"}, |
| | | { |
| | | field: 'state', width: 80, sort: false, title: "状态", templet: function (res) { |
| | | if (res.state == 0) { |
| | | return "未处理"; |
| | | } else if (res.state == 1) { |
| | | return "通过"; |
| | | return "<span style='color:green'>已通过</span>"; |
| | | } else if (res.state == 2) { |
| | | return "已拒绝"; |
| | | return "<span style='color:red'>已拒绝</span>"; |
| | | } else if (res.state == 3) { |
| | | return "正在处理"; |
| | | return "<span style='color:orange'>正在处理</span>"; |
| | | } |
| | | return "未知"; |
| | | } |
| | | }, |
| | | {field: 'reason', width: 200, sort: false, title: "原因"}, |
| | | {field: 'successTime', width: 120, sort: false, title: "通过时间"}, |
| | | {field: 'createTime', width: 120, sort: false, title: "创建时间"}, |
| | | {fixed: 'right', width: 80, title: "操作", toolbar: '#optContainer'}]], |
| | | {field: 'successTime', width: 150, sort: false, title: "通过时间"}, |
| | | {field: 'createTime', width: 150, sort: false, title: "创建时间"}, |
| | | ]], |
| | | page: true, |
| | | parseData: function (res) { //res 即为原始返回的数据 |
| | | if (res.code != 0) |
| | |
| | | }, |
| | | error: function (e, msg) { |
| | | ksapp.tableError(e) |
| | | }, |
| | | done: function (res, curr, count) { |
| | | // $(".layui-table-box .layui-table-body table tbody tr").click(function () { |
| | | // console.log("click"); |
| | | // $(this).find(".laytable-cell-checkbox").eq(0).trigger("click"); |
| | | // }); |
| | | } |
| | | //,…… //其他参数 |
| | | }); |
| | | |
| | | |
| | | //头工具栏事件 |
| | | table.on('toolbar(app)', |
| | | function (obj) { |
| | | var checkStatus = table.checkStatus(obj.config.id); |
| | | switch (obj.event) { |
| | | case 'delete': |
| | | case 'process': { |
| | | var data = checkStatus.data; |
| | | if (data == null || data.length == 0) { |
| | | layer.msg("未选择选项"); |
| | | if (data.length == 0) { |
| | | layer.msg("尚未选择要处理的记录"); |
| | | return; |
| | | } |
| | | var ids = new Array(); |
| | | for (var i = 0; i < data.length; i++) |
| | | ids.push(data[i].id); |
| | | layer.confirm('确认要删除吗?', function (index) { |
| | | //发异步删除数据 |
| | | app.deleteList(ids, function () { |
| | | layer.msg("删除成功"); |
| | | $("form").submit(); |
| | | }); |
| | | }); |
| | | |
| | | break; |
| | | if (data.length != 1) { |
| | | layer.msg("只能选择一条要处理的记录"); |
| | | return; |
| | | } |
| | | xadmin.open('处理提现记录', 'extract_process.html?id=' + data[0].id, null, null, true); |
| | | } |
| | | } |
| | | ; |
| | | }); |
| | |
| | | $('#search').trigger("click"); |
| | | }); |
| | | |
| | | }, |
| | | delete: function (obj, index, id) { |
| | | var ids = new Array(); |
| | | ids.push(id); |
| | | app.deleteList(ids, function () { |
| | | $(obj).parents("tr").remove(); |
| | | layer.msg('已删除!', {icon: 1, time: 1000}); |
| | | }); |
| | | }, |
| | | deleteList: function (ids, success) { |
| | | ksapp.post("/admin/api/money/extract/delete", {ids: JSON.stringify(ids)}, function (e) { |
| | | if (e.code == 0) { |
| | | success(); |
| | | } else { |
| | | layer.msg(e.msg); |
| | | } |
| | | }, function (e) { |
| | | }); |
| | | }, |
| | | search: function (params) { |
| | | if (params["startTime"].length == 0) { |
| | |
| | | curr: 1 //重新从第 1 页开始 |
| | | } |
| | | }); |
| | | }, |
| | | } |
| | | } |
| | | }); |
| | | app.init(); |
New file |
| | |
| | | <!DOCTYPE html> |
| | | <html class="x-admin-sm"> |
| | | |
| | | <head> |
| | | <meta charset="UTF-8"> |
| | | <title>提现处理</title> |
| | | <meta name="renderer" content="webkit"> |
| | | <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> |
| | | <meta name="viewport" |
| | | content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi"/> |
| | | <link rel="stylesheet" href="../css/font.css"> |
| | | <link rel="stylesheet" href="../css/xadmin.css"> |
| | | <script src="../lib/layui/layui.js" charset="utf-8"></script> |
| | | <link rel="stylesheet" href="../css/theme3049.min.css"> |
| | | <script src="../js/vue.min.js" type="text/javascript" charset="utf-8"></script> |
| | | <script type="text/javascript" src="../js/xadmin.js"></script> |
| | | <script src="../js/http.js" type="text/javascript" charset="utf-8"></script> |
| | | <script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script> |
| | | <!--[if lt IE 9]> |
| | | <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script> |
| | | <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script> |
| | | <![endif]--> |
| | | <script src="../js/utils.js"></script> |
| | | <style> |
| | | |
| | | .extract-area { |
| | | display: flex; |
| | | justify-content: space-between; |
| | | } |
| | | |
| | | .extract-area .info { |
| | | display: flex; |
| | | flex-direction: column; |
| | | justify-content: space-between; |
| | | } |
| | | |
| | | .extract-area .info .money { |
| | | margin-top: 10px; |
| | | font-size: 16px; |
| | | } |
| | | |
| | | .extract-area .process { |
| | | display: flex; |
| | | flex-direction: column; |
| | | |
| | | } |
| | | |
| | | .extract-area .process input { |
| | | width: 300px; |
| | | font-size: 15px; |
| | | } |
| | | |
| | | .extract-area .process .options { |
| | | display: flex; |
| | | margin-top: 10px; |
| | | justify-content: right; |
| | | } |
| | | |
| | | .user { |
| | | text-align: center; |
| | | display: flex; |
| | | } |
| | | |
| | | .portrait { |
| | | width: 50px; |
| | | height: 50px; |
| | | border-radius: 25px; |
| | | } |
| | | |
| | | .nick_name { |
| | | margin-left: 10px; |
| | | line-height: 25px; |
| | | } |
| | | |
| | | </style> |
| | | </head> |
| | | |
| | | <body> |
| | | <div class="layui-fluid" id="app"> |
| | | <div class="layui-row layui-col-space15"> |
| | | <div class="layui-col-md12"> |
| | | <div class="layui-card"> |
| | | <div class="layui-card-body"> |
| | | <div class="extract-area"> |
| | | <div class="info" v-if="extract"> |
| | | <div class="user"> |
| | | <img class="portrait" :src="extract.user.portrait" |
| | | style=""> |
| | | <div style="text-align: left"> |
| | | <div class="nick_name">{{extract.user.nickName}}</div> |
| | | <div class="nick_name">ID: {{extract.user.id}}</div> |
| | | </div> |
| | | |
| | | </div> |
| | | |
| | | <div class="money"> |
| | | 提现ID:{{extract.id}} 提现金额:¥{{extract.money}} 状态: <span |
| | | v-html="extract.stateDesc"></span> |
| | | </div> |
| | | |
| | | |
| | | </div> |
| | | <div class="process"> |
| | | |
| | | <input class="layui-input" placeholder="请输入拒绝原因" id="reason"/> |
| | | |
| | | <div class="options"> |
| | | <button class="layui-btn" onclick="app.pass()">通过</button> |
| | | <button class="layui-btn layui-btn-danger" onclick="app.reject()">拒绝</button> |
| | | </div> |
| | | |
| | | |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="layui-card-body "> |
| | | <table class="layui-table" id="table_list" lay-filter="app"> |
| | | </table> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </body> |
| | | |
| | | |
| | | <script type="text/html" id="optContainer"> |
| | | <div class="layui-btn-container"> |
| | | <a title="删除" onclick="member_del(this,{{d.LAY_INDEX }},'{{d.id}}')" href="javascript:;"> |
| | | <i class="layui-icon"></i> |
| | | </a> |
| | | </div> |
| | | </script> |
| | | |
| | | <script type="text/html" id="statusContainer"> |
| | | <div class="layui-btn-container"> |
| | | {{# if(d.status==0){ }} |
| | | <span class="layui-btn layui-btn-mini"> |
| | | 正常 |
| | | </span> |
| | | {{# }else{ }} |
| | | <span class="layui-btn layui-btn-danger layui-btn-mini"> |
| | | 已删除 |
| | | </span> |
| | | {{# } }} |
| | | </div> |
| | | </script> |
| | | |
| | | <script type="text/html" id="switchTpl"> |
| | | <!-- 这里的checked的状态只是演示 --> |
| | | <input type="checkbox" name="sex" value="{{d.id}}" lay-skin="switch" lay-text="女|男" lay-filter="sexDemo" {{ d.id== |
| | | 10003 ? 'checked': ''}} > |
| | | </script> |
| | | |
| | | |
| | | <script type="text/html" id="imgshow"> |
| | | <!-- 这里的checked的状态只是演示 --> |
| | | <img src="{{d.}}"/> |
| | | <input type="checkbox" name="sex" value="{{d.id}}" lay-skin="switch" lay-text="女|男" lay-filter="sexDemo" {{ d.id== |
| | | 10003 ? 'checked': ''}} > |
| | | </script> |
| | | |
| | | <script> |
| | | var tableIns = null; |
| | | var app = null; |
| | | $(function () { |
| | | var id = ksapp.getQueryParam("id"); |
| | | |
| | | app = new Vue({ |
| | | el: "#app", |
| | | data: { |
| | | extract: null, |
| | | }, |
| | | watch: {}, |
| | | created: function () { |
| | | |
| | | }, |
| | | methods: { |
| | | init: function () { |
| | | //初始化 |
| | | layui.use(['laydate', 'form', 'table'], function () { |
| | | var laydate = layui.laydate, |
| | | form = layui.form, |
| | | table = layui.table; |
| | | |
| | | //搜索条件 |
| | | form.on('submit(process)', function (data) { |
| | | return false; |
| | | }); |
| | | |
| | | tableIns = table.render({ |
| | | elem: '#table_list', |
| | | url: "/admin/api/money/extract/list", |
| | | totalRow: true, |
| | | cols: [[, |
| | | {field: 'id', width: 70, sort: false, title: "ID"}, |
| | | { |
| | | field: 'user', width: 80, sort: false, title: "用户ID", templet: function (res) { |
| | | return res.user.id; |
| | | } |
| | | }, |
| | | {field: 'money', width: 100, sort: false, title: "提现金额"}, |
| | | {field: 'type', width: 80, sort: false, title: "付款渠道"}, |
| | | {field: 'name', width: 80, sort: false, title: "姓名(支付宝)"}, |
| | | {field: 'account', width: 120, sort: false, title: "账号/OpenId"}, |
| | | {field: 'ip', width: 150, sort: false, title: "提现IP"}, |
| | | { |
| | | field: 'state', width: 80, sort: false, title: "状态", templet: function (res) { |
| | | if (res.state == 0) { |
| | | return "未处理"; |
| | | } else if (res.state == 1) { |
| | | return "<span style='color:green'>已通过</span>"; |
| | | } else if (res.state == 2) { |
| | | return "<span style='color:red'>已拒绝</span>"; |
| | | } else if (res.state == 3) { |
| | | return "<span style='color:orange'>正在处理</span>"; |
| | | } |
| | | return "未知"; |
| | | } |
| | | }, |
| | | {field: 'reason', width: 200, sort: false, title: "原因"}, |
| | | {field: 'successTime', width: 150, sort: false, title: "通过时间"}, |
| | | {field: 'createTime', width: 150, sort: false, title: "创建时间"}, |
| | | ]], |
| | | page: true, |
| | | parseData: function (res) { //res 即为原始返回的数据 |
| | | if (res.code != 0) |
| | | return; |
| | | if (res.data.list == null) |
| | | return; |
| | | console.log(res.data.list) |
| | | return { |
| | | "code": res.code, //解析接口状态 |
| | | "msg": res.msg, //解析提示文本 |
| | | "count": res.data.count, //解析数据长度 |
| | | "data": res.data.list //解析数据列表 |
| | | }; |
| | | }, |
| | | error: function (e, msg) { |
| | | ksapp.tableError(e) |
| | | } |
| | | //,…… //其他参数 |
| | | }); |
| | | //请求搜索表单中需要的数据 |
| | | app.getDetail(); |
| | | }); |
| | | |
| | | |
| | | }, |
| | | search: function (params) { |
| | | |
| | | if (params["uid"].length == 0) { |
| | | delete params["uid"]; |
| | | } |
| | | |
| | | //数据重载 |
| | | tableIns.reload({ |
| | | where: params, |
| | | page: { |
| | | curr: 1 //重新从第 1 页开始 |
| | | } |
| | | }); |
| | | }, |
| | | getDetail: function () { |
| | | |
| | | ksapp.post('/admin/api/money/extract/get', { |
| | | id: id |
| | | }, function (res) { |
| | | if (res.code == 0) { |
| | | var data = res.data; |
| | | if (data.state == 0) { |
| | | data.stateDesc = "未处理"; |
| | | } else if (data.state == 1) { |
| | | data.stateDesc = "<span style='color:green'>已通过</span>"; |
| | | } else if (data.state == 2) { |
| | | data.stateDesc = "<span style='color:red'>已拒绝</span>"; |
| | | } else if (data.state == 3) { |
| | | data.stateDesc = "<span style='color:orange'>正在处理</span>"; |
| | | } else { |
| | | data.stateDesc = "未知"; |
| | | } |
| | | app.extract = data; |
| | | app.search({uid: app.extract.user.id}); |
| | | } else { |
| | | layer.msg(res.msg); |
| | | } |
| | | }, function (res) { |
| | | }); |
| | | |
| | | }, |
| | | |
| | | pass: function () { |
| | | layer.confirm('是否通过提现申请?', {icon: 3, title: '提示'}, function (index) { |
| | | layer.close(index); |
| | | //确定 |
| | | ksapp.post('/admin/api/money/extract/passExtract', {id: id}, function (res) { |
| | | if (res.code == 0) { |
| | | layer.msg("成功"); |
| | | } else if (res.code == 50002) { |
| | | app.openVerifyDialog(); |
| | | } else { |
| | | layer.msg(res.msg); |
| | | } |
| | | }, function (res) { |
| | | }); |
| | | }); |
| | | }, |
| | | reject: function () { |
| | | if ($("#reason").val().length == 0) { |
| | | layer.msg("请填写拒绝原因"); |
| | | return; |
| | | } |
| | | |
| | | |
| | | layer.confirm('是否拒绝提现申请?', {icon: 3, title: '提示'}, function (index) { |
| | | layer.close(index); |
| | | ksapp.post('/admin/api/money/extract/rejectExtract', { |
| | | id: id, |
| | | reason: $("#reason").val() |
| | | }, function (res) { |
| | | if (res.code == 0) { |
| | | layer.msg("成功"); |
| | | } else if (res.code == 50002) { |
| | | app.openVerifyDialog(); |
| | | } else { |
| | | layer.msg(res.msg); |
| | | } |
| | | }, function (res) { |
| | | }); |
| | | }); |
| | | }, |
| | | openVerifyDialog: function () { |
| | | xadmin.open('邮件验证', 'extract_email_code.html', 350, 160); |
| | | } |
| | | |
| | | } |
| | | }); |
| | | app.init(); |
| | | }); |
| | | |
| | | </script> |
| | | |
| | | <script> |
| | | |
| | | </script> |
| | | </html> |
New file |
| | |
| | | <!doctype html> |
| | | <html class="x-admin-sm"> |
| | | <head> |
| | | <meta charset="UTF-8"> |
| | | <title>板栗快省</title> |
| | | <meta name="renderer" content="webkit|ie-comp|ie-stand"> |
| | | <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> |
| | | <meta name="viewport" |
| | | content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi"/> |
| | | <meta http-equiv="Cache-Control" content="no-siteapp"/> |
| | | |
| | | <link rel="stylesheet" href="css/font.css"> |
| | | <link rel="stylesheet" href="css/xadmin.css"> |
| | | <link rel="stylesheet" href="css/theme3049.min.css"> |
| | | |
| | | <!-- <link rel="stylesheet" href="./css/theme5.css"> --> |
| | | |
| | | |
| | | <script src="js/vue.min.js" type="text/javascript" charset="utf-8"></script> |
| | | <script src="js/http.js" type="text/javascript" charset="utf-8"></script> |
| | | <script src="lib/layui/layui.js" charset="utf-8"></script> |
| | | <!-- 让IE8/9支持媒体查询,从而兼容栅格 --> |
| | | <!--[if lt IE 9]> |
| | | <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script> |
| | | <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script> |
| | | <script type="text/javascript" src="js/xadmin.js"></script> |
| | | <![endif]--> |
| | | <script> |
| | | // 是否开启刷新记忆tab功能 |
| | | // var is_remember = false; |
| | | </script> |
| | | |
| | | <script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script> |
| | | <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/3.6.0/chart.min.js"></script> |
| | | |
| | | |
| | | <style> |
| | | .layui-elem-quote { |
| | | color: #666; |
| | | font-size: 16px; |
| | | font-weight: bold; |
| | | border-left: none; |
| | | } |
| | | |
| | | .time-span { |
| | | height: 25px; |
| | | display: flex; |
| | | margin: 20px 0; |
| | | } |
| | | |
| | | .time-span div { |
| | | width: 50px; |
| | | height: 100%; |
| | | text-align: center; |
| | | line-height: 25px; |
| | | font-size: 12px; |
| | | background: #F5F5F5; |
| | | color: #666; |
| | | cursor: pointer; |
| | | } |
| | | |
| | | .time-span .active { |
| | | background: #DDDDDD; |
| | | } |
| | | |
| | | .time-span :first-child { |
| | | border-top-left-radius: 8px; |
| | | border-bottom-left-radius: 8px; |
| | | } |
| | | |
| | | .time-span :last-child { |
| | | border-top-right-radius: 8px; |
| | | border-bottom-right-radius: 8px; |
| | | } |
| | | |
| | | </style> |
| | | |
| | | |
| | | </head> |
| | | |
| | | <body> |
| | | |
| | | <div id="content"> |
| | | <div class="layui-card" v-for="item,index in charts" :id="item.type" :data-index="index"> |
| | | <div class="layui-card-body"> |
| | | <blockquote class="layui-elem-quote"> |
| | | {{item.title}} |
| | | </blockquote> |
| | | <form class="layui-form layui-col-space5"> |
| | | <div class="layui-inline layui-show-xs-block"> |
| | | <input type="text" name="date" lay-verify="" placeholder="" autocomplete="off" |
| | | class="layui-input"> |
| | | </div> |
| | | <div class="layui-inline layui-show-xs-block"> |
| | | <!-- :lay-filter="'search-'+item.type" --> |
| | | <button class="search" class="layui-btn" lay-submit="" :lay-filter="'search-'+item.type"> |
| | | <i class="layui-icon"></i></button> |
| | | </div> |
| | | |
| | | <input type="hidden" :value="index" name="index"> |
| | | </form> |
| | | |
| | | <div class="time-span"> |
| | | <div data-key="hour" @click="changeSpan(index,$event)">小时</div> |
| | | <div data-key="day" class="active" @click="changeSpan(index,$event)">天</div> |
| | | <div data-key="month" @click="changeSpan(index,$event)">月</div> |
| | | </div> |
| | | <canvas :id="'chart-'+item.type" width="100%" height="25"></canvas> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </body> |
| | | |
| | | |
| | | <script> |
| | | $(function () { |
| | | var app = new Vue({ |
| | | el: "#content", |
| | | data: { |
| | | charts: [ |
| | | { |
| | | type: 'user', |
| | | url: '/admin/api/user/statisticRegisterUser', |
| | | title: '新增用户统计' |
| | | }, |
| | | { |
| | | type: 'goldcorn', |
| | | url: '/admin/api/goldcorn/get/record/statistic', |
| | | title: '金币统计' |
| | | } |
| | | ], |
| | | chartsCanvas: {} |
| | | }, |
| | | mounted: function () { |
| | | setTimeout(function () { |
| | | app.init(); |
| | | }, 10); |
| | | |
| | | }, |
| | | methods: { |
| | | init: function () { |
| | | var $this = this; |
| | | layui.use(['laydate', 'form'], function () { |
| | | var laydate = layui.laydate, |
| | | form = layui.form; |
| | | for (var i = 0; i < $this.charts.length; i++) { |
| | | var chartConfig = $this.charts[i]; |
| | | console.log("初始化 ", chartConfig.type, i); |
| | | //渲染日期输入框 |
| | | var d = new Date(); |
| | | var nowDay = d.format('yyyy-MM-dd'); |
| | | laydate.render({ |
| | | elem: "#" + chartConfig.type + " input[name=date]" //指定元素 |
| | | , |
| | | index:i, |
| | | type: 'date' |
| | | , |
| | | trigger: 'click' |
| | | //,lang: 'en' |
| | | //,theme: 'grid' |
| | | , |
| | | range: true //开启日期范围,默认使用“-”分割 |
| | | // ,min: '2020-01-01' |
| | | //,max: '2021-5-9' |
| | | //,value: '2021-05-09 12:06:09' |
| | | , |
| | | value: new Date(d.getTime() - 1000 * 60 * 60 * 24 * 7).format('yyyy-MM-dd') + " - " + nowDay |
| | | , |
| | | done: function (value, date, endDate) { |
| | | console.log(value, date, endDate,this.index); |
| | | |
| | | $("#" + $this.charts[this.index].type + " .search").click(); |
| | | }, |
| | | change: function (value, date, endDate) { |
| | | } |
| | | }); |
| | | //搜索条件 |
| | | form.on("submit(search-" + chartConfig.type + ")", function (data) { |
| | | var index = parseInt(data.field.index); |
| | | var span = $("#" + $this.charts[index].type + " .time-span .active").attr("data-key"); |
| | | var config = $this.charts[index]; |
| | | app.requestData(config.url, data.field.date, span, function (labels, values) { |
| | | $this.draw(labels, values, $this.getLineChart(config)); |
| | | }); |
| | | return false; |
| | | }); |
| | | |
| | | //查询 |
| | | $("#" + chartConfig.type + " .search").click(); |
| | | } |
| | | |
| | | // $("#search-user").click(); |
| | | }); |
| | | }, |
| | | requestData: function (url, dateValue, span, callback) { |
| | | var date = dateValue.split(" - "); |
| | | //"/admin/api/user/statisticRegisterUser" |
| | | ksapp.post(url, { |
| | | startTime: new Date(date[0]).getTime() - 1000 * 60 * 60 * 8, |
| | | endTime: new Date(date[1]).getTime() - 1000 * 60 * 60 * 8 + 1000 * 60 * 60 * 24 - 1, |
| | | span: span |
| | | }, function (res) { |
| | | if (res.code == 0) { |
| | | var labels = new Array(); |
| | | var values = new Array(); |
| | | for (var i = 0; i < res.data.list.length; i++) { |
| | | labels.push(res.data.list[i].time); |
| | | values.push(res.data.list[i].number); |
| | | } |
| | | callback(labels, values); |
| | | } else { |
| | | layer.msg(res.msg); |
| | | } |
| | | }, function (res) { |
| | | }); |
| | | }, |
| | | getLineChart: function (config) { |
| | | if (this.chartsCanvas[config.type] == null) { |
| | | var ctx = document.getElementById("chart-" + config.type).getContext('2d'); |
| | | this.chartsCanvas[config.type] = new Chart(ctx, { |
| | | type: 'line', |
| | | data: { |
| | | labels: [], |
| | | datasets: [{ |
| | | label: config.title, |
| | | data: [], |
| | | backgroundColor: 'rgba(255, 99, 132, 0.2)', |
| | | borderColor: 'rgba(54, 162, 235, 1)', |
| | | borderWidth: 3 |
| | | }] |
| | | }, |
| | | options: { |
| | | scales: { |
| | | yAxes: [{ |
| | | ticks: { |
| | | beginAtZero: true |
| | | } |
| | | }] |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | return this.chartsCanvas[config.type]; |
| | | }, |
| | | draw: function (labels, data, chart) { |
| | | console.log("绘图",chart); |
| | | chart.data.labels = labels; |
| | | chart.data.datasets[0].data = data; |
| | | chart.update(); |
| | | }, |
| | | changeSpan: function (index, event) { |
| | | var el = event.currentTarget; |
| | | if (!$(el).hasClass("active")) { |
| | | $(el).parent().find("div").removeClass("active"); |
| | | $(el).addClass("active"); |
| | | console.log("点击:" + ("#" + this.charts[index].type + " .search")); |
| | | $("#" + this.charts[index].type + " .search").click(); |
| | | } |
| | | } |
| | | } |
| | | }); |
| | | |
| | | }); |
| | | </script> |
| | | |
| | | |
| | | <script> |
| | | |
| | | Date.prototype.format = function (format) { |
| | | var o = { |
| | | "M+": this.getMonth() + 1, //month |
| | | "d+": this.getDate(), //day |
| | | "h+": this.getHours(), //hour |
| | | "m+": this.getMinutes(), //minute |
| | | "s+": this.getSeconds(), //second |
| | | "q+": Math.floor((this.getMonth() + 3) / 3), //quarter |
| | | "S": this.getMilliseconds() //millisecond |
| | | } |
| | | if (/(y+)/.test(format)) format = format.replace(RegExp.$1, |
| | | (this.getFullYear() + "").substr(4 - RegExp.$1.length)); |
| | | for (var k in o) if (new RegExp("(" + k + ")").test(format)) |
| | | format = format.replace(RegExp.$1, |
| | | RegExp.$1.length == 1 ? o[k] : |
| | | ("00" + o[k]).substr(("" + o[k]).length)); |
| | | return format; |
| | | } |
| | | |
| | | </script> |
| | | </html> |
| | |
| | | package test.goldcorn; |
| | | |
| | | import com.ks.lib.common.exception.ParamsException; |
| | | import com.yeshi.makemoney.app.Application; |
| | | import com.yeshi.makemoney.app.entity.SystemEnum; |
| | | import com.yeshi.makemoney.app.entity.goldcorn.GoldCornGetFrequencyConfig; |
| | | 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.entity.goldcorn.*; |
| | | import com.yeshi.makemoney.app.exception.goldcorn.*; |
| | | import com.yeshi.makemoney.app.exception.user.UserInfoException; |
| | | import com.yeshi.makemoney.app.service.inter.goldcorn.GoldCornGetFrequencyConfigService; |
| | | 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.goldcorn.*; |
| | | import com.yeshi.makemoney.app.service.query.goldcorn.GoldCornConsumeRecordQuery; |
| | | import org.junit.jupiter.api.Test; |
| | | import org.springframework.boot.test.context.SpringBootTest; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.util.Arrays; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | |
| | | private GoldCornGetRecordService goldCornGetRecordService; |
| | | |
| | | @Resource |
| | | private GoldCornConsumeRecordService goldCornConsumeRecordService; |
| | | |
| | | @Resource |
| | | private GoldCornMakeService goldCornMakeService; |
| | | |
| | | @Resource |
| | | private GoldCornSettleService goldCornSettleService; |
| | | |
| | | @Resource |
| | | private GoldCornSettleRecordService goldCornSettleRecordService; |
| | | |
| | | @Test |
| | | public void addGoldRecord() throws GoldCornGetRecordException { |
| | |
| | | |
| | | @Test |
| | | public void settle() { |
| | | goldCornSettleService.startSettle(new Date(System.currentTimeMillis() - 1000 * 60 * 60 * 24L)); |
| | | // goldCornSettleService.startSettle(new Date(System.currentTimeMillis() - 1000 * 60 * 60 * 24 * 1L)); |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | public void getFrequencys() { |
| | | List<GoldCornGetFrequencyConfig> list = goldCornGetFrequencyConfigService.listByTypes(Arrays.asList(new GoldCornGetType[]{GoldCornGetType.watchVideo, GoldCornGetType.readNovel, GoldCornGetType.scanNews}), SystemEnum.svmm, new Date()); |
| | | } |
| | | |
| | | @Test |
| | | public void addSettle() throws GoldCornSettleRecordException, ParamsException { |
| | | GoldCornSettleRecord record = new GoldCornSettleRecord(); |
| | | goldCornSettleRecordService.add(record); |
| | | } |
| | | |
| | | @Test |
| | | public void sumMoney() { |
| | | GoldCornConsumeRecordQuery query = new GoldCornConsumeRecordQuery(); |
| | | query.setType(GoldCornConsumeType.changeMoney); |
| | | BigDecimal money = goldCornConsumeRecordService.sumMoney(query); |
| | | System.out.println(money); |
| | | } |
| | | |
| | | } |
| | |
| | | <dependency> |
| | | <groupId>com.yeshi</groupId> |
| | | <artifactId>utils</artifactId> |
| | | <version>0.3.6</version> |
| | | <version>0.3.8</version> |
| | | <exclusions> |
| | | <exclusion> |
| | | <groupId>org.springframework.data</groupId> |