| | |
| | | import com.sandu.ximon.admin.param.WxpayConfigParam; |
| | | import com.sandu.ximon.admin.pay.alipay.UsrAlipayConfigService; |
| | | import com.sandu.ximon.admin.pay.wxpay.UsrWxPayConfigService; |
| | | import com.sandu.ximon.admin.security.PermissionConfig; |
| | | import com.sandu.ximon.dao.domain.AliConfigEntity; |
| | | import com.sandu.ximon.dao.domain.WxConfigEntity; |
| | | import com.sandu.ximon.dao.enums.MenuEnum; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | /** |
| | |
| | | |
| | | private final UsrAlipayConfigService alipayConfigService; |
| | | private final UsrWxPayConfigService wxPayConfigService; |
| | | private PermissionConfig permissionConfig; |
| | | |
| | | |
| | | /** |
| | |
| | | */ |
| | | @PostMapping("/addAliPayConfig") |
| | | public ResponseVO<Object> addAliPayConfig(@RequestBody AlipayConfigParam configParam) { |
| | | if (!permissionConfig.check(MenuEnum.ALIPAY_CONFIG_ADD.getCode())) { |
| | | return ResponseUtil.fail("缺少对应用户权限"); |
| | | } |
| | | return ResponseUtil.success(alipayConfigService.addAliPayConfig(configParam)); |
| | | } |
| | | |
| | |
| | | */ |
| | | @PostMapping("/updateAliPayConfig/{configId}") |
| | | public ResponseVO<Object> updateAliPayConfig(@PathVariable Integer configId, @RequestBody AlipayConfigParam configParam) { |
| | | if (!permissionConfig.check(MenuEnum.ALIPAY_CONFIG_UPDATE.getCode())) { |
| | | return ResponseUtil.fail("缺少对应用户权限"); |
| | | } |
| | | return ResponseUtil.success(alipayConfigService.updateAliPayConfig(configId, configParam)); |
| | | } |
| | | |
| | |
| | | */ |
| | | @PostMapping("/deleteAliPayConfig/{configId}") |
| | | public ResponseVO<Object> deleteAliPayConfig(@PathVariable Integer configId) { |
| | | if (!permissionConfig.check(MenuEnum.ALIPAY_CONFIG_DELETE.getCode())) { |
| | | return ResponseUtil.fail("缺少对应用户权限"); |
| | | } |
| | | return ResponseUtil.success(alipayConfigService.deleteAliPayConfig(configId)); |
| | | } |
| | | |
| | |
| | | */ |
| | | @GetMapping("/getAliPayConfigById/{configId}") |
| | | public ResponseVO<Object> getAliPayConfigById(@PathVariable Integer configId) { |
| | | if (!permissionConfig.check(MenuEnum.ALIPAY_CONFIG_DETAIL.getCode())) { |
| | | return ResponseUtil.fail("缺少对应用户权限"); |
| | | } |
| | | if (configId == null) { |
| | | throw new BusinessException("id能为空"); |
| | | } |
| | |
| | | @GetMapping("/aliConfigList") |
| | | public ResponseVO<Object> aliConfigList(BaseConditionVO baseConditionVO |
| | | , @RequestParam(value = "keyword", required = false) String keyword) { |
| | | if (!permissionConfig.check(MenuEnum.ALIPAY_CONFIG_LIST.getCode())) { |
| | | return ResponseUtil.fail("缺少对应用户权限"); |
| | | } |
| | | return ResponseUtil.success(alipayConfigService.configList(baseConditionVO, keyword)); |
| | | } |
| | | |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("/addWxPayConfig") |
| | | public ResponseVO<Object> addAliPayConfig(@RequestBody WxpayConfigParam configParam) { |
| | | public ResponseVO<Object> addWxPayConfig(@Validated @RequestBody WxpayConfigParam configParam) { |
| | | if (!permissionConfig.check(MenuEnum.WECHAT_CONFIG_ADD.getCode())) { |
| | | return ResponseUtil.fail("缺少对应用户权限"); |
| | | } |
| | | return ResponseUtil.success(wxPayConfigService.addWxPayConfig(configParam)); |
| | | } |
| | | |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("/updateWxPayConfig/{configId}") |
| | | public ResponseVO<Object> updateAliPayConfig(@PathVariable Long configId, @RequestBody WxpayConfigParam configParam) { |
| | | public ResponseVO<Object> updateWxPayConfig(@PathVariable Long configId, @Validated @RequestBody WxpayConfigParam configParam) { |
| | | if (!permissionConfig.check(MenuEnum.WECHAT_CONFIG_UPDATE.getCode())) { |
| | | return ResponseUtil.fail("缺少对应用户权限"); |
| | | } |
| | | if(configId==null){ |
| | | throw new BusinessException("id不能为空"); |
| | | } |
| | | return ResponseUtil.success(wxPayConfigService.updateWxPayConfig(configId, configParam)); |
| | | } |
| | | |
| | |
| | | */ |
| | | @PostMapping("/deleteWxPayConfig/{configId}") |
| | | public ResponseVO<Object> deleteWxPayConfig(@PathVariable Long configId) { |
| | | if (!permissionConfig.check(MenuEnum.WECHAT_CONFIG_DELETE.getCode())) { |
| | | return ResponseUtil.fail("缺少对应用户权限"); |
| | | } |
| | | if(configId==null){ |
| | | throw new BusinessException("id不能为空"); |
| | | } |
| | | return ResponseUtil.success(wxPayConfigService.deleteWxPayConfig(configId)); |
| | | } |
| | | |
| | | /** |
| | | * @param poleId |
| | | * @return |
| | | * @return 通过灯杆id获取配置 |
| | | */ |
| | | @GetMapping("/getWxPayConfigByPoleId/{poleId}") |
| | | public ResponseVO<Object> getWxPayConfigByPoleId(@PathVariable Long poleId) { |
| | | if(poleId==null){ |
| | | throw new BusinessException("poleId不能为空"); |
| | | } |
| | | return ResponseUtil.success(wxPayConfigService.getConfigByPoleId(poleId)); |
| | | } |
| | | |
| | |
| | | */ |
| | | @GetMapping("/getWxPayConfigById/{configId}") |
| | | public ResponseVO<Object> getWxPayConfigById(@PathVariable Integer configId) { |
| | | if (!permissionConfig.check(MenuEnum.WECHAT_CONFIG_DETAIL.getCode())) { |
| | | return ResponseUtil.fail("缺少对应用户权限"); |
| | | } |
| | | if (configId == null) { |
| | | throw new BusinessException("id能为空"); |
| | | } |
| | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * wx配置列表 |
| | | * |
| | | * @param baseConditionVO |
| | | * @param keyword |
| | | * @return |
| | | */ |
| | | @GetMapping("/WxConfigList") |
| | | public ResponseVO<Object> WxConfigList(BaseConditionVO baseConditionVO |
| | | , @RequestParam(value = "keyword", required = false) String keyword) { |
| | | if (!permissionConfig.check(MenuEnum.WECHAT_CONFIG_LIST.getCode())) { |
| | | return ResponseUtil.fail("缺少对应用户权限"); |
| | | } |
| | | PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize()); |
| | | return ResponseUtil.success(wxPayConfigService.configList(baseConditionVO, keyword)); |
| | | } |
| | | |
| | | /** |
| | | * wx配置的停用/启用 |
| | | */ |
| | | @PostMapping("/updateWxPayConfigStatus") |
| | | public ResponseVO<Object> updateWxPayConfigStatus(@RequestBody WxpayConfigParam wxConfigParam) { |
| | | if (!permissionConfig.check(MenuEnum.WECHAT_CONFIG_UPDATE.getCode())) { |
| | | return ResponseUtil.fail("缺少对应用户权限"); |
| | | } |
| | | return ResponseUtil.success(wxPayConfigService.updateState(wxConfigParam.getConfigId(), wxConfigParam.getStatus())); |
| | | } |
| | | |
| | | |
| | | } |