| | |
| | | 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.*; |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("/addWxPayConfig") |
| | | public ResponseVO<Object> addWxPayConfig(@RequestBody WxpayConfigParam configParam) { |
| | | public ResponseVO<Object> addWxPayConfig(@Validated @RequestBody WxpayConfigParam configParam) { |
| | | if (!permissionConfig.check(MenuEnum.WECHAT_CONFIG_ADD.getCode())) { |
| | | return ResponseUtil.fail("缺少对应用户权限"); |
| | | } |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("/updateWxPayConfig/{configId}") |
| | | public ResponseVO<Object> updateWxPayConfig(@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)); |
| | | } |
| | |
| | | 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)); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * wx配置列表 |
| | | * |
| | | * @param baseConditionVO |
| | | * @param keyword |
| | | * @return |
| | | */ |
| | | @GetMapping("/WxConfigList") |
| | | public ResponseVO<Object> WxConfigList(BaseConditionVO baseConditionVO |
| | | , @RequestParam(value = "keyword", required = false) String keyword) { |
| | |
| | | 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())); |
| | | } |
| | | |
| | | |
| | | } |