Commit 4bd3a612 by sdif

机构品牌数据统计区分

parent 2eb5cf75
...@@ -74,6 +74,10 @@ public class DataViewController extends BaseController { ...@@ -74,6 +74,10 @@ public class DataViewController extends BaseController {
*/ */
@GetMapping("/dataEmployees") @GetMapping("/dataEmployees")
public R<DataViewVo> dataEmployees(DataViewBo dataViewBo) { public R<DataViewVo> dataEmployees(DataViewBo dataViewBo) {
Long roleId = getLoginUser().getRoleId();
if(null != roleId && roleId == 3){
dataViewBo.setUserId(getUserId());
}
return R.ok(iEmployeesService.dataEmployees(dataViewBo)); return R.ok(iEmployeesService.dataEmployees(dataViewBo));
} }
...@@ -102,18 +106,26 @@ public class DataViewController extends BaseController { ...@@ -102,18 +106,26 @@ public class DataViewController extends BaseController {
} }
/** /**
* 平台收益 * 平台收益/机构收益
*/ */
@GetMapping("/platformRevenue") @GetMapping("/platformRevenue")
public R<DataOrderVo> platformRevenue(DataViewBo dataViewBo) { public R<DataOrderVo> platformRevenue(DataViewBo dataViewBo) {
Long roleId = getLoginUser().getRoleId();
if(null != roleId && roleId == 3){
dataViewBo.setUserId(getUserId());
}
return R.ok(iTotalOrderService.platformRevenue(dataViewBo)); return R.ok(iTotalOrderService.platformRevenue(dataViewBo));
} }
/** /**
* 订单量 * 总后台订单量/机构订单量
*/ */
@GetMapping("/orderQuantity") @GetMapping("/orderQuantity")
public R<DataViewVo> orderQuantity(DataViewBo dataViewBo) { public R<DataViewVo> orderQuantity(DataViewBo dataViewBo) {
Long roleId = getLoginUser().getRoleId();
if(null != roleId && roleId == 3){
dataViewBo.setUserId(getUserId());
}
DataOrderVo dataOrderVo = iTotalOrderService.orderQuantity(dataViewBo); DataOrderVo dataOrderVo = iTotalOrderService.orderQuantity(dataViewBo);
DataViewVo dataViewVo = new DataViewVo(); DataViewVo dataViewVo = new DataViewVo();
dataViewVo.setDataSum((int) dataOrderVo.getDataSum()); dataViewVo.setDataSum((int) dataOrderVo.getDataSum());
......
...@@ -13,4 +13,7 @@ public class DataViewBo extends BaseEntity { ...@@ -13,4 +13,7 @@ public class DataViewBo extends BaseEntity {
* 最近1年 3 * 最近1年 3
*/ */
private Integer condition; private Integer condition;
private Long userId;
} }
...@@ -64,6 +64,8 @@ public interface TotalOrderMapper extends BaseMapperPlus<TotalOrderMapper, Total ...@@ -64,6 +64,8 @@ public interface TotalOrderMapper extends BaseMapperPlus<TotalOrderMapper, Total
DataOrderVo selectPlatformRevenue(@Param("dataViewBo") DataViewBo dataViewBo); DataOrderVo selectPlatformRevenue(@Param("dataViewBo") DataViewBo dataViewBo);
DataOrderVo selectPlatformCom(@Param("dataViewBo") DataViewBo dataViewBo);
DataOrderVo selectOrderQuantity(@Param("dataViewBo") DataViewBo dataViewBo); DataOrderVo selectOrderQuantity(@Param("dataViewBo") DataViewBo dataViewBo);
/** /**
......
...@@ -1429,6 +1429,9 @@ public class TotalOrderServiceImpl implements ITotalOrderService { ...@@ -1429,6 +1429,9 @@ public class TotalOrderServiceImpl implements ITotalOrderService {
@Override @Override
public DataOrderVo platformRevenue(DataViewBo dataViewBo) { public DataOrderVo platformRevenue(DataViewBo dataViewBo) {
if(null != dataViewBo.getUserId()){
return baseMapper.selectPlatformCom(dataViewBo);
}
return baseMapper.selectPlatformRevenue(dataViewBo); return baseMapper.selectPlatformRevenue(dataViewBo);
} }
......
...@@ -143,17 +143,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -143,17 +143,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</where> </where>
</select> </select>
<select id="selectDataView" resultType="com.pz.system.domain.vo.DataViewVo"> <select id="selectDataView" resultType="com.pz.system.domain.vo.DataViewVo">
SELECT count(id) as dataSum SELECT count(employees.id) as dataSum
FROM employees FROM employees
WHERE `status` = 1 left join company on company.id = employees.company_id
WHERE employees.`status` = 1 or employees.`status` = 2
<if test="dataViewBo.userId != null">
and company.id = #{dataViewBo.userId}
</if>
<if test="dataViewBo.condition == 2"> <if test="dataViewBo.condition == 2">
and create_time >= DATE_SUB(CURDATE(), INTERVAL 7 DAY) -- 近7天 and employees.create_time >= DATE_SUB(CURDATE(), INTERVAL 7 DAY) -- 近7天
</if> </if>
<if test="dataViewBo.condition == 3"> <if test="dataViewBo.condition == 3">
and create_time >= DATE_SUB(CURDATE(), INTERVAL 30 DAY) -- 近30天 and employees.create_time >= DATE_SUB(CURDATE(), INTERVAL 30 DAY) -- 近30天
</if> </if>
<if test="dataViewBo.condition == 1"> <if test="dataViewBo.condition == 1">
and DATE(create_time) = CURDATE() and DATE(employees.create_time) = CURDATE()
</if> </if>
</select> </select>
......
...@@ -141,4 +141,19 @@ ...@@ -141,4 +141,19 @@
AND em_id IN(emIds) AND em_id IN(emIds)
</if> </if>
</select> </select>
<select id="selectPlatformCom" resultType="com.pz.system.domain.vo.DataOrderVo">
SELECT IFNULL(ROUND(SUM(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>
<if test="dataViewBo.condition == 3">
and employees_divide.create_time >= DATE_SUB(CURDATE(), INTERVAL 30 DAY) -- 近30天
</if>
<if test="dataViewBo.condition == 1">
and DATE(employees_divide.create_time) = CURDATE()
</if>
</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