TRX 1 yıl önce
ebeveyn
işleme
3c1558e6cc

+ 13 - 0
FullCardClient/src/main/java/com/zhongshu/card/client/model/school/CardInfoPoolModel.java

@@ -16,6 +16,7 @@ import lombok.NoArgsConstructor;
 @AllArgsConstructor
 @NoArgsConstructor
 public class CardInfoPoolModel extends SuperModel {
+
     @Schema(description = "卡片名称")
     private String name;
 
@@ -40,6 +41,18 @@ public class CardInfoPoolModel extends SuperModel {
     @Schema(description = "是否已使用")
     private Boolean isUsed = Boolean.FALSE;
 
+    private String usedStr;
+
+    public String getUsedStr() {
+        if (isUsed != null) {
+            if (isUsed) {
+                return "已使用";
+            }
+            return "未使用";
+        }
+        return "";
+    }
+
     @Schema(description = "使用绑定时间")
     private Long useTime;
 

+ 15 - 3
FullCardServer/src/main/java/com/zhongshu/card/server/core/controller/orgManager/CardInfoPoolController.java

@@ -9,6 +9,7 @@ import com.zhongshu.card.client.model.base.ProjectOidParam;
 import com.zhongshu.card.client.model.org.OrganizationUserSearch;
 import com.zhongshu.card.client.model.school.*;
 import com.github.microservice.net.ResultContent;
+import com.zhongshu.card.client.type.CardCancelState;
 import com.zhongshu.card.server.core.service.school.CardInfoPoolService;
 import io.swagger.v3.oas.annotations.Operation;
 import io.swagger.v3.oas.annotations.Parameter;
@@ -72,11 +73,22 @@ public class CardInfoPoolController {
         return cardInfoPoolService.restoreCardInfoPool(param);
     }
 
+    // -----------------------作废 -----------------------
     @ResourceAuth(value = "user", type = AuthType.User)
-    @Operation(summary = "作废状态改变", description = "作废状态改变")
-    @RequestMapping(value = {"cancelStateChange"}, method = {RequestMethod.POST})
-    public ResultContent<CardInfoPoolModel> cancelStateChange(
+    @Operation(summary = "作废恢复", description = "作废恢复")
+    @RequestMapping(value = {"cancelRestore"}, method = {RequestMethod.POST})
+    public ResultContent<CardInfoPoolModel> cancelRestore(
             @RequestBody CardInfoPoolChangeParam param) {
+        param.setCancelState(CardCancelState.Common);
+        return cardInfoPoolService.cancelStateChange(param);
+    }
+
+    @ResourceAuth(value = "user", type = AuthType.User)
+    @Operation(summary = "作废", description = "作废")
+    @RequestMapping(value = {"cancelCard"}, method = {RequestMethod.POST})
+    public ResultContent cancelCard(
+            @RequestBody CardInfoPoolChangeParam param) {
+        param.setCancelState(CardCancelState.Cancel);
         return cardInfoPoolService.cancelStateChange(param);
     }
 

+ 1 - 1
FullCardServer/src/main/java/com/zhongshu/card/server/core/service/openAPI/OpenAPIRegisterService.java

@@ -41,7 +41,7 @@ public class OpenAPIRegisterService {
         param.setOpenApiInfo(openAPIS);
         param.setApiType(ApiType.FullCard.name());
 
-        ResultContent content = restTemplate.postForObject("http://openapiserver/openapi/manager/api/refresh", param, ResultContent.class);
+        ResultContent content = restTemplate.postForObject("http://openapiserver-wjf/openapi/manager/api/refresh", param, ResultContent.class);
         if (content == null) {
             content = ResultContent.buildSuccess();
         }

+ 9 - 2
FullCardServer/src/main/java/com/zhongshu/card/server/core/service/school/CardInfoPoolService.java

@@ -13,6 +13,7 @@ import com.zhongshu.card.client.model.org.OrganizationUserSearch;
 import com.zhongshu.card.client.model.school.*;
 import com.github.microservice.net.ResultContent;
 import com.github.microservice.net.ResultMessage;
+import com.zhongshu.card.client.type.CardCancelState;
 import com.zhongshu.card.client.type.school.CardType;
 import com.zhongshu.card.server.core.dao.org.OrganizationDao;
 import com.zhongshu.card.server.core.dao.org.OrganizationUserDao;
@@ -77,7 +78,6 @@ public class CardInfoPoolService extends SuperService {
      */
     public ResultContent saveCardInfoPool(CardInfoPoolParam param) {
         checkParamOid(param);
-        initDefaultUserAndOid(param);
 
         CardInfoPool entity = null;
         // 这是学校的oid
@@ -99,12 +99,14 @@ public class CardInfoPoolService extends SuperService {
             if (ObjectUtils.isNotEmpty(temp) && !temp.getId().equals(entity.getId())) {
                 return ResultContent.buildFail(String.format("卡号已存在:%s", param.getCode()));
             }
+            initUpdateEntity(entity);
         } else {
             entity = new CardInfoPool();
             if (ObjectUtils.isNotEmpty(temp)) {
                 return ResultContent.buildFail(String.format("卡号已存在:%s", param.getCode()));
             }
             entity.setIsUsed(Boolean.FALSE);
+            initEntityNoCheckOid(entity);
         }
         BeanUtils.copyProperties(param, entity, "isUsed");
 
@@ -145,7 +147,7 @@ public class CardInfoPoolService extends SuperService {
     }
 
     /**
-     * 恢复卡片
+     * 恢复卡片 (把卡片变成未使用)
      *
      * @param param
      * @return
@@ -155,7 +157,12 @@ public class CardInfoPoolService extends SuperService {
         if (ObjectUtils.isEmpty(entity)) {
             return ResultContent.buildFail(String.format(ResultMessage.DATA_NOT_EXIST, param.getId()));
         }
+        // 判断是否可以恢复
+
         entity.setIsUsed(Boolean.FALSE);
+        entity.setCardCancelState(CardCancelState.Common);
+        entity.setUseTime(0L);
+        entity.setUseUserId("");
         cardInfoPoolDao.save(entity);
         return ResultContent.buildSuccess(toModel(entity));
     }