Browse Source

添加了产品看板

wxf 2 years ago
parent
commit
ef8477a7fa

+ 168 - 0
hx-account/src/main/java/com/fjhx/account/entity/account/dto/FundAccount.java

@@ -0,0 +1,168 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package com.fjhx.account.entity.account.dto;
+
+import com.baomidou.mybatisplus.annotation.FieldStrategy;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.ruoyi.common.core.domain.BasePo;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * 资金账户管理表实体类
+ *
+ * @author BladeX
+ * @since 2022-07-05
+ */
+@Data
+@TableName("t_erp_fund_account")
+
+public class FundAccount{
+
+    private static final long serialVersionUID = 1L;
+
+    private String id;
+    /**
+     * 公司ID
+     */
+    private String companyId;
+
+    /**
+     * 账号名
+     */
+    private String name;
+
+    /**
+     * 账号
+     */
+    private String accountNumber;
+
+    /**
+     * 人民币余额
+     */
+    @TableField(updateStrategy = FieldStrategy.IGNORED)
+    private BigDecimal rmbAmount;
+
+    /**
+     * 美元余额
+     */
+    @TableField(updateStrategy = FieldStrategy.IGNORED)
+    private BigDecimal dollarAmount;
+
+    /**
+     * 欧元余额
+     */
+    @TableField(updateStrategy = FieldStrategy.IGNORED)
+    private BigDecimal euroAmount;
+
+    /**
+     * 英镑余额
+     */
+    @TableField(updateStrategy = FieldStrategy.IGNORED)
+    private BigDecimal sterlingAmount;
+
+    /**
+     * 美元汇率
+     */
+    @TableField(updateStrategy = FieldStrategy.IGNORED)
+    private BigDecimal dollarExchange;
+
+    /**
+     * 欧元汇率
+     */
+    @TableField(updateStrategy = FieldStrategy.IGNORED)
+    private BigDecimal euroExchange;
+
+    /**
+     * 英镑汇率
+     */
+    @TableField(updateStrategy = FieldStrategy.IGNORED)
+    private BigDecimal sterlingExchange;
+
+    /**
+     * 备注
+     */
+    @TableField(updateStrategy = FieldStrategy.IGNORED)
+    private String remark;
+
+    /**
+     * 是否删除。 0:否。  1 是
+     */
+    private Integer delFleg;
+
+    /**
+     * 租户ID
+     */
+    private String tenantId;
+
+    /**
+     * 人民币初始化
+     */
+    @TableField(updateStrategy = FieldStrategy.IGNORED)
+    private BigDecimal rmb;
+
+    /**
+     * 欧元初始化
+     */
+    @TableField(updateStrategy = FieldStrategy.IGNORED)
+    private BigDecimal euro;
+
+    /**
+     * 美元初始化
+     */
+    @TableField(updateStrategy = FieldStrategy.IGNORED)
+    private BigDecimal dollar;
+
+    /**
+     * 英镑初始化
+     */
+    @TableField(updateStrategy = FieldStrategy.IGNORED)
+    private BigDecimal sterling;
+
+    /**
+     * 公司名称
+     */
+    @TableField(exist = false)
+    private String companyName;
+
+
+    /**
+     * 公司ID
+     */
+    private String createUser;
+
+    /**
+     * 账号名
+     */
+    private Date createTime;
+
+    /**
+     * 账号
+     */
+    private String updateUser;
+
+    /**
+     * 账号
+     */
+    private Date updateTime;
+
+
+
+}

+ 11 - 0
hx-customer/src/main/java/com/fjhx/customer/controller/customer/CustomerController.java

@@ -14,6 +14,8 @@ import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.util.Map;
+
 /**
  * <p>
  * 客户表 前端控制器
@@ -95,4 +97,13 @@ public class CustomerController {
     public void editTag(@RequestBody CustomerDto customerDto) {
         customerService.editTag(customerDto);
     }
+
+
+    /**
+     * 客户来源统计
+     */
+    @PostMapping("/sourceStatistics")
+    public Map<String,Object> sourceStatistics(@RequestBody  CustomerSelectDto  customerDto){
+        return customerService.sourceStatistics(customerDto);
+    }
 }

+ 10 - 0
hx-customer/src/main/java/com/fjhx/customer/entity/customer/dto/CustomerSelectDto.java

