分销团队列表查询接口补充查询内容;师傅端师傅团队问题修复
This commit is contained in:
parent
5c2c31fb7b
commit
0d6a5a43e7
|
|
@ -1,18 +1,30 @@
|
|||
package com.ghy.web.controller.customer;
|
||||
|
||||
import com.ghy.common.adapay.model.AnalyseItemEnum;
|
||||
import com.ghy.common.core.controller.BaseController;
|
||||
import com.ghy.common.core.domain.AjaxResult;
|
||||
import com.ghy.common.core.page.TableDataInfo;
|
||||
import com.ghy.common.utils.ExceptionUtil;
|
||||
import com.ghy.customer.domain.Customer;
|
||||
import com.ghy.customer.service.CustomerService;
|
||||
import com.ghy.order.domain.OrderMaster;
|
||||
import com.ghy.order.service.OrderMasterService;
|
||||
import com.ghy.payment.domain.FinancialMaster;
|
||||
import com.ghy.payment.service.FinancialMasterService;
|
||||
import com.ghy.web.pojo.vo.AnalyseItem;
|
||||
import com.ghy.web.pojo.vo.CustomerPlaceMember;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author clunt
|
||||
|
|
@ -27,6 +39,12 @@ public class CustomerController extends BaseController {
|
|||
@Autowired
|
||||
private CustomerService customerService;
|
||||
|
||||
@Autowired
|
||||
private FinancialMasterService financialMasterService;
|
||||
|
||||
@Autowired
|
||||
private OrderMasterService orderMasterService;
|
||||
|
||||
@RequiresPermissions("customer:customer:view")
|
||||
@GetMapping()
|
||||
public String customer()
|
||||
|
|
@ -48,9 +66,88 @@ public class CustomerController extends BaseController {
|
|||
@ResponseBody
|
||||
public TableDataInfo appList(@RequestBody Customer customer)
|
||||
{
|
||||
List<CustomerPlaceMember> response = new ArrayList<CustomerPlaceMember>();
|
||||
startPage();
|
||||
List<Customer> list = customerService.getCustomerList(customer);
|
||||
return getDataTable(list);
|
||||
for (Customer curCustomer: list) {
|
||||
// 本月第一天
|
||||
LocalDate firstDayCurMonth = LocalDate.now().withDayOfMonth(1);
|
||||
|
||||
List<AnalyseItem> analyseItems = new ArrayList<AnalyseItem>();
|
||||
// 客户数
|
||||
Customer customerParams = new Customer();
|
||||
customerParams.setCustomerPlace(curCustomer.getCustomerId());
|
||||
AnalyseItem aItem1 = new AnalyseItem()
|
||||
.setTitle(AnalyseItemEnum.CUSTOMER_NUM.getTitle())
|
||||
.setUnit(AnalyseItemEnum.CUSTOMER_NUM.getUnit())
|
||||
.setValue(customerService.countCustomer(customerParams));
|
||||
analyseItems.add(aItem1);
|
||||
// 本月绑定客户数
|
||||
customerParams.setUpdateTimeStart(firstDayCurMonth.atStartOfDay());
|
||||
AnalyseItem aItem2 = new AnalyseItem()
|
||||
.setTitle(AnalyseItemEnum.CUSTOMER_NUM_CUR_MONTH.getTitle())
|
||||
.setUnit(AnalyseItemEnum.CUSTOMER_NUM_CUR_MONTH.getUnit())
|
||||
.setValue(customerService.countCustomer(customerParams));
|
||||
analyseItems.add(aItem2);
|
||||
|
||||
// 本月订单数及本月订单额
|
||||
OrderMaster orderParams1 = new OrderMaster();
|
||||
orderParams1.setCustomerId(curCustomer.getCustomerId());
|
||||
orderParams1.setCreateTimeStart(firstDayCurMonth.atStartOfDay());
|
||||
List<OrderMaster> ordersCurMonth1 = orderMasterService.selectOrderMasterList(orderParams1);
|
||||
List<Long> orderIdsCurMonth1 = ordersCurMonth1.stream().map(OrderMaster::getId).collect(Collectors.toList());
|
||||
BigDecimal totalMoneyCurMonth1 = new BigDecimal(0);
|
||||
if (CollectionUtils.isNotEmpty(orderIdsCurMonth1)) {
|
||||
FinancialMaster financialParams1 = new FinancialMaster();
|
||||
financialParams1.setIds(orderIdsCurMonth1);
|
||||
List<FinancialMaster> financialsCurMonth1 = financialMasterService.selectFinancialMasterList(financialParams1);
|
||||
totalMoneyCurMonth1 = financialsCurMonth1.stream().map(FinancialMaster::getTotalMoney).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
}
|
||||
AnalyseItem aItem3 = new AnalyseItem()
|
||||
.setTitle(AnalyseItemEnum.ORDER_NUM_CUR_MONTH.getTitle())
|
||||
.setUnit(AnalyseItemEnum.ORDER_NUM_CUR_MONTH.getUnit())
|
||||
.setValue(ordersCurMonth1 != null ? ordersCurMonth1.size() : 0);
|
||||
AnalyseItem aItem4 = new AnalyseItem()
|
||||
.setTitle(AnalyseItemEnum.ORDER_TRADE_VOLUME_CUR_MONTH.getTitle())
|
||||
.setUnit(AnalyseItemEnum.ORDER_TRADE_VOLUME_CUR_MONTH.getUnit())
|
||||
.setValue(totalMoneyCurMonth1);
|
||||
analyseItems.add(aItem3);
|
||||
analyseItems.add(aItem4);
|
||||
|
||||
// 上月订单数及上月订单额
|
||||
OrderMaster orderParams2 = new OrderMaster();
|
||||
orderParams2.setCustomerId(curCustomer.getCustomerId());
|
||||
orderParams2.setCreateTimeStart(firstDayCurMonth.atStartOfDay().minusMonths(1));
|
||||
orderParams2.setCreateTimeEnd(firstDayCurMonth.atStartOfDay());
|
||||
List<OrderMaster> ordersCurMonth2 = orderMasterService.selectOrderMasterList(orderParams2);
|
||||
List<Long> orderIdsCurMonth2 = ordersCurMonth2.stream().map(OrderMaster::getId).collect(Collectors.toList());
|
||||
BigDecimal totalMoneyCurMonth2 = new BigDecimal(0);
|
||||
if (CollectionUtils.isNotEmpty(orderIdsCurMonth2)) {
|
||||
FinancialMaster financialParams2 = new FinancialMaster();
|
||||
financialParams2.setIds(orderIdsCurMonth2);
|
||||
List<FinancialMaster> financialsCurMonth2 = financialMasterService.selectFinancialMasterList(financialParams2);
|
||||
totalMoneyCurMonth2 = financialsCurMonth2.stream().map(FinancialMaster::getTotalMoney).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
}
|
||||
AnalyseItem aItem5 = new AnalyseItem()
|
||||
.setTitle(AnalyseItemEnum.ORDER_NUM_CUR_MONTH.getTitle())
|
||||
.setUnit(AnalyseItemEnum.ORDER_NUM_CUR_MONTH.getUnit())
|
||||
.setValue(ordersCurMonth2 != null ? ordersCurMonth2.size() : 0);
|
||||
AnalyseItem aItem6 = new AnalyseItem()
|
||||
.setTitle(AnalyseItemEnum.ORDER_TRADE_VOLUME_CUR_MONTH.getTitle())
|
||||
.setUnit(AnalyseItemEnum.ORDER_TRADE_VOLUME_CUR_MONTH.getUnit())
|
||||
.setValue(totalMoneyCurMonth2);
|
||||
analyseItems.add(aItem5);
|
||||
analyseItems.add(aItem6);
|
||||
|
||||
CustomerPlaceMember customerPlaceMember = new CustomerPlaceMember();
|
||||
customerPlaceMember.setAnalyseItems(analyseItems);
|
||||
customerPlaceMember.setCustomerId(curCustomer.getCustomerId());
|
||||
customerPlaceMember.setName(curCustomer.getName());
|
||||
customerPlaceMember.setPhone(curCustomer.getPhone());
|
||||
response.add(customerPlaceMember);
|
||||
}
|
||||
|
||||
return getDataTable(response);
|
||||
}
|
||||
|
||||
@RequiresPermissions("customer:customer:resetPwd")
|
||||
|
|
|
|||
|
|
@ -0,0 +1,38 @@
|
|||
package com.ghy.web.pojo.vo;
|
||||
|
||||
/**
|
||||
* @author ydq
|
||||
* @date : 2022-08-15 17:33
|
||||
*/
|
||||
public class AnalyseItem {
|
||||
private String title;
|
||||
private Object value;
|
||||
private String unit;
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public AnalyseItem setTitle(String title) {
|
||||
this.title = title;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Object getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public AnalyseItem setValue(Object value) {
|
||||
this.value = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getUnit() {
|
||||
return unit;
|
||||
}
|
||||
|
||||
public AnalyseItem setUnit(String unit) {
|
||||
this.unit = unit;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
package com.ghy.web.pojo.vo;
|
||||
|
||||
import com.ghy.customer.domain.Customer;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author ydq
|
||||
* @date : 2022-08-16 21:38
|
||||
*/
|
||||
@Data
|
||||
public class CustomerPlaceMember extends Customer {
|
||||
private List<AnalyseItem> analyseItems;
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
package com.ghy.common.adapay.model;
|
||||
|
||||
/**
|
||||
* @author ydq
|
||||
* @date : 2022-08-15 16:37
|
||||
*/
|
||||
public enum AnalyseItemEnum {
|
||||
CUSTOMER_NUM("客户数", ""),
|
||||
CUSTOMER_NUM_CUR_MONTH("本月绑定", ""),
|
||||
ORDER_NUM_CUR_MONTH("本月订单数", "单"),
|
||||
ORDER_TRADE_VOLUME_CUR_MONTH("本月订单额", "yuan"),
|
||||
ORDER_NUM_LAST_MONTH("上月订单数", "单"),
|
||||
ORDER_TRADE_VOLUME_LAST_MONTH("上月订单额", "yuan");
|
||||
|
||||
private String title;
|
||||
private String unit;
|
||||
|
||||
AnalyseItemEnum(String title, String unit) {
|
||||
this.title = title;
|
||||
this.unit = unit;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public String getUnit() {
|
||||
return unit;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
package com.ghy.common.core.domain;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
|
@ -38,6 +39,14 @@ public class BaseEntity implements Serializable
|
|||
/** 请求参数 */
|
||||
private Map<String, Object> params;
|
||||
|
||||
private LocalDateTime updateTimeStart;
|
||||
|
||||
private LocalDateTime updateTimeEnd;
|
||||
|
||||
private LocalDateTime createTimeStart;
|
||||
|
||||
private LocalDateTime createTimeEnd;
|
||||
|
||||
public String getSearchValue()
|
||||
{
|
||||
return searchValue;
|
||||
|
|
@ -111,4 +120,36 @@ public class BaseEntity implements Serializable
|
|||
{
|
||||
this.params = params;
|
||||
}
|
||||
|
||||
public LocalDateTime getUpdateTimeStart() {
|
||||
return updateTimeStart;
|
||||
}
|
||||
|
||||
public void setUpdateTimeStart(LocalDateTime updateTimeStart) {
|
||||
this.updateTimeStart = updateTimeStart;
|
||||
}
|
||||
|
||||
public LocalDateTime getUpdateTimeEnd() {
|
||||
return updateTimeEnd;
|
||||
}
|
||||
|
||||
public void setUpdateTimeEnd(LocalDateTime updateTimeEnd) {
|
||||
this.updateTimeEnd = updateTimeEnd;
|
||||
}
|
||||
|
||||
public LocalDateTime getCreateTimeStart() {
|
||||
return createTimeStart;
|
||||
}
|
||||
|
||||
public void setCreateTimeStart(LocalDateTime createTimeStart) {
|
||||
this.createTimeStart = createTimeStart;
|
||||
}
|
||||
|
||||
public LocalDateTime getCreateTimeEnd() {
|
||||
return createTimeEnd;
|
||||
}
|
||||
|
||||
public void setCreateTimeEnd(LocalDateTime createTimeEnd) {
|
||||
this.createTimeEnd = createTimeEnd;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,6 +17,12 @@ public interface CustomerMapper {
|
|||
*/
|
||||
List<Customer> getCustomerList(Customer customer);
|
||||
|
||||
/**
|
||||
* @param customer 消费者筛选条件
|
||||
* @return 符合结果消费者计数
|
||||
*/
|
||||
Long countCustomer(Customer customer);
|
||||
|
||||
/**
|
||||
* @param customerId 消费者id
|
||||
* @return 消费者信息
|
||||
|
|
|
|||
|
|
@ -23,6 +23,12 @@ public interface CustomerService {
|
|||
*/
|
||||
List<Customer> getCustomerList(Customer customer);
|
||||
|
||||
/**
|
||||
* @param customer 消费者筛选条件
|
||||
* @return 符合结果消费者计数
|
||||
*/
|
||||
Long countCustomer(Customer customer);
|
||||
|
||||
/**
|
||||
* @param customerId 消费者id
|
||||
* @return 消费者信息
|
||||
|
|
|
|||
|
|
@ -33,6 +33,11 @@ public class CustomerServiceImpl implements CustomerService {
|
|||
return customerMapper.getCustomerList(customer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long countCustomer(Customer customer) {
|
||||
return customerMapper.countCustomer(customer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Customer selectByOpenId(Customer customer) {
|
||||
List<Customer> list = customerMapper.getCustomerList(customer);
|
||||
|
|
|
|||
|
|
@ -27,6 +27,11 @@
|
|||
FROM customer
|
||||
</sql>
|
||||
|
||||
<sql id="selectCount">
|
||||
SELECT COUNT(*)
|
||||
FROM customer
|
||||
</sql>
|
||||
|
||||
<select id="getCustomerList" resultMap="CustomerResult">
|
||||
<include refid="selectCustomer" />
|
||||
<where>
|
||||
|
|
@ -39,6 +44,21 @@
|
|||
</where>
|
||||
</select>
|
||||
|
||||
<select id="countCustomer" resultType="long">
|
||||
<include refid="selectCount" />
|
||||
<where>
|
||||
<if test="openId != null and openId != ''">
|
||||
AND open_id = #{openId}
|
||||
</if>
|
||||
<if test="customerPlace != null and customerPlace != ''">
|
||||
AND customer_place = #{customerPlace}
|
||||
</if>
|
||||
<if test="updateTimeStart != null">
|
||||
AND update_time <= #{updateTimeStart}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<delete id="deleteByIds">
|
||||
DELETE FROM customer WHERE customer_id IN
|
||||
<foreach collection="array" item="customerIds" open="(" separator="," close=")">
|
||||
|
|
|
|||
|
|
@ -113,6 +113,12 @@
|
|||
<if test="exceptOrderStatus != null">
|
||||
AND om.order_status != #{exceptOrderStatus}
|
||||
</if>
|
||||
<if test="createTimeStart != null">
|
||||
AND om.create_time >= #{createTimeStart}
|
||||
</if>
|
||||
<if test="createTimeEnd != null">
|
||||
AND om.create_time < #{createTimeEnd}
|
||||
</if>
|
||||
</where>
|
||||
order by om.create_time
|
||||
<trim suffixOverrides=",">
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import lombok.Data;
|
|||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author clunt
|
||||
|
|
@ -54,6 +55,8 @@ public class FinancialMaster extends BaseEntity {
|
|||
@Excel(name = "Adapay的唯一支付ID", cellType = Excel.ColumnType.STRING)
|
||||
private String paymentId;
|
||||
|
||||
private List<Long> ids;
|
||||
|
||||
public FinancialMaster() {
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -36,6 +36,12 @@
|
|||
<if test="orderMasterId != null and orderMasterId != 0">
|
||||
AND order_master_id = #{orderMasterId}
|
||||
</if>
|
||||
<if test="ids != null and ids != ''">
|
||||
AND order_master_id IN
|
||||
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="orderMasterCode != null and orderMasterCode != ''">
|
||||
AND order_master_code LIKE concat('%', #{orderMasterCode}, '%')
|
||||
</if>
|
||||
|
|
|
|||
|
|
@ -31,4 +31,8 @@ public class WorkerTeam extends BaseEntity {
|
|||
|
||||
private String workerLogoUrl;
|
||||
|
||||
private Integer workerStatus;
|
||||
|
||||
private Boolean hasRegistered;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@
|
|||
<result property="name" column="name"/>
|
||||
<result property="workerLogoUrl" column="worker_logo_url"/>
|
||||
<result property="phone" column="phone"/>
|
||||
<result property="workerStatus" column="worker_status"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
|
|
@ -37,17 +38,26 @@
|
|||
</insert>
|
||||
|
||||
<sql id="selectWorkerTeam">
|
||||
SELECT wt.worker_team_id, wt.leader_id, wt.worker_name, wt.worker_id, w.phone, w.name, w.worker_logo_url
|
||||
SELECT wt.worker_team_id, wt.leader_id, wt.worker_name, wt.worker_id, w.phone, w.name, w.worker_logo_url, w.status as worker_status
|
||||
FROM worker_team wt
|
||||
left join worker w on wt.worker_id = w.worker_id
|
||||
</sql>
|
||||
|
||||
<select id="getWorkerTeamList" resultMap="WorkerTeamResult">
|
||||
<select id="getWorkerTeamList" parameterType="com.ghy.worker.domain.WorkerTeam" resultMap="WorkerTeamResult">
|
||||
<include refid="selectWorkerTeam"/>
|
||||
<where>
|
||||
<if test="leaderId != null and leaderId != ''">
|
||||
AND wt.leader_id = #{leaderId}
|
||||
</if>
|
||||
<if test="workerId != null">
|
||||
AND wt.worker_id = #{workerId}
|
||||
</if>
|
||||
<if test="workerStatus != null">
|
||||
AND w.status = #{workerStatus}
|
||||
</if>
|
||||
<if test="hasRegistered != null and hasRegistered != ''">
|
||||
AND w.phone IS NOT NULL
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue