Commit 56441d43 by 邹磊浩

修改代码

parent 20ad8380
...@@ -121,7 +121,7 @@ public class DataViewController extends BaseController { ...@@ -121,7 +121,7 @@ public class DataViewController extends BaseController {
} }
/** /**
* 数据总览柱状 * 数据总览折线
*/ */
@GetMapping("/findOrderColumnarVoList") @GetMapping("/findOrderColumnarVoList")
public R<List<OrderLineVo>> findOrderColumnarVoList( public R<List<OrderLineVo>> findOrderColumnarVoList(
......
...@@ -3,6 +3,7 @@ package com.pz.system.domain.bo; ...@@ -3,6 +3,7 @@ package com.pz.system.domain.bo;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.util.List;
@Data @Data
public class OrderColumnarBo implements Serializable { public class OrderColumnarBo implements Serializable {
...@@ -22,4 +23,9 @@ public class OrderColumnarBo implements Serializable { ...@@ -22,4 +23,9 @@ public class OrderColumnarBo implements Serializable {
* 自定义结束时间 * 自定义结束时间
*/ */
private String endTime; private String endTime;
/**
* 陪诊员ids
*/
private List<Integer> emIds;
} }
...@@ -5,6 +5,7 @@ import cn.hutool.json.JSONObject; ...@@ -5,6 +5,7 @@ import cn.hutool.json.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; 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.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.JsonProcessingException;
...@@ -1242,6 +1243,20 @@ public class TotalOrderServiceImpl implements ITotalOrderService { ...@@ -1242,6 +1243,20 @@ public class TotalOrderServiceImpl implements ITotalOrderService {
@Override @Override
public List<OrderLineVo> findOrderColumnarVoList(OrderColumnarBo bo) { 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<OrderLineVo> list = new ArrayList<>();
List<String> recentDates; List<String> recentDates;
switch (bo.getType()) { switch (bo.getType()) {
......
...@@ -83,8 +83,10 @@ ...@@ -83,8 +83,10 @@
</if> </if>
</select> </select>
<select id="selectPlatformRevenue" resultType="com.pz.system.domain.vo.DataOrderVo"> <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 SELECT IFNULL(ROUND(SUM(employees_divide.order_price - employees_divide.divide_price), 2),0) as dataSum FROM
left join total_order on total_order.order_sn = employees_divide.order_id WHERE total_order.`status` = 2 and refund_amount = 0 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"> <if test="dataViewBo.condition == 2">
and employees_divide.create_time >= DATE_SUB(CURDATE(), INTERVAL 7 DAY) -- 近7天 and employees_divide.create_time >= DATE_SUB(CURDATE(), INTERVAL 7 DAY) -- 近7天
</if> </if>
...@@ -123,9 +125,12 @@ ...@@ -123,9 +125,12 @@
<select id="findOrderColumnarVoList" resultType="com.pz.system.domain.vo.OrderColumnarVo"> <select id="findOrderColumnarVoList" resultType="com.pz.system.domain.vo.OrderColumnarVo">
SELECT b.`name` name,DATE (#{time}) AS time, COUNT(t.business_id) AS num SELECT b.`name` name,DATE (#{time}) AS time, COUNT(t.business_id) AS num
FROM business b FROM business b
LEFT JOIN total_order t ON t.business_id = b.id LEFT JOIN total_order t ON t.business_id = b.id
AND t.`status` = 2 AND t.`status` = 2
AND DATE (t.create_time) = DATE (#{time}) 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; GROUP BY b.id;
</select> </select>
</mapper> </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