mingfu 1 месяц назад
Родитель
Сommit
60e3ece3dd

+ 49 - 9
ie-admin/src/main/java/com/ruoyi/web/controller/dz/DzCardsController.java

@@ -81,16 +81,16 @@ public class DzCardsController extends BaseController
     private DzCards prepare(DzCards dzCards) {
         SysUser sysUser = SecurityUtils.getLoginUser().getUser();
         String userType = sysUser.getUserType();
-        if(UserTypeEnum.isInstitution(userType)){
+        if (UserTypeEnum.isInstitution(userType)) {
             dzCards.setDeptId(SecurityUtils.getDeptId());
-        } else if(UserTypeEnum.isSchool(userType)){
+        } else if (UserTypeEnum.isSchool(userType)) {
             dzCards.setCampusId(sysUser.getUserTypeId());
         }
-        if((UserTypeEnum.isAgent(userType)||UserTypeEnum.isTeacher(userType))&&null==dzCards.getAgentId()){
+        if ((UserTypeEnum.isAgent(userType) || UserTypeEnum.isTeacher(userType)) && null == dzCards.getAgentId()) {
             //代理商及老师只能查看分配给自己的卡
             DzAgent agent = agentService.selectDzAgentByUserId(SecurityUtils.getUserId());
-            if (null!=agent){
-                if(NumberUtils.isPositive(agent.getParentId())) {
+            if (null != agent) {
+                if (NumberUtils.isPositive(agent.getParentId())) {
                     dzCards.setLeafAgentId(agent.getAgentId());
                 } else {
                     dzCards.setAgentId(agent.getAgentId());
@@ -170,8 +170,8 @@ public class DzCardsController extends BaseController
     @Log(title = "制卡", businessType = BusinessType.INSERT)
     @PostMapping("/issueCard")
     @ApiOperation("制卡")
-    public AjaxResult issueCard(@ApiParam("机构") Long institutionId, @ApiParam("卡类型") String type, @ApiParam("数量") Integer count)
-    {
+    @PreAuthorize("@ss.hasPermi('dz:cards:issue')")
+    public AjaxResult issueCard(@ApiParam("机构") Long institutionId, @ApiParam("卡类型") String type, @ApiParam("数量") Integer count) {
         dzCardsService.issueCard(institutionId, getCardType(institutionId, type), count);
         return AjaxResult.success();
     }
@@ -179,6 +179,7 @@ public class DzCardsController extends BaseController
     @Log(title = "分配开卡", businessType = BusinessType.INSERT)
     @PostMapping("/assignCard")
     @ApiOperation("分配即开卡")
+    @PreAuthorize("@ss.hasPermi('dz:cards:assign')")
     public AjaxResult assignCard(@ApiParam("代理商") @RequestParam Long agentId, @ApiParam("卡类型") String type, @ApiParam(value = "卡类型") Integer cardType,
                                  @ApiParam("开始号") @RequestParam String begin, @ApiParam("结束号") @RequestParam String end,
                                  @ApiParam("省份") @RequestParam(required = false) String location,
@@ -217,11 +218,48 @@ public class DzCardsController extends BaseController
     @Log(title = "分配校区", businessType = BusinessType.INSERT)
     @PostMapping("/changeCampus")
     @ApiOperation("分配校区")
-    public AjaxResult changeCampus(@ApiParam("校区") Long campusId, @ApiParam("开始号") String begin, @ApiParam("结束号") String end)
-    {
+    @PreAuthorize("@ss.hasPermi('dz:cards:associateCampus')")
+    public AjaxResult changeCampus(@ApiParam("校区") Long campusId, @ApiParam("开始号") String begin, @ApiParam("结束号") String end) {
         return AjaxResult.success(dzCardsService.changeCampus(campusId, begin, end));
     }
 
+    @Log(title = "支付", businessType = BusinessType.UPDATE)
+    @PostMapping("/change/pay")
+    @ApiOperation("支付")
+    public AjaxResult changePay(@ApiParam("卡ID") @RequestParam Long[] cardIds) {
+        return changeCard(CardAction.Pay, cardIds);
+    }
+    @Log(title = "续费", businessType = BusinessType.UPDATE)
+    @PostMapping("/change/renew")
+    @ApiOperation("续费")
+    public AjaxResult changeRenew(@ApiParam("卡ID") @RequestParam Long[] cardIds) {
+        return changeCard(CardAction.Renew, cardIds);
+    }
+    @Log(title = "结算", businessType = BusinessType.UPDATE)
+    @PostMapping("/change/settlement")
+    @ApiOperation("结算")
+    public AjaxResult changeSettlement(@ApiParam("卡ID") @RequestParam Long[] cardIds) {
+        return changeCard(CardAction.Settlement, cardIds);
+    }
+    @Log(title = "重卡", businessType = BusinessType.UPDATE)
+    @PostMapping("/change/reopen")
+    @ApiOperation("重卡")
+    public AjaxResult changeReopen(@ApiParam("卡ID") @RequestParam Long[] cardIds) {
+        return changeCard(CardAction.ReOpen, cardIds);
+    }
+    @Log(title = "退费", businessType = BusinessType.UPDATE)
+    @PostMapping("/change/refund")
+    @ApiOperation("退费")
+    public AjaxResult changeRefund(@ApiParam("卡ID") @RequestParam Long[] cardIds) {
+        return changeCard(CardAction.Refund, cardIds);
+    }
+    @Log(title = "关卡", businessType = BusinessType.UPDATE)
+    @PostMapping("/change/close")
+    @ApiOperation("关卡")
+    public AjaxResult changeClose(@ApiParam("卡ID") @RequestParam Long[] cardIds) {
+        return changeCard(CardAction.Close, cardIds);
+    }
+
     @Log(title = "修改卡", businessType = BusinessType.UPDATE)
     @PostMapping("/changeCard")
     @ApiOperation("修改卡 重卡/关卡/支付/续费/结算")
@@ -248,6 +286,7 @@ public class DzCardsController extends BaseController
     @Log(title = "修改卡用户信息", businessType = BusinessType.UPDATE)
     @PostMapping("/updateCardUser")
     @ApiOperation("修改卡用户信息")
+    @PreAuthorize("@ss.hasPermi('dz:cards:updateuser')")
     public AjaxResult updateCardUser(@RequestBody CardUserBody cardUserBody) {
         sysRegisterService.improve(cardUserBody);
         return AjaxResult.success();
@@ -255,6 +294,7 @@ public class DzCardsController extends BaseController
 
     @GetMapping(value = "/cardUser/{cardId}")
     @ApiOperation("卡用户详情")
+    @PreAuthorize("@ss.hasPermi('dz:cards:updateuser')")
     public AjaxResult getCardUser(@PathVariable("cardId") Long cardId)
     {
         CardUserBody cardUserBody = new CardUserBody();

+ 1 - 1
ie-system/src/main/java/com/ruoyi/enums/CardAction.java

@@ -6,5 +6,5 @@ import lombok.Getter;
 @Getter
 @AllArgsConstructor
 public enum CardAction {
-    Pay, Open, Close, ReOpen, Refund, Settlement, Renew;
+    Pay, Close, ReOpen, Refund, Settlement, Renew;
 }