Commit 93138237 by 罗承锋

Merge remote-tracking branch 'origin/master'

parents 0ee647eb 0031a7d7
...@@ -161,4 +161,29 @@ public interface OrderMapper extends BaseMapper<Order> { ...@@ -161,4 +161,29 @@ public interface OrderMapper extends BaseMapper<Order> {
* */ * */
@Select("SELECT * FROM hhr_order WHERE user_type = '5' and order_status = '未下单'") @Select("SELECT * FROM hhr_order WHERE user_type = '5' and order_status = '未下单'")
List<Map<String,Object>> selectDKList(); List<Map<String,Object>> selectDKList();
/**
* 一人一码订单通报 -- 移动订单(学校)
* @return
*/
List<Map<String,Object>> orderConversionXX(String startTime,String endTime);
/**
* 一人一码订单通报 -- 移动订单(学校)
* @return
*/
List<Map<String,Object>> orderConversionXF(String startTime,String endTime);
/**
* 一人一码订单通报 -- 宽带订单(学校)
* @return
*/
List<Map<String,Object>> kdOrderConversionXX(String startTime,String endTime);
/**
* 一人一码订单通报 -- 宽带订单(学校)
* @return
*/
List<Map<String,Object>> kdOrderConversionXF(String startTime,String endTime);
} }
...@@ -196,4 +196,98 @@ ...@@ -196,4 +196,98 @@
update hhr_order set order_status = "待受理" where DATE_FORMAT(rh_time, "%y-%m-%d") &lt; date_format(now(), "%y-%m-%d") and order_status = "未下单" update hhr_order set order_status = "待受理" where DATE_FORMAT(rh_time, "%y-%m-%d") &lt; date_format(now(), "%y-%m-%d") and order_status = "未下单"
</update> </update>
<select id="orderConversionXX" parameterType="String" resultType="HashMap">
SELECT order_by,sub_name,school,supervisor ,
COUNT(o.id) orderCount ,
COUNT(o.xb_order_id) xb_orderCount ,
COUNT(CASE WHEN xb_order_id is NULL or xb_order_id = '' THEN o.id end) yz_orderCount ,
count(case when o.order_status in( '待识别','重新下单','待选号','审核中','待受理','提交中') then o.id end) status_1,
count(case when o.order_status = '待处理' then o.id end) status_2,
count(case when o.order_status = '待配送' then o.id end) status_3,
count(case when o.order_status in ('待活体','已发货') then o.id end) status_4,
count(case when o.order_status = '已完成' then o.id end) status_5
FROM hhr_report_conversion rc
LEFT JOIN hhr_order o
ON rc.hehuoren_school = o.hehuoren_school
and rc.sub_name = o.hehuoren_area
and user_type = 0
and order_status != '异常单'
and o.kapin != '天翼学生证'
and DATE_FORMAT(create_time,'%Y-%m-%d') BETWEEN #{startTime} AND #{endTime}
GROUP BY order_by,sub_name,school,supervisor
HAVING order_by is not null
ORDER BY order_by
</select>
<select id="orderConversionXF" parameterType="String" resultType="HashMap">
SELECT sub_id,sub_name ,
COUNT(o.id) orderCount ,
COUNT(o.xb_order_id) xb_orderCount ,
COUNT(CASE WHEN xb_order_id is NULL or xb_order_id = '' THEN o.id end) yz_orderCount ,
count(case when o.order_status in( '待识别','重新下单','待选号','审核中','待受理','提交中') then o.id end) status_1,
count(case when o.order_status = '待处理' then o.id end) status_2,
count(case when o.order_status = '待配送' then o.id end) status_3,
count(case when o.order_status in ('待活体','已发货') then o.id end) status_4,
count(case when o.order_status = '已完成' then o.id end) status_5
FROM hhr_report_conversion rc
LEFT JOIN hhr_order o
ON rc.hehuoren_school = o.hehuoren_school
and rc.sub_name = o.hehuoren_area
and user_type = 0
and order_status != '异常单'
and o.kapin != '天翼学生证'
and DATE_FORMAT(create_time,'%Y-%m-%d') BETWEEN #{startTime} AND #{endTime}
GROUP BY sub_id,sub_name
HAVING sub_name is not null and sub_name != 'null'
ORDER BY sub_id
</select>
<select id="kdOrderConversionXX" parameterType="String" resultType="HashMap">
SELECT order_by,sub_name,school,supervisor,
COUNT(o.id) orderCount ,
count(case when o.user_type ='5' then o.id end) status_5_1,
count(case when o.user_type ='5' and order_status = '已完成' then o.id end) status_5_2,
count(case when o.user_type ='5' and order_status = '异常单' then o.id end) status_5_3,
count(case when o.user_type ='3' then o.id end) status_3_1,
count(case when o.user_type ='3' and order_status = '已完成' then o.id end) status_3_2,
count(case when o.user_type ='3' and order_status = '异常单' then o.id end) status_3_3,
count(case when o.user_type ='10' then o.id end) status_10_1,
count(case when o.user_type ='10' and order_status = '已完成' then o.id end) status_10_2,
count(case when o.user_type ='10' and order_status = '异常单' then o.id end) status_10_3
FROM hhr_report_conversion rc
LEFT JOIN hhr_order o
ON rc.hehuoren_school = o.hehuoren_school
and rc.sub_name = o.hehuoren_area
and user_type in ('3','5','10')
and DATE_FORMAT(create_time,'%Y-%m-%d') BETWEEN #{startTime} AND #{endTime}
GROUP BY order_by,sub_name,school,supervisor
HAVING order_by is not null
ORDER BY order_by
</select>
<select id="kdOrderConversionXF" parameterType="String" resultType="HashMap">
SELECT sub_id,sub_name,
count(DISTINCT school) schoolCount,
count(o.id) orderCount ,
count(case when o.user_type ='5' then o.id end) status_5_1,
count(case when o.user_type ='5' and order_status = '已完成' then o.id end) status_5_2,
count(case when o.user_type ='5' and order_status = '异常单' then o.id end) status_5_3,
count(case when o.user_type ='3' then o.id end) status_3_1,
count(case when o.user_type ='3' and order_status = '已完成' then o.id end) status_3_2,
count(case when o.user_type ='3' and order_status = '异常单' then o.id end) status_3_3,
count(case when o.user_type ='10' then o.id end) status_10_1,
count(case when o.user_type ='10' and order_status = '已完成' then o.id end) status_10_2,
count(case when o.user_type ='10' and order_status = '异常单' then o.id end) status_10_3
FROM hhr_report_conversion rc
LEFT JOIN hhr_order o
ON rc.hehuoren_school = o.hehuoren_school
and rc.sub_name = o.hehuoren_area
and user_type in ('3','5','10')
and DATE_FORMAT(create_time,'%Y-%m-%d') BETWEEN '2019-01-01' AND '2021-03-01'
GROUP BY sub_id,sub_name
HAVING sub_id not in (14,15)
ORDER BY sub_id
</select>
</mapper> </mapper>
\ No newline at end of file
package com.winsun.controller;
import com.baomidou.mybatisplus.plugins.Page;
import com.winsun.auth.core.annotion.Permission;
import com.winsun.auth.core.base.controller.BaseController;
import com.winsun.auth.core.common.model.ResponseData;
import com.winsun.auth.core.shiro.ShiroUser;
import com.winsun.bean.Order;
import com.winsun.mapper.OrderMapper;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.formula.functions.Now;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* @Author: chenhaojian
* @Date: 2021/3/3 10:33
*/
@Slf4j
@RestController
@RequestMapping("/orderConversion")
public class OrderConversionController extends BaseController {
private static OrderMapper orderMapper;
// 获取订单通报数据
// conversionType:
// 00:移动通报学校
// 01:移动通报县份
// 10:宽带通报学校
// 11:宽带通报学校
// @RequestMapping(value = "getOrderConversionInfo",method = RequestMethod.POST)
@Permission(menuname = "获取订单通报数据", value = "getOrderConversionInfo", method = RequestMethod.POST)
public ResponseData getOrderConversionInfo(@RequestParam("startTime")String startTime,
@RequestParam("endTime")String endTime,
@RequestParam("conversionType")String conversionType,
@RequestParam(name = "pageNo") int pageNo,
@RequestParam(name = "pageSize") int pageSize){
ShiroUser user = getShiroUser();
if (!user.getRoleNames().stream().anyMatch(roleName -> StringUtils.equalsAny(roleName, "超级管理员", "县分管理员(订单)"))) {
ResponseData.error("无权限查询订单");
}
List<Map<String,Object>> list = null;
Page<Map<String,Object>> page = new Page<>(pageNo, pageSize);
if("".equals(startTime)&&"".equals(endTime)){
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
// 暂时计算2019年6月1号开始数据
startTime = "2019-06-01";
endTime = sdf.format(new Date());
}
try{
switch (conversionType){
case "00":
list = orderMapper.orderConversionXX(startTime,endTime);
break;
case "01":
list = orderMapper.orderConversionXF(startTime,endTime);
break;
case "10":
list = orderMapper.kdOrderConversionXX(startTime,endTime);
break;
case "11":
list = orderMapper.kdOrderConversionXF(startTime,endTime);
break;
}
}catch (Exception e){
e.printStackTrace();
}
page.setRecords(list);
return ResponseData.success(page,"查询成功!");
}
}
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