Pine 6 éve
szülő
commit
40b4afe4fb

+ 2 - 2
src/main/java/com/izouma/zhumj/domain/sale/Contract.java

@@ -124,12 +124,12 @@ public class Contract extends BaseEntity implements Serializable {
      * 销售员ID
      */
     @ApiModelProperty(value = "销售员ID", name = "saleId")
-    private String saleId;
+    private Long saleId;
     /**
      * 销售员部门id(预留)
      */
     @ApiModelProperty(value = "销售员部门id(预留)", name = "departmentId")
-    private String departmentId;
+    private Long departmentId;
     /**
      * 销售员部门id(预留)
      */

+ 11 - 0
src/main/java/com/izouma/zhumj/domain/sale/Customer.java

@@ -89,9 +89,20 @@ public class Customer extends BaseEntity implements Serializable {
     @ApiModelProperty(value = "每月租金", name = "monthlyRent")
     private BigDecimal monthlyRent;
 
+    /**
+     * 签约销售ID
+     */
+    @ApiModelProperty(value = "签约销售ID", name = "saleId")
+    private Long saleId;
+
+    @ApiModelProperty(value = "签约销售名称", name = "saleName")
+    private String saleName;
+
     @Column(nullable = false)
     private Boolean enabled = true;
 
+
+
     public void synchronizeContractInfo(Contract contract) {
         //将合同信息更新到客户管理信息
         if (StringUtils.isEmpty(this.contractNumbers)) {

+ 1 - 0
src/main/java/com/izouma/zhumj/repo/sale/ContractRepo.java

@@ -18,4 +18,5 @@ public interface ContractRepo extends JpaRepository<Contract, Long>, JpaSpecific
     Contract findByContractNumber(String contractNumber);
     List<Contract> findAllBySaleId(Long saleId);
     List<Contract> findAllByContractEndTimeBetween(LocalDateTime startDate, LocalDateTime endDate);
+
 }

+ 4 - 0
src/main/java/com/izouma/zhumj/repo/sale/CustomerRepo.java

@@ -4,6 +4,10 @@ import com.izouma.zhumj.domain.sale.Customer;
 import org.springframework.data.jpa.repository.JpaRepository;
 import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
 
+import java.util.List;
+
 public interface CustomerRepo extends JpaRepository<Customer, Long>, JpaSpecificationExecutor<Customer> {
     Customer findByCoFullName(String coFullName);
+    List<Customer> findAllBySaleId(Long saleId);
+
 }

+ 2 - 0
src/main/java/com/izouma/zhumj/service/sale/CustomerService.java

@@ -56,6 +56,8 @@ public class CustomerService {
                 customer = new Customer();
                 customer.setCoFullName(contract.getCoFullName());
                 customer.setCoSimpleName(contract.getCoSimpleName());
+                customer.setSaleId(contract.getSaleId());
+                customer.setSaleName(contract.getSaleName());
             }
             customer.synchronizeContractInfo(contract);
             save(customer);

+ 38 - 0
src/main/java/com/izouma/zhumj/web/sale/SaleWorkController.java

@@ -0,0 +1,38 @@
+package com.izouma.zhumj.web.sale;
+import	java.util.HashMap;
+
+import com.izouma.zhumj.repo.sale.ContractRepo;
+import com.izouma.zhumj.repo.sale.CustomerRepo;
+import com.izouma.zhumj.utils.SecurityUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.Map;
+
+/**
+ * 销售个人工作台总计
+ * @Author: Pine
+ * @Date: 2019/10/19
+ * @Email:771190883@qq.com
+ */
+@RestController
+@RequestMapping("/saleWork")
+public class SaleWorkController {
+    @Autowired
+    private ContractRepo contractRepo;
+    @Autowired
+    private CustomerRepo customerRepo;
+
+    @GetMapping("/getTotalInfo")
+    public Map<String,Object> getTotalInfo(){
+        Long saleId = SecurityUtils.getAuthenticatedUser().getId();
+        int contract = contractRepo.findAllBySaleId(saleId).size();
+        int customer = customerRepo.findAllBySaleId(saleId).size();
+        Map<String,Object> data = new HashMap<String, Object> ();;
+        data.putIfAbsent("contract",contract);
+        data.putIfAbsent("customer",customer);
+        return data;
+    }
+}

+ 11 - 1
src/main/vue/src/views/sale/ContractList.vue

@@ -349,10 +349,14 @@
         name: 'ContractList',
         mixins: [pageableTable],
         created() {
+            if (this.$route.query.saleId) {
+                this.saleId = this.$route.query.saleId;
+            }
             this.getData();
         },
         data() {
             return {
+                saleId:'',
                 multipleMode: false,
                 renewalDataDialog: false,
                 residenceDataDialog: false,
@@ -522,9 +526,15 @@
                 return valueStr;
             },
             beforeGetData() {
+                let data = {
+                    query: {
+                        saleId: this.saleId,
+                    },
+                };
                 if (this.search) {
-                    return {search: this.search};
+                    data.search = this.search;
                 }
+                return data;
             },
             toggleMultipleMode(multipleMode) {
                 this.multipleMode = multipleMode;

+ 10 - 1
src/main/vue/src/views/sale/CustomerList.vue

@@ -143,6 +143,9 @@
         name: 'CustomerList',
         mixins: [pageableTable],
         created() {
+            if (this.$route.query.saleId) {
+                this.saleId = this.$route.query.saleId;
+            }
             this.getData();
         },
         data() {
@@ -160,9 +163,15 @@
         },
         methods: {
             beforeGetData() {
+                let data = {
+                    query: {
+                        saleId: this.saleId,
+                    },
+                };
                 if (this.search) {
-                    return { search: this.search };
+                    data.search = this.search;
                 }
+                return data;
             },
             toggleMultipleMode(multipleMode) {
                 this.multipleMode = multipleMode;

+ 0 - 1
src/main/vue/src/views/sale/RenewalList.vue

@@ -166,7 +166,6 @@ export default {
             if (this.search) {
                 data.search = this.search;
             }
-            console.log(data);
             return data;
         },
         toggleMultipleMode(multipleMode) {

+ 77 - 10
src/main/vue/src/views/sale/SaleWork.vue

@@ -1,30 +1,78 @@
 <template>
-    <div >
+    <div>
+        <el-card class="box-card">
+            <div slot="header" class="clearfix">.
+                <el-button type="primary" plain>{{this.userInfo.realName}}的工作台</el-button>
+            </div>
+            <div>
+                <el-form label-width="100px" ref="refundForm" status-icon width="500px">
+                    <el-row>
+                        <el-col :span="12" width="210px">
+                            <i class="el-icon-user"></i>
+                            <span>客户数 :     </span>  <el-button type="success" round @click="trap('customer')">{{this.workInfo.customer}}</el-button>
 
+                        </el-col>
+                        <el-col :span="12" width="210px">
+                            <i class="el-icon-edit-outline"></i>
+                            <span>合同数 :     </span><el-button type="success" round @click="trap('contract')">{{this.workInfo.contract}}</el-button>
+                        </el-col>
+                    </el-row>
+                </el-form>
+            </div>
+        </el-card>
     </div>
 </template>
 <script>
     import {mapState} from "vuex";
-    import pageableTable from "@/mixins/pageableTable";
 
     export default {
         name: 'SaleWork',
-        mixins: [pageableTable],
         created() {
-            this.getData();
+            this.getUser();
+            this.getWorkInfo();
         },
         data() {
             return {
-                multipleMode: false,
-            }
-        },
-        computed: {
-            selection() {
-                return this.$refs.table.selection.map(i => i.id);
+                userInfo:{},
+                workInfo: {},
             }
         },
+        computed: {},
         methods: {
+            getUser() {
+                this.$http.get("/user/my").then(res => {
+                    this.userInfo = res;
 
+                }).catch(e => {
+                    this.$message.error(e.error);
+                });
+            },
+            getWorkInfo(userId){
+                this.$http.get("/saleWork/getTotalInfo").then(res => {
+                    console.log(res)
+                        this.workInfo = res;
+                }).catch(e => {
+                    this.$message.error(e.error);
+                });
+            },
+            trap(value){
+                if (value == 'customer'){alert("111")}
+                if (value == 'customer'){
+                    this.$router.push({
+                        path: '/customerList',
+                        query: {
+                            saleId: this.userInfo.id,
+                        },
+                    });
+                }else {
+                    this.$router.push({
+                        path: '/contractList',
+                        query: {
+                            saleId: this.userInfo.id,
+                        },
+                    });
+                }
+            },
         }
     }
 </script>
@@ -39,4 +87,23 @@
             flex-basis: 0;
         }
     }
+    .text {
+        font-size: 14px;
+    }
+
+    .item {
+        margin-bottom: 18px;
+    }
+    .clearfix:before,
+    .clearfix:after {
+        display: table;
+        content: "";
+    }
+    .clearfix:after {
+        clear: both
+    }
+
+    .box-card {
+        width: 800px;
+    }
 </style>