Selaa lähdekoodia

Merge branch 'dev' of xiongzhu/zhumj into master

wangqifan 4 vuotta sitten
vanhempi
commit
fb04fccc9a

+ 4 - 0
src/main/java/com/izouma/zhumj/domain/StoreInfo.java

@@ -86,6 +86,10 @@ public class StoreInfo extends BaseEntity implements Serializable {
     @ApiModelProperty(value = "有效", name = "enabled")
     @ApiModelProperty(value = "有效", name = "enabled")
     private Boolean enabled = true;
     private Boolean enabled = true;
 
 
+    @Column(nullable = false)
+    @ApiModelProperty(value = "有效", name = "enabled")
+    private Boolean canPay = true;
+
     @OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
     @OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
     @JoinColumn(name = "storeId")
     @JoinColumn(name = "storeId")
     @JsonIgnore
     @JsonIgnore

+ 2 - 0
src/main/java/com/izouma/zhumj/repo/StoreInfoRepo.java

@@ -21,4 +21,6 @@ public interface StoreInfoRepo extends JpaRepository<StoreInfo, Long>, JpaSpecif
     List<StoreInfo> findAllByCity(String city);
     List<StoreInfo> findAllByCity(String city);
 
 
     List<StoreInfo> findAllByStoreStatus(StoreStatus storeStatus);
     List<StoreInfo> findAllByStoreStatus(StoreStatus storeStatus);
+
+    List<StoreInfo> findAllByCanPay(boolean canPay);
 }
 }

+ 7 - 17
src/main/java/com/izouma/zhumj/service/client/ClientRoomInfoService.java

