更新
This commit is contained in:
parent
8802208c01
commit
beb37ddd78
@ -756,6 +756,17 @@ public class PartnerOwnController extends BaseController {
|
||||
return success(partnerList.staticsTable3(partners.getPartnerId(), startTime, endTime));
|
||||
}
|
||||
|
||||
/**
|
||||
* 客户来源统计
|
||||
* @param startTime 开始时间
|
||||
* @param endTime 结束时间
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/customerSourceCount")
|
||||
public CommonResult<?> customerSourceCount(String startTime, String endTime, Long businessId) {
|
||||
return success(partnerList.customerSourceCount(startTime, endTime, businessId));
|
||||
}
|
||||
|
||||
//新统计表格3
|
||||
@GetMapping("/newStaticsTable3")
|
||||
public CommonResult newStaticsTable3(String startTime, String endTime) throws Exception {
|
||||
|
@ -135,4 +135,14 @@ public interface AppInspectionPartnerMapper extends BaseMapper<ShopMallPartners>
|
||||
* @param endTime 结束时间
|
||||
*/
|
||||
List<Map<String, Object>> queryInspectionSkuList(@Param("startTime") String startTime, @Param("endTime") String endTime);
|
||||
|
||||
/**
|
||||
* 获取业务统计
|
||||
* @param startTime
|
||||
* @param endTime
|
||||
* @return
|
||||
*/
|
||||
List<Map<String, Object>> selectBusinessStatistics(@Param("startTime") String startTime, @Param("endTime") String endTime);
|
||||
|
||||
List<Map<String, Object>> customerSourceCount(@Param("startTime") String startTime, @Param("endTime") String endTime,@Param("businessId") Long businessId);
|
||||
}
|
||||
|
@ -251,5 +251,15 @@ public interface AppInspectionPartnerService extends IService<ShopMallPartners>
|
||||
* @param endTime 结束时间
|
||||
* @return 结果
|
||||
*/
|
||||
Map<String, Object> fileStatistics(String servicePackageId,String startTime, String endTime);
|
||||
Map<String, Object> fileStatistics(String servicePackageId, String startTime, String endTime);
|
||||
|
||||
/**
|
||||
* 客户来源统计
|
||||
*
|
||||
* @param startTime 开始时间
|
||||
* @param endTime 结束时间
|
||||
* @param businessId 业务渠道id
|
||||
* @return
|
||||
*/
|
||||
List<Map<String, Object>> customerSourceCount(String startTime, String endTime, Long businessId);
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.inspection.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.date.DateUnit;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
@ -1589,11 +1590,14 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl<AppInspectionPa
|
||||
res.setInspectionDuration(formatDuration(durationMs));
|
||||
}
|
||||
|
||||
// 车龄
|
||||
if (info.getCarRegisterDate() != null) {
|
||||
res.setCarAge(DateUtil.betweenYear(info.getCarRegisterDate(), new Date(), true));
|
||||
long days = DateUtil.between(info.getCarRegisterDate(), new Date(), DateUnit.DAY);
|
||||
long carAge = days / 365; // 向下取整
|
||||
res.setCarAge(carAge);
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (leadMan != null) {
|
||||
res.setLeadManName(leadMan.getNickname());
|
||||
res.setLeadManId(leadMan.getId());
|
||||
@ -2022,7 +2026,8 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl<AppInspectionPa
|
||||
}
|
||||
startTime = startTime + " 00:00:00";
|
||||
endTime = endTime + " 23:59:59";
|
||||
List<Map<String, Object>> res = baseMapper.staticsTable3(partnerId, startTime, endTime);
|
||||
// List<Map<String, Object>> res = baseMapper.staticsTable3(partnerId, startTime, endTime);
|
||||
List<Map<String, Object>> res = baseMapper.selectBusinessStatistics( startTime, endTime);
|
||||
return res;
|
||||
}
|
||||
|
||||
@ -2343,4 +2348,26 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl<AppInspectionPa
|
||||
map.put("updateCount", updateCount);
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* 客户来源统计
|
||||
*
|
||||
* @param startTime 开始时间
|
||||
* @param endTime 结束时间
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<Map<String, Object>> customerSourceCount(String startTime, String endTime, Long businessId) {
|
||||
// 判断开始时间与结束时间如果为空 默认查询本月
|
||||
if (StringUtils.isNotEmpty(startTime)) {
|
||||
startTime = startTime + " 00:00:00";
|
||||
}
|
||||
if (StringUtils.isNotEmpty(endTime)) {
|
||||
endTime = endTime + " 23:59:59";
|
||||
}
|
||||
List<Map<String, Object>> maps = baseMapper.customerSourceCount(startTime, endTime, businessId);
|
||||
// 根据map中的theNum从大到小排序
|
||||
maps.sort(Comparator.comparingInt(map -> -Integer.parseInt(map.get("theNum").toString())));
|
||||
return maps;
|
||||
}
|
||||
}
|
||||
|
@ -815,4 +815,54 @@ FROM
|
||||
GROUP BY
|
||||
s.sku_name
|
||||
</select>
|
||||
<select id="selectBusinessStatistics" resultType="java.util.Map">
|
||||
SELECT
|
||||
ibc.id,
|
||||
ibc.name,
|
||||
COUNT(ii.id) AS theNum,
|
||||
ROUND(IFNULL(SUM(oi.goods_price),0)/100) theAmount
|
||||
FROM
|
||||
inspection_business_channel ibc
|
||||
LEFT JOIN
|
||||
inspection_info ii
|
||||
ON ibc.name = ii.business_channel AND ii.deleted = '0'
|
||||
<if test="startTime != null">
|
||||
AND ii.create_time BETWEEN #{startTime} AND #{endTime}
|
||||
</if>
|
||||
LEFT JOIN
|
||||
order_info oi
|
||||
ON oi.id = ii.inspection_order_id AND oi.deleted = '0'
|
||||
WHERE
|
||||
ibc.deleted = '0'
|
||||
AND ibc.type = '0'
|
||||
GROUP BY
|
||||
ibc.name
|
||||
</select>
|
||||
<select id="customerSourceCount" resultType="java.util.Map">
|
||||
SELECT
|
||||
ibc.id,
|
||||
ibc.name,
|
||||
COUNT(ii.id) AS theNum,
|
||||
ROUND(IFNULL(SUM(oi.goods_price),0)/100) theAmount
|
||||
FROM
|
||||
inspection_business_channel ibc
|
||||
LEFT JOIN
|
||||
inspection_info ii
|
||||
ON ibc.name = ii.customer_source AND ii.deleted = '0'
|
||||
<if test="startTime != null">
|
||||
AND ii.create_time BETWEEN #{startTime} AND #{endTime}
|
||||
</if>
|
||||
LEFT JOIN
|
||||
order_info oi
|
||||
ON oi.id = ii.inspection_order_id AND oi.deleted = '0'
|
||||
WHERE
|
||||
ibc.deleted = '0'
|
||||
AND ibc.type = '1'
|
||||
<if test="businessId != null">
|
||||
AND ibc.pid = #{businessId}
|
||||
</if>
|
||||
GROUP BY
|
||||
ibc.name
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
Loading…
Reference in New Issue
Block a user