Commit 56441d43 by 邹磊浩

修改代码

parent 20ad8380
......@@ -121,7 +121,7 @@ public class DataViewController extends BaseController {
}
/**
* 数据总览柱状
* 数据总览折线
*/
@GetMapping("/findOrderColumnarVoList")
public R<List<OrderLineVo>> findOrderColumnarVoList(
......
......@@ -3,6 +3,7 @@ package com.pz.system.domain.bo;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
@Data
public class OrderColumnarBo implements Serializable {
......@@ -22,4 +23,9 @@ public class OrderColumnarBo implements Serializable {
* 自定义结束时间
*/
private String endTime;
/**
* 陪诊员ids
*/
private List<Integer> emIds;
}
......@@ -5,6 +5,7 @@ import cn.hutool.json.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.fasterxml.jackson.core.JsonProcessingException;
......@@ -1242,6 +1243,20 @@ public class TotalOrderServiceImpl implements ITotalOrderService {
@Override
public List<OrderLineVo> findOrderColumnarVoList(OrderColumnarBo bo) {
Long roleId = LoginHelper.getLoginUser().getRoleId();
Long userId = LoginHelper.getUserId();
//商户
if (roleId == 3L) {
//查找该商户
Optional.ofNullable(companyMapper.selectOne(Wrappers.<Company>lambdaQuery().eq(Company::getUid, userId).eq(Company::getStatus, 2)))
.ifPresent(company -> {
//获取该商户下所有陪诊员
List<Employees> employees = employeesMapper.selectList(Wrappers.<Employees>lambdaQuery().eq(Employees::getCompanyId, company.getId()));
if (CollectionUtils.isNotEmpty(employees)) {
bo.setEmIds(employees.stream().map(Employees::getId).collect(Collectors.toList()));
}
});
}
List<OrderLineVo> list = new ArrayList<>();
List<String> recentDates;
switch (bo.getType()) {
......
......@@ -83,8 +83,10 @@
</if>
</select>
<select id="selectPlatformRevenue" resultType="com.pz.system.domain.vo.DataOrderVo">
SELECT IFNULL(ROUND(SUM(employees_divide.order_price - employees_divide.divide_price), 2),0) as dataSum FROM employees_divide
left join total_order on total_order.order_sn = employees_divide.order_id WHERE total_order.`status` = 2 and refund_amount = 0
SELECT IFNULL(ROUND(SUM(employees_divide.order_price - employees_divide.divide_price), 2),0) as dataSum FROM
employees_divide
left join total_order on total_order.order_sn = employees_divide.order_id WHERE total_order.`status` = 2 and
refund_amount = 0
<if test="dataViewBo.condition == 2">
and employees_divide.create_time >= DATE_SUB(CURDATE(), INTERVAL 7 DAY) -- 近7天
</if>
......@@ -126,6 +128,9 @@
LEFT JOIN total_order t ON t.business_id = b.id
AND t.`status` = 2
AND DATE (t.create_time) = DATE (#{time})
<if test="bo.emIds != null and bo.emIds.size() > 0">
AND t.em_id IN(bo.emIds)
</if>
GROUP BY b.id;
</select>
</mapper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment