| 
					
				 | 
			
			
				@@ -0,0 +1,83 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+package com.fs.his.controller; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.fs.common.core.controller.BaseController; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.fs.common.core.domain.R; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.fs.common.core.page.TableDataInfo; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.fs.recharge.domain.RechargeTemplate; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.fs.recharge.param.RechargeParam; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.fs.recharge.param.RechargeTemplateQuery; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.fs.recharge.service.RechargeTemplateService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.fs.recharge.vo.RechargeTemplateVO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.github.pagehelper.PageHelper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import io.swagger.annotations.Api; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import io.swagger.annotations.ApiOperation; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import io.swagger.annotations.ApiParam; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import lombok.extern.slf4j.Slf4j; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import org.springframework.beans.factory.annotation.Autowired; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import org.springframework.web.bind.annotation.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import java.util.List; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+/** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * 充值模板控制器 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+@Slf4j 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+@Api(tags = "充值模板管理") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+@RestController 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+@RequestMapping("/recharge-templates") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+public class RechargeTemplateController extends BaseController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private RechargeTemplateService rechargeTemplateService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @ApiOperation("获取可用的充值模板列表") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @PostMapping("/list") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public TableDataInfo getValidTemplates(@RequestBody RechargeTemplateQuery query) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        log.info("获取可用的充值模板列表 参数 query: {}",query); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Integer pageNum = query.getPageNum(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Integer pageSize = query.getPageSize(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        PageHelper.startPage(pageNum, pageSize); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<RechargeTemplateVO> templates = rechargeTemplateService.queryList(query); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return getDataTable(templates); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @ApiOperation("获取充值模板详情") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @GetMapping("/{id}") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public R getTemplateDetail( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            @ApiParam(value = "模板ID", required = true) @PathVariable Long id) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        RechargeTemplateVO template = rechargeTemplateService.getTemplateDetail(id); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (template == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return R.error("模板不存在"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return R.ok().put("data",template); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @ApiOperation("创建充值模板") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @PostMapping 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public R createTemplate(@RequestBody RechargeTemplate template) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        boolean success = rechargeTemplateService.createTemplate(template); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return R.ok(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @ApiOperation("更新充值模板") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @PutMapping("/{id}") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public R updateTemplate( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            @ApiParam(value = "模板ID", required = true) @PathVariable Long id, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            @RequestBody RechargeTemplate template) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        template.setId(id); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        boolean success = rechargeTemplateService.updateTemplate(template); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return R.ok(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @ApiOperation("启用或禁用充值模板") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @PutMapping("/{id}/status") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public R updateStatus( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            @ApiParam(value = "模板ID", required = true) @PathVariable Long id, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            @ApiParam(value = "状态:0-禁用,1-启用", required = true) @RequestParam Integer status) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        boolean success = rechargeTemplateService.updateStatus(id, status); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return R.ok(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+} 
			 |