| | |
| | | package cc.mrbird.febs.mall.controller; |
| | | |
| | | import cc.mrbird.febs.common.annotation.ControllerEndpoint; |
| | | import cc.mrbird.febs.common.controller.BaseController; |
| | | import cc.mrbird.febs.common.entity.FebsResponse; |
| | | import cc.mrbird.febs.common.entity.QueryRequest; |
| | | import cc.mrbird.febs.common.enumerates.DataDictionaryEnum; |
| | | import cc.mrbird.febs.common.utils.AppContants; |
| | | import cc.mrbird.febs.mall.dto.*; |
| | | import cc.mrbird.febs.mall.entity.DataDictionaryCustom; |
| | | import cc.mrbird.febs.mall.entity.MallCountryDelivery; |
| | | import cc.mrbird.febs.mall.entity.MallNewsInfo; |
| | | import cc.mrbird.febs.mall.mapper.DataDictionaryCustomMapper; |
| | | import cc.mrbird.febs.mall.service.ICommonService; |
| | | import cc.mrbird.febs.mall.service.IMallCountryDeliveryService; |
| | |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.io.IOException; |
| | |
| | | import java.security.NoSuchAlgorithmException; |
| | | import java.security.PrivateKey; |
| | | import java.util.Arrays; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | |
| | | @RestController |
| | | @RequiredArgsConstructor |
| | | @RequestMapping(value = "/admin/system") |
| | | public class AdminSystemController { |
| | | public class AdminSystemController extends BaseController { |
| | | |
| | | @Autowired |
| | | private ISystemService systemService; |
| | |
| | | } |
| | | commonService.addDataDic("TOKENVIEW_CONFIG", "WEBHOOK_SECRET", dto.getWebhookSecret(), "Tokenview Webhook签名密钥", false); |
| | | commonService.addDataDic("TOKENVIEW_CONFIG", "TRC20_USDT_ADDRESS", dto.getTrc20UsdtAddress(), "TRC20 USDT收款地址", false); |
| | | commonService.addDataDic("SALES_SERVICE", "TRC_ADDRESS", dto.getTrc20UsdtAddress(), "TRC20 USDT收款地址", false); |
| | | return new FebsResponse().success().message("保存成功"); |
| | | } |
| | | |
| | |
| | | return new FebsResponse().success().message("保存成功"); |
| | | } |
| | | |
| | | @GetMapping(value = "/countryDeliveryList") |
| | | public FebsResponse countryDeliveryList() { |
| | | return countryDeliveryService.list(); |
| | | @GetMapping(value = "/moneyChangeList") |
| | | public FebsResponse moneyChangeList() { |
| | | List<DataDictionaryCustom> list = dataDictionaryCustomMapper.selectDicByType("MONEY_CHANGE"); |
| | | Map<String, Object> data = new HashMap<>(); |
| | | data.put("rows", list); |
| | | data.put("total", list.size()); |
| | | return new FebsResponse().success().data(data); |
| | | } |
| | | |
| | | @PostMapping(value = "/moneyChangeSave") |
| | | @ControllerEndpoint(operation = "保存汇率配置") |
| | | public FebsResponse moneyChangeSave(@RequestParam Map<String, String> params) { |
| | | String id = params.get("id"); |
| | | String code = params.get("code"); |
| | | String value = params.get("value"); |
| | | String description = params.get("description"); |
| | | |
| | | if (StrUtil.isBlank(code)) return new FebsResponse().fail().message("货币编码不能为空"); |
| | | if (StrUtil.isBlank(value)) return new FebsResponse().fail().message("汇率不能为空"); |
| | | if (StrUtil.isBlank(description)) return new FebsResponse().fail().message("符号不能为空"); |
| | | |
| | | code = code.toUpperCase(); |
| | | |
| | | // 编辑模式:先删旧记录 |
| | | if (StrUtil.isNotBlank(id)) { |
| | | dataDictionaryCustomMapper.deleteById(Long.valueOf(id)); |
| | | } |
| | | |
| | | // 检查编码是否已存在(避免重复) |
| | | DataDictionaryCustom exist = dataDictionaryCustomMapper.selectDicDataByTypeAndCode("MONEY_CHANGE", code); |
| | | if (exist != null) { |
| | | return new FebsResponse().fail().message("货币编码 " + code + " 已存在"); |
| | | } |
| | | |
| | | commonService.addDataDic("MONEY_CHANGE", code, value, description, false); |
| | | return new FebsResponse().success().message("保存成功"); |
| | | } |
| | | |
| | | @GetMapping(value = "/moneyChangeDelete/{id}") |
| | | @ControllerEndpoint(operation = "删除汇率配置") |
| | | public FebsResponse moneyChangeDelete(@PathVariable Long id) { |
| | | dataDictionaryCustomMapper.deleteById(id); |
| | | return new FebsResponse().success().message("删除成功"); |
| | | } |
| | | |
| | | @GetMapping("countryDeliveryList") |
| | | public FebsResponse countryDeliveryList(MallCountryDelivery dto, QueryRequest request) { |
| | | Map<String, Object> data = getDataTable(countryDeliveryService.countryDeliveryList(dto, request)); |
| | | return new FebsResponse().success().data(data); |
| | | } |
| | | |
| | | @PostMapping(value = "/countryDeliverySave") |