wangqifan 3 rokov pred
rodič
commit
c966b386ef

+ 5 - 5
pom.xml

@@ -116,10 +116,10 @@
             <optional>true</optional>
         </dependency>
 
-<!--        <dependency>-->
-<!--            <groupId>org.springframework.boot</groupId>-->
-<!--            <artifactId>spring-boot-starter-data-redis</artifactId>-->
-<!--        </dependency>-->
+        <!--        <dependency>-->
+        <!--            <groupId>org.springframework.boot</groupId>-->
+        <!--            <artifactId>spring-boot-starter-data-redis</artifactId>-->
+        <!--        </dependency>-->
 
         <dependency>
             <groupId>org.springframework.boot</groupId>
@@ -172,7 +172,7 @@
         <dependency>
             <groupId>com.github.binarywang</groupId>
             <artifactId>weixin-java-pay</artifactId>
-            <version>${javawx.version}</version>
+            <version>4.2.0</version>
         </dependency>
 
         <dependency>

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

@@ -18,6 +18,8 @@ public interface StoreInfoRepo extends JpaRepository<StoreInfo, Long>, JpaSpecif
 
     StoreInfo findFirstByStoreName(String storeName);
 
+    List<StoreInfo> findAllByCompanyId(Long companyId);
+
     List<StoreInfo> findAllByCity(String city);
 
     List<StoreInfo> findAllByStoreStatus(StoreStatus storeStatus);

+ 2 - 3
src/main/java/com/izouma/zhumj/service/GenCodeService.java

@@ -5,7 +5,6 @@ import com.izouma.zhumj.dto.gen.TableField;
 import freemarker.template.Configuration;
 import freemarker.template.Template;
 import freemarker.template.TemplateException;