@@ -65,12 +65,13 @@ public class ClientRoomInfoService {
     private final MemberRepo          memberRepo;
     private final MemberRepo          memberRepo;
     private final AlipayClient        alipayClient;
     private final AlipayClient        alipayClient;
     private final AmmeterService      ammeterService;
     private final AmmeterService      ammeterService;
+    private final StoreInfoRepo       storeInfoRepo;
 
 
     public ClientRoomInfoService(UserRepo userRepo, CheckinInfoRepo checkinInfoRepo, WxPayService wxPayService,
     public ClientRoomInfoService(UserRepo userRepo, CheckinInfoRepo checkinInfoRepo, WxPayService wxPayService,
                                  WxMpService wxMpService, Environment environment, PersonalFeeRepo personalFeeRepo,
                                  WxMpService wxMpService, Environment environment, PersonalFeeRepo personalFeeRepo,
                                  PersonalFeeTypeRepo personalFeeTypeRepo, ContractRepo contractRepo,
                                  PersonalFeeTypeRepo personalFeeTypeRepo, ContractRepo contractRepo,
                                  RoomFeeRepo roomFeeRepo, FeeTypeRepo feeTypeRepo, UserMoneyRecordRepo userMoneyRecordRepo,
                                  RoomFeeRepo roomFeeRepo, FeeTypeRepo feeTypeRepo, UserMoneyRecordRepo userMoneyRecordRepo,
-                                 MemberRepo memberRepo, AlipayClient alipayClient, AmmeterService ammeterService) {
+                                 MemberRepo memberRepo, AlipayClient alipayClient, AmmeterService ammeterService, StoreInfoRepo storeInfoRepo) {
         this.userRepo = userRepo;
         this.userRepo = userRepo;
         this.checkinInfoRepo = checkinInfoRepo;
         this.checkinInfoRepo = checkinInfoRepo;
         this.wxPayService = wxPayService;
         this.wxPayService = wxPayService;
@@ -82,6 +83,7 @@ public class ClientRoomInfoService {
         this.memberRepo = memberRepo;
         this.memberRepo = memberRepo;
         this.alipayClient = alipayClient;
         this.alipayClient = alipayClient;
         this.ammeterService = ammeterService;
         this.ammeterService = ammeterService;
+        this.storeInfoRepo = storeInfoRepo;
     }
     }
 
 
     public ClientRoomInfoDTO getClientRoomInfoDTO(Long userId) {
     public ClientRoomInfoDTO getClientRoomInfoDTO(Long userId) {
@@ -145,14 +147,8 @@ public class ClientRoomInfoService {
 
 
     public Object payDeposit(Long userId, Long checkinInfoId, PayMethod payMethod) throws WxPayException, AlipayApiException {
     public Object payDeposit(Long userId, Long checkinInfoId, PayMethod payMethod) throws WxPayException, AlipayApiException {
         CheckinInfo checkinInfo = checkinInfoRepo.findById(checkinInfoId).orElseThrow(new BusinessException("无记录"));
         CheckinInfo checkinInfo = checkinInfoRepo.findById(checkinInfoId).orElseThrow(new BusinessException("无记录"));
-        List<Long> storeIds = new ArrayList<>();
-        storeIds.add(44496L);
-        storeIds.add(38585L);
-        storeIds.add(2619152L);
-        storeIds.add(5708L);
-        storeIds.add(27086608L);
-        storeIds.add(90225L);
-        storeIds.add(15272L);
+        List<Long> storeIds = storeInfoRepo.findAllByCanPay(false).stream().map(StoreInfo::getId)
+                .collect(Collectors.toList());
         if (storeIds.stream().anyMatch(storeId -> storeId.equals(checkinInfo.getStoreId()))) {
         if (storeIds.stream().anyMatch(storeId -> storeId.equals(checkinInfo.getStoreId()))) {
             throw new BusinessException("本门店交易功能已被关闭.");
             throw new BusinessException("本门店交易功能已被关闭.");
         }
         }
@@ -239,14 +235,8 @@ public class ClientRoomInfoService {
         User user = userRepo.findById(userId).orElseThrow(new BusinessException("无记录"));
         User user = userRepo.findById(userId).orElseThrow(new BusinessException("无记录"));
         CheckinInfo checkinInfo = checkinInfoRepo.findFirstByIdNoOrderByCheckinTimeDescCreatedAtDesc(user.getIdNo())
         CheckinInfo checkinInfo = checkinInfoRepo.findFirstByIdNoOrderByCheckinTimeDescCreatedAtDesc(user.getIdNo())
                 .orElseThrow(new BusinessException("无记录"));
                 .orElseThrow(new BusinessException("无记录"));
-        List<Long> storeIds = new ArrayList<>();
-        storeIds.add(44496L);
-        storeIds.add(38585L);
-        storeIds.add(2619152L);
-        storeIds.add(5708L);
-        storeIds.add(27086608L);
-        storeIds.add(90225L);
-        storeIds.add(15272L);
+        List<Long> storeIds = storeInfoRepo.findAllByCanPay(false).stream().map(StoreInfo::getId)
+                .collect(Collectors.toList());
         if (storeIds.stream().anyMatch(storeId -> storeId.equals(checkinInfo.getStoreId()))) {
         if (storeIds.stream().anyMatch(storeId -> storeId.equals(checkinInfo.getStoreId()))) {
             throw new BusinessException("本门店交易功能已被关闭.");
             throw new BusinessException("本门店交易功能已被关闭.");
         }
         }

+ 3 - 0
src/main/vue/src/views/StoreInfoEdit.vue

@@ -84,6 +84,9 @@
             <el-form-item prop="enabled" label="有效">
             <el-form-item prop="enabled" label="有效">
                 <el-switch v-model="formData.enabled"></el-switch>
                 <el-switch v-model="formData.enabled"></el-switch>
             </el-form-item>
             </el-form-item>
+            <el-form-item prop="enabled" label="有效">
+                <el-switch v-model="formData.canPay"></el-switch>
+            </el-form-item>
             <el-form-item>
             <el-form-item>
                 <el-button @click="onSave" :loading="$store.state.fetchingData" type="primary">保存</el-button>
                 <el-button @click="onSave" :loading="$store.state.fetchingData" type="primary">保存</el-button>
                 <el-button @click="onDelete" :loading="$store.state.fetchingData" type="danger" v-if="formData.id"
                 <el-button @click="onDelete" :loading="$store.state.fetchingData" type="danger" v-if="formData.id"