| | |
| | | package com.yeshi.makemoney.app.controller.admin.money; |
| | | |
| | | import com.google.gson.*; |
| | | 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.service.inter.config.SystemConfigService; |
| | | 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.RequestBody; |
| | | 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.math.BigDecimal; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | |
| | | |
| | | @Resource |
| | | private ExtractService extractService; |
| | | |
| | | @Resource |
| | | private SystemConfigService systemConfigService; |
| | | |
| | | |
| | | @ResponseBody |
| | |
| | | } |
| | | } |
| | | |
| | | @ResponseBody |
| | | @RequestMapping("getExtractConfig") |
| | | public String getExtractConfig(AcceptAdminData acceptAdminData) { |
| | | SystemConfig config = systemConfigService.getByKey(acceptAdminData.getSystem(), SystemConfigKey.extractConfig); |
| | | ExtractConfig extractConfig = null; |
| | | if (config != null && !StringUtil.isNullOrEmpty(config.getValue())) { |
| | | extractConfig = new Gson().fromJson(config.getValue(), ExtractConfig.class); |
| | | } |
| | | |
| | | if (extractConfig == null) { |
| | | extractConfig = new ExtractConfig(); |
| | | extractConfig.setNewerLittleMoneyNum(0); |
| | | extractConfig.setMaxMoney(new BigDecimal(0)); |
| | | extractConfig.setMaxMoneyPerDay(new BigDecimal(0)); |
| | | extractConfig.setMaxNumPerDay(0); |
| | | extractConfig.setMinMoney(new BigDecimal(0)); |
| | | extractConfig.setExtractMoneyList(new ArrayList<>()); |
| | | } |
| | | |
| | | return JsonUtil.loadTrueResult(extractConfig); |
| | | |
| | | } |
| | | |
| | | @ResponseBody |
| | | @RequestMapping("updateExtractConfig") |
| | | public String updateExtractConfig(@RequestBody ExtractConfig extractConfig, AcceptAdminData acceptAdminData) { |
| | | SystemConfig config = systemConfigService.getByKey(acceptAdminData.getSystem(), SystemConfigKey.extractConfig); |
| | | if (config == null) { |
| | | SystemConfig newConfig = new SystemConfig(); |
| | | newConfig.setSystem(acceptAdminData.getSystem()); |
| | | newConfig.setKey(SystemConfigKey.extractConfig); |
| | | newConfig.setValue(new Gson().toJson(extractConfig)); |
| | | try { |
| | | systemConfigService.add(newConfig); |
| | | } catch (Exception e) { |
| | | return JsonUtil.loadFalseResult(e.getMessage()); |
| | | } |
| | | } else { |
| | | SystemConfig newConfig = new SystemConfig(); |
| | | newConfig.setId(config.getId()); |
| | | newConfig.setValue(new Gson().toJson(extractConfig)); |
| | | systemConfigService.update(newConfig); |
| | | } |
| | | return JsonUtil.loadTrueResult(""); |
| | | } |
| | | |
| | | |
| | | } |