-import jodd.util.StringUtil;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -36,12 +35,12 @@ public class GenCodeService {
                 Paths.get(model.getJavaPath(), "web", model.getGenPackage(), model.getClassName() + "Controller.java").toAbsolutePath() :
                 Paths.get(model.getJavaPath(), "web", model.getClassName() + "Controller.java").toAbsolutePath();
         Map<String, Object> extra = new HashMap<>();
-        if (StringUtil.isNotEmpty(model.getGenPackage())) {
+        if (StringUtils.isNotEmpty(model.getGenPackage())) {
             List<String> imports = new ArrayList<>();
             imports.add("import " + model.getBasePackage() + ".web.BaseController;");
             extra.put("imports", imports);
         }
-        extra.put("subPackage", StringUtil.isNotEmpty(model.getGenPackage()));
+        extra.put("subPackage", StringUtils.isNotEmpty(model.getGenPackage()));
         genFile("ControllerTemplate.ftl", model, extra, targetFile);
         log.info("成功生成Controller:{}", targetFile.toString());
     }

+ 2 - 3
src/main/java/com/izouma/zhumj/service/RechargeRecordService.java

@@ -11,7 +11,6 @@ import com.izouma.zhumj.event.CheckinUpdateEvent;
 import com.izouma.zhumj.exception.BusinessException;
 import com.izouma.zhumj.repo.*;
 import com.izouma.zhumj.service.ammeter.AmmeterApi;
-import jodd.util.StringUtil;
 import lombok.AllArgsConstructor;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.context.ApplicationContext;
@@ -100,7 +99,7 @@ public class RechargeRecordService {
             record.setAmmeterType(roomInfo.getAmmeterType());
             record.setAmmeterId(roomInfo.getAmmeterId());
 
-            if (roomInfo.getAmmeterType() == null || StringUtil.isEmpty(roomInfo.getAmmeterId())) {
+            if (roomInfo.getAmmeterType() == null || StringUtils.isBlank(roomInfo.getAmmeterId())) {
                 throw new BusinessException("此房间没有绑定电表");
             }
             AmmeterApi ammeterApi = (AmmeterApi) context.getBean(roomInfo.getAmmeterType().name());
@@ -186,7 +185,7 @@ public class RechargeRecordService {
             record.setAmmeterType(roomInfo.getAmmeterType());
             record.setAmmeterId(roomInfo.getAmmeterId());
 
-            if (roomInfo.getAmmeterType() == null || StringUtil.isEmpty(roomInfo.getAmmeterId())) {
+            if (roomInfo.getAmmeterType() == null || StringUtils.isBlank(roomInfo.getAmmeterId())) {
                 throw new BusinessException("此房间没有绑定电表");
             }
             AmmeterApi ammeterApi = (AmmeterApi) context.getBean(roomInfo.getAmmeterType().name());

+ 4 - 5
src/main/java/com/izouma/zhumj/service/RoomMoneyWithdrawApplyService.java

@@ -12,7 +12,6 @@ import com.izouma.zhumj.repo.CheckinInfoRepo;
 import com.izouma.zhumj.repo.RoomInfoRepo;
 import com.izouma.zhumj.repo.RoomMoneyWithdrawApplyRepo;
 import com.izouma.zhumj.repo.UserRepo;
-import jodd.util.StringUtil;
 import lombok.AllArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.RandomStringUtils;
@@ -77,7 +76,7 @@ public class RoomMoneyWithdrawApplyService {
         if (Optional.ofNullable(roomInfo.getBalance()).orElse(BigDecimal.ZERO).compareTo(apply.getAmount()) < 0) {
             throw new BusinessException("余额不足");
         }
-        if (StringUtil.isEmpty(apply.getTradeNo())) {
+        if (StringUtils.isEmpty(apply.getTradeNo())) {
             apply.setTradeNo(RandomStringUtils.randomAlphanumeric(32));
             roomMoneyWithdrawApplyRepo.saveAndFlush(apply);
         }
@@ -88,9 +87,9 @@ public class RoomMoneyWithdrawApplyService {
             request.setOpenid(user.getOpenId());
             request.setCheckName("NO_CHECK");
             request.setDescription(
-                    roomInfo.getStoreInfo().getStoreName()+","
-                    +roomInfo.getRoomName()+","
-                    +"房间余额提现");
+                    roomInfo.getStoreInfo().getStoreName() + ","
+                            + roomInfo.getRoomName() + ","
+                            + "房间余额提现");
             request.setSpbillCreateIp("192.168.31.12");
             EntPayResult result = wxPayService.getEntPayService().entPay(request);
             result.checkResult(wxPayService, "MD5", true);

+ 1 - 2
src/main/java/com/izouma/zhumj/service/UserMoneyWithdrawApplyService.java

@@ -14,7 +14,6 @@ import com.izouma.zhumj.repo.MemberRepo;
 import com.izouma.zhumj.repo.UserMoneyWithdrawApplyRepo;
 import com.izouma.zhumj.repo.UserRepo;
 import com.izouma.zhumj.utils.SecurityUtils;
-import jodd.util.StringUtil;
 import lombok.AllArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.RandomStringUtils;
@@ -78,7 +77,7 @@ public class UserMoneyWithdrawApplyService {
         if (Optional.ofNullable(memberInfo.getMoney()).orElse(BigDecimal.ZERO).compareTo(apply.getAmount()) < 0) {
             throw new BusinessException("余额不足");
         }
-        if (StringUtil.isEmpty(apply.getTradeNo())) {
+        if (StringUtils.isEmpty(apply.getTradeNo())) {
             apply.setTradeNo(RandomStringUtils.randomAlphanumeric(32));
             userMoneyWithdrawApplyRepo.saveAndFlush(apply);
         }

+ 132 - 0
src/main/java/com/izouma/zhumj/service/client/ClientRoomInfoService.java

@@ -7,10 +7,13 @@ import com.alipay.api.domain.AlipayTradeAppPayModel;
 import com.alipay.api.request.AlipayTradeAppPayRequest;
 import com.alipay.api.request.AlipayTradeWapPayRequest;
 import com.alipay.api.response.AlipayTradeAppPayResponse;
+import com.github.binarywang.wxpay.bean.ecommerce.PartnerTransactionsRequest;
+import com.github.binarywang.wxpay.bean.ecommerce.enums.TradeTypeEnum;
 import com.github.binarywang.wxpay.bean.order.WxPayMpOrderResult;
 import com.github.binarywang.wxpay.bean.request.WxPayUnifiedOrderRequest;
 import com.github.binarywang.wxpay.constant.WxPayConstants;
 import com.github.binarywang.wxpay.exception.WxPayException;
+import com.github.binarywang.wxpay.service.EcommerceService;
 import com.github.binarywang.wxpay.service.WxPayService;
 import com.izouma.zhumj.config.Constants;
 import com.izouma.zhumj.domain.*;
@@ -58,6 +61,7 @@ public class ClientRoomInfoService {
     private final FeeTypeRepo         feeTypeRepo;
     private final UserMoneyRecordRepo userMoneyRecordRepo;
     private final MemberRepo          memberRepo;
+//    private final EcommerceService    ecommerceService;
 //    private final AlipayClient        alipayClient;
 
     public ClientRoomInfoService(UserRepo userRepo, CheckinInfoRepo checkinInfoRepo, WxPayService wxPayService,
@@ -75,6 +79,7 @@ public class ClientRoomInfoService {
         this.userMoneyRecordRepo = userMoneyRecordRepo;
         this.memberRepo = memberRepo;
 //        this.alipayClient = alipayClient;
+//        this.ecommerceService = ecommerceService;
     }
 
     public ClientRoomInfoDTO getClientRoomInfoDTO(Long userId) {
@@ -335,4 +340,131 @@ public class ClientRoomInfoService {
             return new PageImpl<>(new ArrayList<>(), pageable, 0);
         }
     }
+
+    public Object subRecharge(Long userId, BigDecimal amount, RechargeType type, PayMethod payMethod) throws WxPayException, AlipayApiException {
+        if (amount.compareTo(BigDecimal.valueOf(0.01)) < 0) {
+            throw new BusinessException("最少充值0.01元");
+        }
+        User user = userRepo.findById(userId).orElseThrow(new BusinessException("无记录"));
+        CheckinInfo checkinInfo = checkinInfoRepo.findFirstByIdNoOrderByCheckinTimeDescCreatedAtDesc(user.getIdNo())
+                .orElseThrow(new BusinessException("无记录"));
+        String storeName = Optional.ofNullable(checkinInfo.getStoreInfo())
+                .map(StoreInfo::getStoreName)
+                .orElse(null);
+        String bedName = Optional.ofNullable(checkinInfo.getBedInfo())
+                .map(BedInfo::getBedName)
+                .orElse(null);
+        String body = "";
+        switch (type) {
+            case ROOM:
+                body = "房间余额充值";
+                break;
+            case PERSON:
+                body = "账户余额充值";
+                break;
+            case AMMETER:
+                body = "电表充值";
+                break;
+            default:
+                body = "充值";
+        }
+        if (StringUtils.isNotEmpty(storeName)) {
+            body += "," + storeName;
+        }
+        if (StringUtils.isNotEmpty(bedName)) {
+            body += "," + bedName;
+        }
+
+
+        switch (payMethod) {
+            case WEIXIN:
+                WxPayUnifiedOrderRequest request;
+                PartnerTransactionsRequest partnerTransactionsRequest;
+                partnerTransactionsRequest = new PartnerTransactionsRequest();
+                partnerTransactionsRequest.setOutTradeNo(String.valueOf(new SnowflakeIdWorker(1, 1).nextId()));
+                partnerTransactionsRequest.setNotifyUrl(wxNotifyUrl);
+
+                PartnerTransactionsRequest.Payer payer = new PartnerTransactionsRequest.Payer();
+                payer.setSpOpenid(user.getOpenId());
+                payer.setSpOpenid(user.getOpenId());
+                partnerTransactionsRequest.setPayer(payer);
+
+                PartnerTransactionsRequest.SettleInfo settleInfo = new PartnerTransactionsRequest.SettleInfo();
+                partnerTransactionsRequest.setSettleInfo(settleInfo);
+                partnerTransactionsRequest.setDescription(body);
+
+                partnerTransactionsRequest.setOutTradeNo(String.valueOf(new SnowflakeIdWorker(1, 1).nextId()));
+                partnerTransactionsRequest.setAttach(new JsonUtils.Builder()
+                        .add(Constants.ATTACH_TYPE, "recharge")
+                        .add(Constants.ATTACH_RECHARGE_TYPE, type.name())
+                        .add(Constants.ATTACH_CHECKIN_ID, checkinInfo.getId())
+                        .add(Constants.ATTACH_USER_ID, userId)
+                        .add(Constants.ATTACH_AMOUNT, amount)
+                        .add(Constants.ATTACH_REMARK, "")
+                        .build());
+
+
+                PartnerTransactionsRequest.Amount requestAmount = new PartnerTransactionsRequest.Amount();
+                requestAmount.setTotal(amount.multiply(BigDecimal.valueOf(100)).intValue());
+                requestAmount.setCurrency("CNY");
+                partnerTransactionsRequest.setAmount(requestAmount);
+                request = new WxPayUnifiedOrderRequest();
+                request.setSpbillCreateIp("180.102.110.170");
+                request.setNotifyUrl(wxNotifyUrl);
+                request.setTradeType(WxPayConstants.TradeType.JSAPI);
+                request.setOpenid(user.getOpenId());
+                request.setSignType("MD5");
+                request.setOutTradeNo(String.valueOf(new SnowflakeIdWorker(1, 1).nextId()));
+                request.setTotalFee(amount.multiply(BigDecimal.valueOf(100)).intValue());
+                request.setAttach(new JsonUtils.Builder()
+                        .add(Constants.ATTACH_TYPE, "recharge")
+                        .add(Constants.ATTACH_RECHARGE_TYPE, type.name())
+                        .add(Constants.ATTACH_CHECKIN_ID, checkinInfo.getId())
+                        .add(Constants.ATTACH_USER_ID, userId)
+                        .add(Constants.ATTACH_AMOUNT, amount)
+                        .add(Constants.ATTACH_REMARK, "")
+                        .build());
+
+                request.setBody(body);
+
+                // 测试环境设为1分
+                if (Arrays.stream(environment.getActiveProfiles()).noneMatch(s -> s.equals("prod"))) {
+                    // request.setTotalFee(1);
+                }
+                return wxPayService.getEcommerceService()
+                        .partnerTransactions(TradeTypeEnum.JSAPI, partnerTransactionsRequest);
+//            case ALIPAY:
+//                AlipayTradeAppPayRequest alipayRequest = new AlipayTradeAppPayRequest();
+//                AlipayTradeAppPayModel model = new AlipayTradeAppPayModel();
+//                model.setOutTradeNo(UUID.randomUUID().toString());
+//                model.setSubject(body);
+//                model.setTotalAmount(amount.toString());
+//                model.setDisablePayChannels("pcredit,creditCard");
+//                model.setProductCode("QUICK_MSECURITY_PAY");
+//                model.setBody(new JsonUtils.Builder()
+//                        .add(Constants.ATTACH_TYPE, "recharge")
+//                        .add(Constants.ATTACH_RECHARGE_TYPE, type.name())
+//                        .add(Constants.ATTACH_CHECKIN_ID, checkinInfo.getId())
+//                        .add(Constants.ATTACH_USER_ID, userId)
+//                        .add(Constants.ATTACH_AMOUNT, amount)
+//                        .add(Constants.ATTACH_REMARK, "")
+//                        .build());
+//                if (Arrays.stream(environment.getActiveProfiles()).noneMatch(s -> s.equals("prod"))) {
+//                    // 测试环境设为1分
+////                    model.setTotalAmount("0.01");
+//                }
+//
+//                alipayRequest.setNotifyUrl(aliNotifyUrl);
+//                alipayRequest.setBizModel(model);
+//
+//                AlipayTradeAppPayResponse response = alipayClient.sdkExecute(alipayRequest);
+//                if (response.isSuccess()) {
+//                    return response.getBody();
+//                } else {
+//                    throw new BusinessException("支付宝下单失败");
+//                }
+            default:
+                throw new BusinessException("不支持此支付方式");
+        }
+    }
 }

+ 2 - 3
src/main/java/com/izouma/zhumj/service/report/ReportService.java

@@ -16,7 +16,6 @@ import com.izouma.zhumj.service.FinancialService;
 import com.izouma.zhumj.service.RoomRateService;
 import com.izouma.zhumj.utils.BeanCopierUtils;
 import com.izouma.zhumj.utils.SecurityUtils;
-import jodd.util.StringUtil;
 import lombok.AllArgsConstructor;
 import org.apache.commons.collections.list.CursorableLinkedList;
 import org.apache.commons.lang3.StringUtils;
@@ -2675,7 +2674,7 @@ public class ReportService {
 //                                            .collect(Collectors.toList());
 //                                    and.add(root.get("saleId").in(saleIds));
 //                                }
-                                    if (StringUtil.isNotBlank(city)) {
+                                    if (StringUtils.isNotBlank(city)) {
                                         List<Long> storeIds = storeInfoRepo.findAllByCity(city)
                                                 .stream()
                                                 .map(StoreInfo::getId)
@@ -2946,7 +2945,7 @@ public class ReportService {
 //                                            .collect(Collectors.toList());
 //                                    and.add(root.get("saleId").in(saleIds));
 //                                }
-                                if (StringUtil.isNotBlank(city)) {
+                                if (StringUtils.isNotBlank(city)) {
                                     List<Long> storeIds = storeInfoRepo.findAllByCity(city)
                                             .stream()
                                             .map(StoreInfo::getId)

+ 11 - 1
src/main/java/com/izouma/zhumj/web/StoreInfoController.java

@@ -14,6 +14,7 @@ import com.izouma.zhumj.utils.SecurityUtils;
 import com.izouma.zhumj.utils.excel.ExcelUtils;
 import lombok.AllArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang.StringUtils;
 import org.springframework.data.domain.Page;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
@@ -48,12 +49,21 @@ public class StoreInfoController extends BaseController {
     //@PreAuthorize("hasRole('ADMIN')")
     @GetMapping("/all")
     public Page<StoreInfo> all(PageQuery pageQuery) {
+        Map<String, Object> query = pageQuery.getQuery();
+        if (SecurityUtils.getAuthenticatedUser().getCompanyId() != null) {
+            query.put("companyId", SecurityUtils.getAuthenticatedUser().getCompanyId());
+            pageQuery.setQuery(query);
+        }
         return storeInfoRepo.findAll(toSpecification(pageQuery, StoreInfo.class), toPageRequest(pageQuery));
     }
 
     @GetMapping("/allWithoutPage")
     public List<StoreInfo> allWithoutPage() {
-        return storeInfoRepo.findAll();
+        if (SecurityUtils.getAuthenticatedUser().getCompanyId() == null) {
+            return storeInfoRepo.findAll();
+        } else {
+            return storeInfoRepo.findAllByCompanyId(SecurityUtils.getAuthenticatedUser().getCompanyId());
+        }
     }
 
     @GetMapping("/allByUser")

+ 2 - 2
src/main/java/com/izouma/zhumj/web/UserController.java

@@ -11,8 +11,8 @@ import com.izouma.zhumj.service.UserService;
 import com.izouma.zhumj.utils.ObjUtils;
 import com.izouma.zhumj.utils.SecurityUtils;
 import com.izouma.zhumj.utils.excel.ExcelUtils;
-import jodd.util.StringUtil;
 import lombok.AllArgsConstructor;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.data.domain.Page;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
@@ -52,7 +52,7 @@ public class UserController extends BaseController {
             ObjUtils.merge(orig, user);
             return userRepo.save(orig);
         }
-        if (StringUtil.isNotBlank(user.getPassword())) {
+        if (StringUtils.isNotBlank(user.getPassword())) {
             user.setPassword(new BCryptPasswordEncoder().encode(user.getPassword()));
         }
         return userRepo.save(user);

+ 3 - 3
src/main/vue/src/router.js

@@ -2035,7 +2035,7 @@ const router = new Router({
                     name: 'CompanyEdit',
                     component: () => import(/* webpackChunkName: "companyEdit" */ '@/views/CompanyEdit.vue'),
                     meta: {
-                       title: 'Company编辑',
+                       title: '公司编辑',
                     },
                 },
                 {
@@ -2043,7 +2043,7 @@ const router = new Router({
                     name: 'CompanyList',
                     component: () => import(/* webpackChunkName: "companyList" */ '@/views/CompanyList.vue'),
                     meta: {
-                       title: 'Company',
+                       title: '公司信息',
                     },
                }
                 /**INSERT_LOCATION**/
@@ -2105,4 +2105,4 @@ router.beforeEach((to, from, next) => {
     }
 });
 
-export default router;
+export default router;

+ 4 - 7
src/main/vue/src/views/CompanyEdit.vue

@@ -2,21 +2,18 @@
     <div class="edit-view">
         <el-form :model="formData" :rules="rules" ref="form" label-width="139px" label-position="right" size="small"
                  style="max-width: 500px;">
-                <el-form-item prop="companyName" label="companyName">
+                <el-form-item prop="companyName" label="公司名称">
                             <el-input v-model="formData.companyName"></el-input>
                 </el-form-item>
-                <el-form-item prop="companyPrincipal" label="companyPrincipal">
+                <el-form-item prop="companyPrincipal" label="公司负责人">
                             <el-input v-model="formData.companyPrincipal"></el-input>
                 </el-form-item>
-                <el-form-item prop="appId" label="appId">
+                <el-form-item prop="appId" label="商户号">
                             <el-input v-model="formData.appId"></el-input>
                 </el-form-item>
-                <el-form-item prop="paySecret" label="paySecret">
+                <el-form-item prop="paySecret" label="微信支付密钥">
                             <el-input v-model="formData.paySecret"></el-input>
                 </el-form-item>
-                <el-form-item prop="userId" label="userId">
-                            <el-input-number type="number" v-model="formData.userId"></el-input-number>
-                </el-form-item>
             <el-form-item>
                 <el-button @click="onSave" :loading="$store.state.fetchingData"
                            type="primary">保存</el-button>

+ 112 - 115
src/main/vue/src/views/CompanyList.vue

@@ -1,12 +1,12 @@
 <template>
-    <div  class="list-view">
+    <div class="list-view">
         <div class="filters-container">
             <el-input placeholder="输入关键字" v-model="search" clearable
                       class="filter-item"></el-input>
             <el-button @click="getData" type="primary" icon="el-icon-search"
                        class="filter-item">搜索
             </el-button>
-            <el-button @click="addRow" v-if="canEdit" type="primary" icon="el-icon-plus"
+            <el-button @click="addRow" type="primary" icon="el-icon-plus"
                        class="filter-item">添加
             </el-button>
             <el-button @click="download" type="primary" icon="el-icon-download"
@@ -23,27 +23,24 @@
             </el-table-column>
             <el-table-column prop="id" label="ID" width="100">
             </el-table-column>
-                                <el-table-column prop="companyName" label="companyName"
->
-                    </el-table-column>
-                    <el-table-column prop="companyPrincipal" label="companyPrincipal"
->
-                    </el-table-column>
-                    <el-table-column prop="appId" label="appId"
->
-                    </el-table-column>
-                    <el-table-column prop="paySecret" label="paySecret"
->
-                    </el-table-column>
-                    <el-table-column prop="userId" label="userId"
->
-                    </el-table-column>
+            <el-table-column prop="companyName" label="公司名称"
+            >
+            </el-table-column>
+            <el-table-column prop="companyPrincipal" label="公司负责人"
+            >
+            </el-table-column>
+            <el-table-column prop="appId" label="商户号"
+            >
+            </el-table-column>
+            <el-table-column prop="paySecret" label="商户密钥"
+            >
+            </el-table-column>
             <el-table-column
-                    label="操作"
-                    v-if="canEdit"
-                    align="center"
-                    fixed="right"
-                    min-width="150">
+                label="操作"
+                v-if="canEdit"
+                align="center"
+                fixed="right"
+                min-width="150">
                 <template slot-scope="{row}">
                     <el-button @click="editRow(row)" type="primary" size="mini" plain>编辑</el-button>
                     <el-button @click="deleteRow(row)" type="danger" size="mini" plain>删除</el-button>
@@ -70,108 +67,108 @@
     </div>
 </template>
 <script>
-    import { mapState } from "vuex";
-    import pageableTable from "@/mixins/pageableTable";
+import {mapState} from "vuex";
+import pageableTable from "@/mixins/pageableTable";
 
-    export default {
-        name: 'CompanyList',
-        mixins: [pageableTable],
-        created() {
-            this.getData();
-        },
-        data() {
-            return {
-                multipleMode: false,
-                search: "",
-                url: "/company/all",
-                downloading: false,
+export default {
+    name: 'CompanyList',
+    mixins: [pageableTable],
+    created() {
+        this.getData();
+    },
+    data() {
+        return {
+            multipleMode: false,
+            search: "",
+            url: "/company/all",
+            downloading: false,
+        }
+    },
+    computed: {
+        selection() {
+            return this.$refs.table.selection.map(i => i.id);
+        }
+    },
+    methods: {
+        beforeGetData() {
+            if (this.search) {
+                return {search: this.search};
             }
         },
-        computed: {
-            selection() {
-                return this.$refs.table.selection.map(i => i.id);
+        toggleMultipleMode(multipleMode) {
+            this.multipleMode = multipleMode;
+            if (!multipleMode) {
+                this.$refs.table.clearSelection();
             }
         },
-        methods: {
-            beforeGetData() {
-                if (this.search) {
-                    return { search: this.search };
-                }
-            },
-            toggleMultipleMode(multipleMode) {
-                this.multipleMode = multipleMode;
-                if (!multipleMode) {
-                    this.$refs.table.clearSelection();
-                }
-            },
-            addRow() {
-                this.$router.push({
-                    path: "/companyEdit",
-                    query: {
+        addRow() {
+            this.$router.push({
+                path: "/companyEdit",
+                query: {
                     ...this.$route.query
-                    }
-                });
-            },
-            editRow(row) {
-                this.$router.push({
-                    path: "/companyEdit",
-                    query: {
+                }
+            });
+        },
+        editRow(row) {
+            this.$router.push({
+                path: "/companyEdit",
+                query: {
                     id: row.id
-                    }
-                });
-            },
-            download() {
-                this.downloading = true;
-                this.$axios
-                    .get("/company/excel", {
-                        responseType: "blob",
-                        params: { size: 10000 }
-                    })
-                    .then(res => {
-                        console.log(res);
-                        this.downloading = false;
-                        const downloadUrl = window.URL.createObjectURL(new Blob([res.data]));
-                        const link = document.createElement("a");
-                        link.href = downloadUrl;
-                        link.setAttribute(
-                            "download",
-                            res.headers["content-disposition"].split("filename=")[1]
-                        );
-                        document.body.appendChild(link);
-                        link.click();
-                        link.remove();
-                    })
-                    .catch(e => {
-                        console.log(e);
-                        this.downloading = false;
-                        this.$message.error(e.error);
-                    });
-            },
-            operation1() {
-                this.$notify({
-                    title: '提示',
-                    message: this.selection
-                });
-            },
-            operation2() {
-                this.$message('操作2');
-            },
-            deleteRow(row) {
-                this.$alert('删除将无法恢复,确认要删除么?', '警告', {type: 'error'}).then(() => {
-                    return this.$http.post(`/company/del/${row.id}`)
-                }).then(() => {
-                    this.$message.success('删除成功');
-                    this.getData();
-                }).catch(action => {
-                    if (action === 'cancel') {
-                        this.$message.info('删除取消');
-                    } else {
-                        this.$message.error('删除失败');
-                    }
+                }
+            });
+        },
+        download() {
+            this.downloading = true;
+            this.$axios
+                .get("/company/excel", {
+                    responseType: "blob",
+                    params: {size: 10000}
                 })
-            },
-        }
+                .then(res => {
+                    console.log(res);
+                    this.downloading = false;
+                    const downloadUrl = window.URL.createObjectURL(new Blob([res.data]));
+                    const link = document.createElement("a");
+                    link.href = downloadUrl;
+                    link.setAttribute(
+                        "download",
+                        res.headers["content-disposition"].split("filename=")[1]
+                    );
+                    document.body.appendChild(link);
+                    link.click();
+                    link.remove();
+                })
+                .catch(e => {
+                    console.log(e);
+                    this.downloading = false;
+                    this.$message.error(e.error);
+                });
+        },
+        operation1() {
+            this.$notify({
+                title: '提示',
+                message: this.selection
+            });
+        },
+        operation2() {
+            this.$message('操作2');
+        },
+        deleteRow(row) {
+            this.$alert('删除将无法恢复,确认要删除么?', '警告', {type: 'error'}).then(() => {
+                return this.$http.post(`/company/del/${row.id}`)
+            }).then(() => {
+                this.$message.success('删除成功');
+                this.getData();
+            }).catch(action => {
+                if (action === 'cancel') {
+                    this.$message.info('删除取消');
+                } else {
+                    this.$message.error('删除失败');
+                }
+            })
+        },
     }
+}
 </script>
 <style lang="less" scoped>
 </style>

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

@@ -82,6 +82,9 @@
             <el-form-item prop="remark" label="备注">
                 <el-input v-model="formData.remark"></el-input>
             </el-form-item>
+            <el-form-item prop="companyId" label="公司ID">
+                <el-switch v-model="formData.companyId"></el-switch>
+            </el-form-item>
             <el-form-item prop="enabled" label="有效">
                 <el-switch v-model="formData.enabled"></el-switch>
             </el-form-item>

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

@@ -58,6 +58,9 @@
             <el-form-item prop="inBlackList" label="黑名单">
                 <el-switch v-model="formData.inBlackList"></el-switch>
             </el-form-item>
+            <el-form-item prop="companyId" label="公司ID">
+                <el-switch v-model="formData.companyId"></el-switch>
+            </el-form-item>
             <el-form-item>
                 <el-button class="filter-btn" @click="onSave" :loading="$store.state.fetchingData" type="primary"
                     >保存</el-button