Skip to content

Commit a4bbaf8

Browse files
author
xiaowei
committed
update web bugs
1 parent 74e515d commit a4bbaf8

6 files changed

Lines changed: 137 additions & 80 deletions

File tree

src/main/java/com/changyu/foryou/controller/OrderController.java

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -959,12 +959,17 @@ public void run() {
959959
* @return
960960
*/
961961
@RequestMapping(value = "/getPCSimpleOrder")
962-
public @ResponseBody Map<String, Object> getPcOrders(Short status,
962+
public @ResponseBody Map<String, Object> getPcOrders(Short status,@RequestParam Integer campusId,
963963
Integer limit, Integer offset, String search) {
964964
Map<String, Object> map = new HashMap<String, Object>();
965-
966-
List<PCOrder> lists = orderService.getPCOrders(status, limit, offset,
967-
search);
965+
966+
Map<String,Object> paramMap=new HashMap<String,Object>();
967+
paramMap.put("campusId", campusId);
968+
paramMap.put("limit", limit);
969+
paramMap.put("offset", offset);
970+
paramMap.put("search", search);
971+
paramMap.put("status", status);
972+
List<PCOrder> lists = orderService.getPCSimpleOrders(paramMap);
968973
DecimalFormat df = new DecimalFormat("####.00");
969974

970975
for (PCOrder order : lists) {
@@ -983,7 +988,7 @@ public void run() {
983988
JSONArray jsonArray = JSONArray.parseArray(JSON
984989
.toJSONStringWithDateFormat(lists, "yyyy-MM-dd"));
985990

986-
long totalCount = orderService.getPCOrdersCount(status, search);
991+
long totalCount = orderService.getPCSimpleOrdersCount(paramMap);
987992
map.put("rows", jsonArray);
988993
map.put("total", totalCount);
989994
return map;

src/main/java/com/changyu/foryou/mapper/OrderMapper.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,4 +125,8 @@ public interface OrderMapper {
125125
Integer getSalesInfoByCampusId(Map<String, Object> paramMap); //根据校区和时间段获取销售量
126126

127127
Float getTradeVolumeByCampusId(Map<String, Object> paramMap); //获取指定时间段和指定校区的订单交易额
128+
129+
List<PCOrder> getPCSimpleOrders(Map<String, Object> paramMap);
130+
131+
long getPCSimpleOrdersCount(Map<String, Object> paramMap);
128132
}

src/main/java/com/changyu/foryou/mapping/OrderMapper.xml

Lines changed: 102 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,8 @@
504504
and status=4
505505
</if>
506506
<if test="status==null">
507-
and status !=0 and status!=9 and status!=10 and status!=11
507+
and status !=0 and status!=9 and status!=10 and
508+
status!=11
508509
</if>
509510
</where>
510511
group by together_id
@@ -580,7 +581,8 @@
580581
together_order
581582
WHERE
582583
campus_id = #{campusId,jdbcType=INTEGER}
583-
AND tag = #{tag,jdbcType=SMALLINT}
584+
AND tag =
585+
#{tag,jdbcType=SMALLINT}
584586
AND status IN (2,3)
585587
<if test="isSelected == 0">
586588
AND admin_phone IS NULL
@@ -661,7 +663,7 @@
661663
together_id=#{togetherId,jdbcType=VARCHAR}
662664
</select>
663665

664-
<!-- web端获取订单(除待发货订单) -->
666+
<!-- web端获取订单(除待发货订单) 弃用 -->
665667
<select id="getPCOrders" resultMap="PCSimpleOrderMap">
666668
SELECT
667669
together_id,
@@ -702,7 +704,50 @@
702704
order by together_date DESC,orders.phone ASC
703705
limit ${offset},${limit}
704706
</select>
707+
708+
<!-- pc端获取订单 -->
709+
<select id="getPCSimpleOrders" resultMap="PCSimpleOrderMap">
710+
SELECT
711+
together_id,
712+
orders.phone,
713+
food. NAME AS NAME,
714+
order_count,
715+
address,
716+
orders.admin_phone,
717+
together_date,
718+
receiver.phone AS receiver_phone,
719+
food.price AS food_price,
720+
orders.price,
721+
is_discount,
722+
discount_price,
723+
users.nickname AS admin_name
724+
FROM
725+
orders
726+
LEFT JOIN food on orders.food_id = food.food_id and
727+
orders.campus_id=food.campus_id
728+
left join receiver on orders.rank = receiver.rank and orders.phone =
729+
receiver.phone_id
730+
left join users on orders.admin_phone=users.phone
731+
WHERE orders. STATUS =#{status,jdbcType=SMALLINT}
732+
AND orders.tag = 1
733+
and orders.campus_id=#{campusId,jdbcType=INTEGER}
734+
<if test="search!=null">
735+
and orders.phone like "%${search}%"
736+
</if>
737+
order by together_date DESC,orders.phone ASC
738+
limit ${offset},${limit}
739+
</select>
705740

741+
<select id="getPCSimpleOrdersCount" resultType="Long">
742+
select count(*)
743+
from orders
744+
WHERE orders. STATUS =#{status,jdbcType=SMALLINT}
745+
AND orders.tag = 1
746+
and orders.campus_id=#{campusId,jdbcType=INTEGER}
747+
<if test="search!=null">
748+
and phone like "%${search}%"
749+
</if>
750+
</select>
706751
<!-- web端获取代发货订单 -->
707752
<select id="getPCOrdersWithOutAdmin" resultMap="PCSimpleOrderMap">
708753
SELECT
@@ -838,7 +883,8 @@
838883
<update id="deleteOrder">
839884
update orders
840885
set tag = 0
841-
where together_id=#{togetherId,jdbcType=VARCHAR}
886+
where
887+
together_id=#{togetherId,jdbcType=VARCHAR}
842888
and status=4
843889
</update>
844890

@@ -872,7 +918,8 @@
872918
<select id="getAdminPhone" resultType="String">
873919
select
874920
admin_phone
875-
from orders
921+
from
922+
orders
876923
where
877924
together_id=#{togetherId,jdbcType=VARCHAR}
878925
limit 1
@@ -881,13 +928,15 @@
881928
<update id="updateOrderPrice">
882929
update orders
883930
set total_price=#{totalPrice}
884-
where order_id=#{orderId}
931+
where
932+
order_id=#{orderId}
885933
</update>
886934

887935
<!-- 根据togetherId获取该笔大订单总价 -->
888936
<select id="selectTotalPriceByTogetherId" resultType="FLOAT">
889937
select
890-
total_price from orders where together_id=#{togetherId,jdbcType=VARCHAR} limit 1
938+
total_price from orders where
939+
together_id=#{togetherId,jdbcType=VARCHAR} limit 1
891940
</select>
892941

893942
<!-- 支付完成后更新价格和状态 -->
@@ -896,7 +945,8 @@
896945
orders
897946
set total_price=#{amount,jdbcType=REAL},
898947
status=2 ,charge_id=#{chargeId,jdbcType=VARCHAR}
899-
where together_id=#{togetherId,jdbcType=VARCHAR}
948+
where
949+
together_id=#{togetherId,jdbcType=VARCHAR}
900950
</update>
901951

902952
<!-- 根据订单号获取校区号 -->
@@ -918,7 +968,8 @@
918968
orders,food
919969
where
920970
orders.food_id=food.food_id and orders.tag =1
921-
and order_id=#{orderId,jdbcType=BIGINT} and phone =
971+
and
972+
order_id=#{orderId,jdbcType=BIGINT} and phone =
922973
#{phoneId,jdbcType=VARCHAR}
923974
</select>
924975

@@ -935,9 +986,11 @@
935986
<!--获取客户端订单 -->
936987
<select id="getPCOrdersNew" resultMap="SuperAdminOrderMap">
937988
select
938-
together_id,custome_phone as phone,together_date,total_price as price,address,charge_id
989+
together_id,custome_phone as phone,together_date,total_price as
990+
price,address,charge_id
939991
from together_order
940-
where tag=1 and status=#{status}
992+
where tag=1 and
993+
status=#{status}
941994
<if test="campusId != null">
942995
and campus_id=#{campusId,jdbcType=INTEGER}
943996
</if>
@@ -968,79 +1021,58 @@
9681021
update
9691022
orders
9701023
set status=10
971-
where together_id=#{togetherId,jdbcType=VARCHAR}
1024+
where
1025+
together_id=#{togetherId,jdbcType=VARCHAR}
9721026
</update>
9731027

9741028
<!-- 更新退款订单状态,推给管理员 -->
9751029
<update id="updateorderStatusRefundSuccess">
9761030
update
9771031
orders
9781032
set status=11
979-
where together_id=#{togetherId,jdbcType=VARCHAR}
1033+
where
1034+
together_id=#{togetherId,jdbcType=VARCHAR}
9801035
</update>
9811036

9821037
<!-- 获取各个状态的订单数量 -->
983-
<!-- <select id="getMiniOrderByPhone" resultType="String">
984-
SELECT COUNT(DISTINCT together_id) from orders WHERE together_id in
985-
(select DISTINCT together_id from orders <where> phone=#{phoneId,jdbcType=VARCHAR}
986-
<if test="isRemarked!=null"> and is_remarked=#{isRemarked,jdbcType=SMALLINT}
987-
</if> and status=#{status,jdbcType=SMALLINT} and tag=1 </where> GROUP BY
988-
together_id)
989-
select
990-
together_id
991-
from orders
992-
<where>
993-
phone = #{phoneId,jdbcType=VARCHAR} and together_id is not null and
994-
orders.tag=1
995-
<if test="status!=null and status!=4 and status!=5">
996-
and status = #{status,jdbcType=SMALLINT}
997-
</if>
998-
<if test="status==4">
999-
and status=4
1000-
</if>
1001-
<if test="status==5">
1002-
and status=4
1003-
</if>
1004-
<if test="status==null">
1005-
and status !=0
1006-
</if>
1007-
</where>
1008-
group by together_id
1009-
<if test="status==4">
1010-
having count(order_id)!=sum(is_remarked)
1011-
</if>
1012-
<if test="status==5">
1013-
having count(order_id)=sum(is_remarked)
1014-
</if>
1015-
1016-
1017-
</select> -->
1018-
1038+
<!-- <select id="getMiniOrderByPhone" resultType="String"> SELECT COUNT(DISTINCT
1039+
together_id) from orders WHERE together_id in (select DISTINCT together_id
1040+
from orders <where> phone=#{phoneId,jdbcType=VARCHAR} <if test="isRemarked!=null">
1041+
and is_remarked=#{isRemarked,jdbcType=SMALLINT} </if> and status=#{status,jdbcType=SMALLINT}
1042+
and tag=1 </where> GROUP BY together_id) select together_id from orders <where>
1043+
phone = #{phoneId,jdbcType=VARCHAR} and together_id is not null and orders.tag=1
1044+
<if test="status!=null and status!=4 and status!=5"> and status = #{status,jdbcType=SMALLINT}
1045+
</if> <if test="status==4"> and status=4 </if> <if test="status==5"> and
1046+
status=4 </if> <if test="status==null"> and status !=0 </if> </where> group
1047+
by together_id <if test="status==4"> having count(order_id)!=sum(is_remarked)
1048+
</if> <if test="status==5"> having count(order_id)=sum(is_remarked) </if>
1049+
</select> -->
1050+
10191051
<!-- 获取指定时间段和指定校区的订单总数 -->
10201052
<select id="getSalesInfoByCampusId" resultType="Integer">
1021-
select COUNT(DISTINCT together_id) from orders
1022-
where campus_id=#{campusId}
1023-
and together_date BETWEEN #{dateStart,jdbcType=TIMESTAMP}
1024-
and #{dateEnd,jdbcType=TIMESTAMP}
1025-
and tag=1
1053+
select COUNT(DISTINCT together_id) from orders
1054+
where campus_id=#{campusId}
1055+
and together_date BETWEEN #{dateStart,jdbcType=TIMESTAMP}
1056+
and #{dateEnd,jdbcType=TIMESTAMP}
1057+
and tag=1
10261058
</select>
1027-
1059+
10281060
<!-- 获取指定时间段和指定校区的订单交易额 -->
10291061
<select id="getTradeVolumeByCampusId" resultType="Float">
1030-
SELECT sum(total_price)
1031-
from together_order
1032-
<where>
1033-
campus_id=#{campusId,jdbcType=INTEGER}
1034-
<if test="dateStart!=null and dateEnd!=null">
1035-
and together_date BETWEEN #{dateStart,jdbcType=TIMESTAMP}
1036-
AND #{dateEnd,jdbcType=TIMESTAMP}
1037-
</if>
1038-
<if test="dateToday!=null">
1039-
and together_date>=#{dateToday,jdbcType=TIMESTAMP}
1040-
</if>
1041-
<if test="payWay!=null">
1042-
AND pay_way=#{payWay,jdbcType=SMALLINT}
1043-
</if>
1044-
</where>
1062+
SELECT sum(total_price)
1063+
from together_order
1064+
<where>
1065+
campus_id=#{campusId,jdbcType=INTEGER}
1066+
<if test="dateStart!=null and dateEnd!=null">
1067+
and together_date BETWEEN #{dateStart,jdbcType=TIMESTAMP}
1068+
AND #{dateEnd,jdbcType=TIMESTAMP}
1069+
</if>
1070+
<if test="dateToday!=null">
1071+
and together_date>=#{dateToday,jdbcType=TIMESTAMP}
1072+
</if>
1073+
<if test="payWay!=null">
1074+
AND pay_way=#{payWay,jdbcType=SMALLINT}
1075+
</if>
1076+
</where>
10451077
</select>
10461078
</mapper>

src/main/java/com/changyu/foryou/service/OrderService.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,6 @@ public interface OrderService {
6565

6666
List<DeliverChildOrder> getDeliverChildOrders(String togetherId);
6767

68-
List<PCOrder> getPCOrders(Short status,Integer limit, Integer offset, String search);
69-
7068
Long getPCOrdersCount(Short status,String search);
7169

7270
int setOrderInvalid(Map<String, Object> parameterMap);
@@ -126,4 +124,8 @@ public interface OrderService {
126124
Integer getSalesInfoByCampusId(Map<String, Object> paramMap); //根据校区和时间段获取销售量
127125

128126
Float getTradeVolumeByCampusId(Map<String, Object> paramMap); //获取指定时间段和指定校区的订单交易额
127+
128+
List<PCOrder> getPCSimpleOrders(Map<String, Object> paramMap);
129+
130+
long getPCSimpleOrdersCount(Map<String, Object> paramMap);
129131
}

src/main/java/com/changyu/foryou/serviceImpl/OrderServiceImpl.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -342,21 +342,28 @@ public Integer updateOrderStatusRefundSuccess(Map<String, Object> paramMap) {
342342

343343
@Override
344344
public Integer getMiniOrderByPhone(Map<String, Object> paramMap) {
345-
// TODO Auto-generated method stub
346345
return orderMapper.getMiniOrderByPhone(paramMap);
347346
}
348347

349348
@Override
350349
public Integer getSalesInfoByCampusId(Map<String, Object> paramMap) {
351-
// TODO Auto-generated method stub
352350
return orderMapper.getSalesInfoByCampusId(paramMap);
353351
}
354352

355353
@Override
356354
public Float getTradeVolumeByCampusId(Map<String, Object> paramMap) {
357-
// TODO Auto-generated method stub
358355
return orderMapper.getTradeVolumeByCampusId(paramMap);
359356
}
357+
358+
@Override
359+
public List<PCOrder> getPCSimpleOrders(Map<String, Object> paramMap) {
360+
return orderMapper.getPCSimpleOrders(paramMap);
361+
}
362+
363+
@Override
364+
public long getPCSimpleOrdersCount(Map<String, Object> paramMap) {
365+
return orderMapper.getPCSimpleOrdersCount(paramMap);
366+
}
360367

361368

362369
}

src/main/webapp/index.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,13 @@
257257
//如果是校区管理员,使用他管理的校区Button替换校区下拉菜单,且隐藏校区管理和校区管理员管理
258258
if(getCookie("type")==1){
259259
$("#campusDropdown").css("visibility", "visible");
260+
if(campusId!=null&&typeof(campusId)!="undefined"){
261+
$.post('campus/getCampusById.do', {
262+
campusId : getCookie("campusId")
263+
},function(data){
264+
$("#dropdownMenu1").html(data.campus.campusName+'<span class="caret"></span>');
265+
},"json");
266+
}
260267
}else{
261268
//隐藏校区管理和校区管理员管理
262269
$("#li-campus-admin").hide();

0 commit comments

Comments
 (0)