@@ -24,6 +24,11 @@ public class CustomerSelectDto extends BaseSelectDto {
     private String source;
 
     /**
+     *用户ID
+     */
+    private Long userId;
+
+    /**
      * 客户状态(0:公海客户  1:私海客户)
      */
     private String type;
@@ -33,5 +38,10 @@ public class CustomerSelectDto extends BaseSelectDto {
      */
     private String keyword;
 
+    /**
+     *统计类型(1:来源统计  2,类型统计  3:业务员统计)
+     */
+    private Integer statisticsType;
+
 
 }

+ 15 - 2
hx-customer/src/main/java/com/fjhx/customer/entity/customer/po/Customer.java

@@ -1,5 +1,6 @@
 package com.fjhx.customer.entity.customer.po;
 
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.ruoyi.common.core.domain.BasePo;
 import lombok.Getter;
@@ -59,7 +60,7 @@ public class Customer extends BasePo {
     private String name;
 
     /**
-     * 客户状态(字典表key)
+     * 客户类型(字典表key)
      */
     private String status;
 
@@ -71,11 +72,23 @@ public class Customer extends BasePo {
     /**
      * 业务员id
      */
-    private String userId;
+    private Long userId;
 
     /**
      * 客户标签
      */
     private String tag;
 
+    /**
+     * 用户名称
+     */
+    @TableField(exist = false)
+    private String userName;
+
+    /**
+     * 个数
+     */
+    @TableField(exist = false)
+    private Integer count;
+
 }

+ 5 - 0
hx-customer/src/main/java/com/fjhx/customer/service/customer/CustomerService.java

@@ -68,4 +68,9 @@ public interface CustomerService extends BaseService<Customer> {
     List<CustomerVo> sourceIncrement(QueryWrapper<Object> query);
 
     void editTag(CustomerDto customerDto);
+
+    /**
+     * 客户来源统计
+     */
+    Map<String,Object> sourceStatistics(CustomerSelectDto customerDto);
 }

+ 61 - 0
hx-customer/src/main/java/com/fjhx/customer/service/customer/impl/CustomerServiceImpl.java

@@ -2,11 +2,13 @@ package com.fjhx.customer.service.customer.impl;
 
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.util.ObjectUtil;
+import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.fjhx.area.utils.AreaUtil;
+import com.fjhx.common.constant.SourceConstant;
 import com.fjhx.customer.entity.customer.dto.CustomerDto;
 import com.fjhx.customer.entity.customer.dto.CustomerSelectDto;
 import com.fjhx.customer.entity.customer.po.Customer;
@@ -20,15 +22,22 @@ import com.fjhx.customer.service.customer.CustomerService;
 import com.fjhx.customer.service.customer.CustomerTopService;
 import com.fjhx.customer.service.customer.CustomerUserService;
 import com.fjhx.customer.utils.code.CodeEnum;
+import com.fjhx.tenant.entity.dict.dto.DictTenantDataSelectDto;
+import com.fjhx.tenant.entity.dict.vo.DictTenantDataVo;
+import com.fjhx.tenant.service.dict.DictTenantDataService;
 import com.obs.services.internal.ServiceException;
+import com.ruoyi.common.core.domain.BasePo;
 import com.ruoyi.common.utils.SecurityUtils;
 import com.ruoyi.common.utils.StringUtils;
 import com.ruoyi.common.utils.wrapper.IWrapper;
+import com.ruoyi.system.utils.UserUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 /**
  * <p>
@@ -47,6 +56,9 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> i
     @Autowired
     private CustomerTopService customerTopService;
 
+    @Autowired
+    private DictTenantDataService dictTenantDataService;
+
 
     /**
      * 查询客户的列表
@@ -255,5 +267,54 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> i
         this.updateById(customerDto);
     }
 
+    /**
+     * 客户来源统计
+     */
+    @Override
+    public Map<String,Object> sourceStatistics(CustomerSelectDto customerDto) {
+        if (ObjectUtil.isEmpty(customerDto) && ObjectUtil.isEmpty(customerDto.getStatisticsType())){
+            throw new ServiceException("参数异常:统计类型不能为null");
+        }
+        //存放统计数据
+        Map<String,Object> map = new HashMap<>();
+        QueryWrapper<Customer> query = Wrappers.query();
+        if (ObjectUtil.isNotEmpty(customerDto.getType())){
+            //私海客户查询
+            if (customerDto.getType().equals("1")) {
+                query.isNotNull("user_id");
+                //私海客户需要添加权限(自己查自己)
+                query.eq("user_id", SecurityUtils.getUserId());
+            } else if (customerDto.getType().equals("0")) {//公海客户
+                query.and(wrapper1 -> wrapper1.isNull("user_id").or().eq("user_id", ""));
+            }
+        }
+        if (customerDto.getStatisticsType() == 1){//来源统计
+            query.groupBy("source");
+            query.select("count(*) count,source");
+        }else if (customerDto.getStatisticsType() == 2){//数据类型统计
+            query.groupBy("status");
+            query.select("count(*) count,status");
+        }else if (customerDto.getStatisticsType() == 3){//业务员统计
+            query.groupBy("user_id");
+            query.select("count(*) count,user_id");
+        }
+        List<Customer> customerList = baseMapper.selectList(query);
+
+
+        UserUtil.assignmentNickName(customerList, Customer::getUserId,Customer::setUserName);
+
+        Integer countAmount = customerList.stream().map(customer -> customer.getCount()).reduce(Integer::sum).orElse(0);
+        map.put("countAmount",countAmount);
+        map.put("customerList",customerList);
+        return map;
+    }
+
+    //根据字典编码获取字典的数据
+    private List<DictTenantDataVo> getDict(String code){
+        DictTenantDataSelectDto dto = new DictTenantDataSelectDto();
+        dto.setDictCode(code);
+        List<DictTenantDataVo> dictTenantDataServiceList = dictTenantDataService.getList(dto);
+        return dictTenantDataServiceList;
+    }
 
 }