Commit 136c42a1 by 陈浩建

Merge remote-tracking branch 'origin/master'

parents 6eb3511f ece75428
...@@ -94,7 +94,7 @@ spring: ...@@ -94,7 +94,7 @@ spring:
# republish failures to the DLQ with diagnostic headers # republish failures to the DLQ with diagnostic headers
republish-to-dlq: true republish-to-dlq: true
rabbitmq: rabbitmq:
host: 123.56.82.141 host: 172.18.101.171
port: 5672 port: 5672
username: guest username: guest
password: guest password: guest
...@@ -120,6 +120,9 @@ spring: ...@@ -120,6 +120,9 @@ spring:
exprie: 600 exprie: 600
prohibition: 600 prohibition: 600
datasource: datasource:
url: jdbc:mysql://127.0.0.1:3306/school_center?autoReconnect=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=CTT&allowPublicKeyRetrieval=true
username: root
password: root
dynamic: dynamic:
primary: master primary: master
p6spy: true p6spy: true
...@@ -128,9 +131,9 @@ spring: ...@@ -128,9 +131,9 @@ spring:
max-active: 30 max-active: 30
datasource: datasource:
master: master:
url: jdbc:mysql://127.0.0.1:3306/school_center?autoReconnect=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=CTT&allowPublicKeyRetrieval=true url: ${spring.datasource.url}
username: root username: ${spring.datasource.username}
password: root password: ${spring.datasource.password}
driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver
devtools: devtools:
restart: restart:
......
...@@ -192,4 +192,34 @@ public interface OrderMapper extends BaseMapper<Order> { ...@@ -192,4 +192,34 @@ public interface OrderMapper extends BaseMapper<Order> {
* @return * @return
*/ */
List<Map<String,Object>> kdOrderConversionXF(@Param("startTime") String startTime,@Param("endTime") String endTime); List<Map<String,Object>> kdOrderConversionXF(@Param("startTime") String startTime,@Param("endTime") String endTime);
/**
* 获取成员销售统计
* @return
*/
List<Map<String, Object>> getUserSalesStatistic(Map<String, Object> map);
/**
* 获取楼长的销售统计
* @return
*/
List<Map<String, Object>> getLzSalesStatistic(Map<String, Object> map);
/**
* 获取学校的销售统计
* @return
*/
List<Map<String, Object>> getSchoolSaleStatistic(Map<String, Object> map);
/**
* 获取产品转换率
* @return
*/
List<Map<String, Object>> getProductTransferStatistic(Map<String, Object> map);
/**
* 获取产品销售排名
* @return
*/
List<Map<String, Object>> getProductSalesStatistic(Map<String, Object> map);
} }
...@@ -324,4 +324,148 @@ ...@@ -324,4 +324,148 @@
ORDER BY sub_id ORDER BY sub_id
</select> </select>
<select id="getUserSalesStatistic" parameterType="map" resultType="java.util.HashMap">
SELECT
hehuoren_name as name,
count( hehuoren_id ) as num
FROM
hhr_order
WHERE
order_status = "已完成"
<if test="area != null and area != ''">
AND hehuoren_area = #{area}
</if>
<if test="school != null and school != ''">
AND hehuoren_school = #{school}
</if>
GROUP BY
hehuoren_id
ORDER BY
count( hehuoren_id ) DESC
LIMIT 0, 10
</select>
<select id="getLzSalesStatistic" parameterType="java.util.HashMap" resultType="java.util.HashMap">
SELECT
supervisor_name as name,
count( supervisor_name ) as num
FROM
hhr_order
WHERE
order_status = "已完成"
AND supervisor_name IS NOT NULL
<if test="area != null and area != ''">
AND hehuoren_area = #{area}
</if>
<if test="school != null and school != ''">
AND hehuoren_school = #{school}
</if>
GROUP BY
supervisor_name
ORDER BY
count( supervisor_name ) DESC
LIMIT 0, 10
</select>
<select id="getSchoolSaleStatistic" parameterType="java.util.HashMap" resultType="java.util.HashMap">
SELECT
hehuoren_school as name,
count( hehuoren_school ) as num
FROM
hhr_order
WHERE
order_status = "已完成"
AND hehuoren_school IS NOT NULL
<if test="area != null and area != ''">
AND hehuoren_area = #{area}
</if>
<if test="school != null and school != ''">
AND hehuoren_school = #{school}
</if>
GROUP BY
hehuoren_school
ORDER BY
count( hehuoren_school ) DESC
LIMIT 0, 10
</select>
<select id="getProductTransferStatistic" parameterType="java.util.HashMap" resultType="java.util.HashMap">
SELECT
hp.package_name as name,
round( complate.num / ( all_order.num + 1000 ) * 100, 2) as num
FROM
(
SELECT
package_id,
count( package_id ) AS num
FROM
hhr_order
WHERE
order_status = "已完成"
AND user_type = "0"
AND package_id IS NOT NULL
<if test="area != null and area != ''">
AND hehuoren_area = #{area}
</if>
<if test="school != null and school != ''">
AND hehuoren_school = #{school}
</if>
GROUP BY
package_id
) complate
RIGHT JOIN
(
SELECT
package_id,
count( package_id ) AS num
FROM
hhr_order
WHERE
user_type = "0"
AND package_id IS NOT NULL
<if test="area != null and area != ''">
AND hehuoren_area = #{area}
</if>
<if test="school != null and school != ''">
AND hehuoren_school = #{school}
</if>
GROUP BY package_id
) all_order
ON
complate.package_id = all_order.package_id
LEFT JOIN hhr_package hp ON all_order.package_id = hp.id
ORDER BY
( complate.num / ( all_order.num + 1000 ) ) DESC
LIMIT 0, 10
</select>
<select id="getProductSalesStatistic" parameterType="java.util.HashMap" resultType="java.util.HashMap">
SELECT
hp.package_name as name,
count( ho.id ) as num
FROM
hhr_package hp
LEFT JOIN
(
select
id, package_id
from
hhr_order
<where>
<if test="area != null and area != ''">
AND hehuoren_area = #{area}
</if>
<if test="school != null and school != ''">
AND hehuoren_school = #{school}
</if>
</where>
)ho ON hp.id = ho.package_id
AND ho.id IS NOT NULL
GROUP BY
hp.id
ORDER BY
count( ho.id ) DESC
limit 0, 5
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -10,10 +10,7 @@ import com.winsun.auth.core.shiro.ShiroUser; ...@@ -10,10 +10,7 @@ import com.winsun.auth.core.shiro.ShiroUser;
import com.winsun.bean.HhrSupervisorSchool; import com.winsun.bean.HhrSupervisorSchool;
import com.winsun.bean.HhrUser; import com.winsun.bean.HhrUser;
import com.winsun.bean.UserSchool; import com.winsun.bean.UserSchool;
import com.winsun.mapper.HhrSupervisorSchoolMapper; import com.winsun.mapper.*;
import com.winsun.mapper.HhrUserMapper;
import com.winsun.mapper.SysUserMapper;
import com.winsun.mapper.UserSchoolMapper;
import com.winsun.service.AccessStatisticService; import com.winsun.service.AccessStatisticService;
import com.winsun.service.IHhrUserService; import com.winsun.service.IHhrUserService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -46,18 +43,22 @@ public class AnalysisController extends BaseController { ...@@ -46,18 +43,22 @@ public class AnalysisController extends BaseController {
private IHhrUserService hhrUserService; private IHhrUserService hhrUserService;
private OrderMapper orderMapper;
@Autowired @Autowired
public AnalysisController(SysUserMapper sysUserMapper, HhrUserMapper hhrUserMapper, public AnalysisController(SysUserMapper sysUserMapper, HhrUserMapper hhrUserMapper,
HhrSupervisorSchoolMapper hhrSupervisorSchoolMapper, HhrSupervisorSchoolMapper hhrSupervisorSchoolMapper,
UserSchoolMapper userSchoolMapper, UserSchoolMapper userSchoolMapper,
AccessStatisticService accessStatisticService, AccessStatisticService accessStatisticService,
IHhrUserService hhrUserService) { IHhrUserService hhrUserService,
OrderMapper orderMapper) {
this.sysUserMapper = sysUserMapper; this.sysUserMapper = sysUserMapper;
this.hhrUserMapper = hhrUserMapper; this.hhrUserMapper = hhrUserMapper;
this.hhrSupervisorSchoolMapper = hhrSupervisorSchoolMapper; this.hhrSupervisorSchoolMapper = hhrSupervisorSchoolMapper;
this.userSchoolMapper = userSchoolMapper; this.userSchoolMapper = userSchoolMapper;
this.accessStatisticService = accessStatisticService; this.accessStatisticService = accessStatisticService;
this.hhrUserService = hhrUserService; this.hhrUserService = hhrUserService;
this.orderMapper = orderMapper;
} }
/** /**
...@@ -171,4 +172,104 @@ public class AnalysisController extends BaseController { ...@@ -171,4 +172,104 @@ public class AnalysisController extends BaseController {
return ResponseData.success(uvStatisticsEchartData); return ResponseData.success(uvStatisticsEchartData);
} }
/**
* TODO 获取成员销量排名表
* @return
*/
@Permission(menuname="获取成员销量排名表", value="getUserSalesStatistic", method = RequestMethod.POST)
public ResponseData<Map<String, Object>> getUserSalesStatistic(String area, String school) {
Map<String, Object> map = new HashMap<>();
map.put("area", area);
map.put("school", school);
List<Map<String, Object>> userSalesStatistic = orderMapper.getUserSalesStatistic(map);
Map<String, Object> stringObjectMap = this.transferEchartData(userSalesStatistic);
return ResponseData.success(stringObjectMap);
}
/**
* TODO 获取楼长的销售统计
* @return
*/
@Permission(menuname="获取楼长的销售统计", value="getLzSalesStatistic", method = RequestMethod.POST)
public ResponseData<Map<String, Object>> getLzSalesStatistic(String area, String school) {
Map<String, Object> map = new HashMap<>();
map.put("area", area);
map.put("school", school);
List<Map<String, Object>> getLzSalesStatistic = orderMapper.getLzSalesStatistic(map);
Map<String, Object> stringObjectMap = this.transferEchartData(getLzSalesStatistic);
return ResponseData.success(stringObjectMap);
}
/**
* TODO 获取学校销量统计
* @return
*/
@Permission(menuname="获取学校销量统计", value="getSchoolSaleStatistic", method = RequestMethod.POST)
public ResponseData<Map<String, Object>> getSchoolSaleStatistic(String area, String school) {
Map<String, Object> map = new HashMap<>();
map.put("area", area);
map.put("school", school);
List<Map<String, Object>> getSchoolSaleStatistic = orderMapper.getSchoolSaleStatistic(map);
Map<String, Object> stringObjectMap = this.transferEchartData(getSchoolSaleStatistic);
return ResponseData.success(stringObjectMap);
}
/**
* TODO 获取产品转换率
* @return
*/
@Permission(menuname="获取产品转换率", value="getProductTransferStatistic", method = RequestMethod.POST)
public ResponseData<Map<String, Object>> getProductTransferStatistic(String area, String school) {
Map<String, Object> map = new HashMap<>();
map.put("area", area);
map.put("school", school);
List<Map<String, Object>> getProductTransferStatistic = orderMapper.getProductTransferStatistic(map);
Map<String, Object> stringObjectMap = this.transferEchartData(getProductTransferStatistic);
return ResponseData.success(stringObjectMap);
}
/**
* TODO 获取产品销售统计
* @return
*/
@Permission(menuname="获取产品销售统计", value="getProductSalesStatistic", method = RequestMethod.POST)
public ResponseData<Map<String, Object>> getProductSalesStatistic(String area, String school) {
Map<String, Object> map = new HashMap<>();
map.put("area", area);
map.put("school", school);
List<Map<String, Object>> getProductSalesStatistic = orderMapper.getProductSalesStatistic(map);
Map<String, Object> stringObjectMap = this.transferEchartData(getProductSalesStatistic);
return ResponseData.success(stringObjectMap);
}
/**
* TODO 获取区域不达标的数据
* @return
*/
@Permission(menuname="获取区域不达标的数据", value="getAreaSalesNotStandard", method = RequestMethod.POST)
public ResponseData<Map<String, Object>> getAreaSalesNotStandard(String area, String school) {
return null;
}
public Map<String, Object> transferEchartData(List<Map<String, Object>> maps) {
Map<String, Object> resultMap = new HashMap<>();
List<String> name = new ArrayList<>();
List<Float> num = new ArrayList<>();
maps.forEach(map -> {
if (map.get("name") != null) {
name.add(map.get("name").toString());
}
if (map.get("num") != null) {
num.add(Float.parseFloat(map.get("num").toString()));
}
});
resultMap.put("name", name);
resultMap.put("num", num);
return resultMap;
}
} }
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