Jelajahi Sumber

Merge remote-tracking branch 'origin/master'

周箭河 5 tahun lalu
induk
melakukan
64bb851e5f

+ 23 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentGoodsSellDao.java

@@ -2,6 +2,7 @@ package com.ym.mec.biz.dal.dao;
 
 
 import com.ym.mec.biz.dal.dto.StudentGoodsSellDto;
+import com.ym.mec.biz.dal.dto.StudentPaymentOrderDto;
 import com.ym.mec.biz.dal.entity.StudentGoodsSell;
 import com.ym.mec.common.dal.BaseDAO;
 import org.apache.ibatis.annotations.Param;
@@ -68,4 +69,26 @@ public interface StudentGoodsSellDao extends BaseDAO<Integer, StudentGoodsSell>
      * @return void
      */
     void autoAffirmReceive(@Param("orderNo") String orderNo, @Param("status") String status);
+
+    /**
+     * @describe 获取学生端商品购买列表
+     * @apiNote 时光荏苒,认真工作的时间总是过得很快,而我、享受这一刻!
+     * @author zouxuan
+     * @date 2020/10/14
+     * @time 17:50
+     * @param params:
+     * @return int
+     */
+    int countStudentPaymentOrders(Map<String, Object> params);
+
+    /**
+     * @describe 获取学生端商品购买列表
+     * @apiNote 时光荏苒,认真工作的时间总是过得很快,而我、享受这一刻!
+     * @author zouxuan
+     * @date 2020/10/14
+     * @time 17:50
+     * @param params:
+     * @return java.util.List<com.ym.mec.biz.dal.dto.StudentPaymentOrderDto>
+     */
+    List<StudentPaymentOrderDto> queryStudentPaymentOrders(Map<String, Object> params);
 }

+ 58 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/StudentPaymentOrderDto.java

@@ -0,0 +1,58 @@
+package com.ym.mec.biz.dal.dto;
+
+import com.ym.mec.biz.dal.entity.StudentPaymentOrder;
+
+import java.math.BigDecimal;
+
+public class StudentPaymentOrderDto extends StudentPaymentOrder {
+
+    private String image;
+
+    private String goodsName;
+
+    private Integer goodsNum = 1;
+
+    private Integer autoAffirmReceiveTime;
+
+    private BigDecimal goodsAmount = BigDecimal.ZERO;
+
+    public BigDecimal getGoodsAmount() {
+        return goodsAmount;
+    }
+
+    public void setGoodsAmount(BigDecimal goodsAmount) {
+        this.goodsAmount = goodsAmount;
+    }
+
+    public Integer getAutoAffirmReceiveTime() {
+        return autoAffirmReceiveTime;
+    }
+
+    public void setAutoAffirmReceiveTime(Integer autoAffirmReceiveTime) {
+        this.autoAffirmReceiveTime = autoAffirmReceiveTime;
+    }
+
+    public String getImage() {
+        return image;
+    }
+
+    public void setImage(String image) {
+        this.image = image;
+    }
+
+    public String getGoodsName() {
+        return goodsName;
+    }
+
+    public void setGoodsName(String goodsName) {
+        this.goodsName = goodsName;
+    }
+
+    public Integer getGoodsNum() {
+        return goodsNum;
+    }
+
+    public void setGoodsNum(Integer goodsNum) {
+        this.goodsNum = goodsNum;
+    }
+}

+ 12 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/StudentGoodsSellService.java

@@ -2,6 +2,7 @@ package com.ym.mec.biz.service;
 
 
 import com.ym.mec.biz.dal.dto.StudentGoodsSellDto;
+import com.ym.mec.biz.dal.dto.StudentPaymentOrderDto;
 import com.ym.mec.biz.dal.entity.StudentGoodsSell;
 import com.ym.mec.biz.dal.page.GoodsSellQueryInfo;
 import com.ym.mec.common.page.PageInfo;
@@ -30,4 +31,15 @@ public interface StudentGoodsSellService extends BaseService<Integer, StudentGoo
      * @return void
      */
     void affirmReceive(String orderNo);
+
+    /**
+     * @describe 获取学生端商品购买列表
+     * @apiNote 时光荏苒,认真工作的时间总是过得很快,而我、享受这一刻!
+     * @author zouxuan
+     * @date 2020/10/14
+     * @time 17:33
+     * @param queryInfo:
+     * @return com.ym.mec.common.page.PageInfo<com.ym.mec.biz.dal.dto.StudentGoodsSellDto>
+     */
+    PageInfo<StudentPaymentOrderDto> queryStudentPaymentOrders(GoodsSellQueryInfo queryInfo);
 }

+ 6 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/GoodsServiceImpl.java

@@ -409,6 +409,12 @@ public class GoodsServiceImpl extends BaseServiceImpl<Integer, Goods>  implement
 				goodsProcurementDao.update(goodsProcurement);
 				noneBatchNoSellOrder.setBatchNo(goodsProcurement.getBatchNo());
 				noneBatchNoSellOrder.setSellCost(goodsProcurement.getDiscountPrice());
+				Map<String, BigDecimal> CostMap = new HashMap<>();
+				CostMap.put("sellCost", goodsProcurement.getDiscountPrice());
+				if (Objects.nonNull(goodsProcurement.getAgreeCostPrice())) {
+					CostMap.put("SellCost2", goodsProcurement.getAgreeCostPrice());
+				}
+				noneBatchNoSellOrder.setSellCost2(JSON.toJSONString(CostMap));
 				updateSellOrders.add(noneBatchNoSellOrder);
 			}
 		}

+ 25 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentGoodsSellServiceImpl.java

@@ -4,6 +4,7 @@ package com.ym.mec.biz.service.impl;
 import com.ym.mec.biz.dal.dao.StudentGoodsSellDao;
 import com.ym.mec.biz.dal.dao.SysConfigDao;
 import com.ym.mec.biz.dal.dto.StudentGoodsSellDto;
+import com.ym.mec.biz.dal.dto.StudentPaymentOrderDto;
 import com.ym.mec.biz.dal.entity.StudentGoodsSell;
 import com.ym.mec.biz.dal.page.GoodsSellQueryInfo;
 import com.ym.mec.biz.service.StudentGoodsSellService;
@@ -74,4 +75,28 @@ public class StudentGoodsSellServiceImpl extends BaseServiceImpl<Integer, Studen
 			studentGoodsSellDao.autoAffirmReceive(orderNo,str);
 		}
 	}
+
+	@Override
+	public PageInfo<StudentPaymentOrderDto> queryStudentPaymentOrders(GoodsSellQueryInfo queryInfo) {
+		PageInfo<StudentPaymentOrderDto> pageInfo = new PageInfo<>(queryInfo.getPage(), queryInfo.getRows());
+		Map<String, Object> params = new HashMap<>();
+		MapUtil.populateMap(params, queryInfo);
+		List<StudentPaymentOrderDto> dataList = null;
+		int count = studentGoodsSellDao.countStudentPaymentOrders(params);
+		if (count > 0) {
+			pageInfo.setTotal(count);
+			params.put("offset", pageInfo.getOffset());
+			dataList = studentGoodsSellDao.queryStudentPaymentOrders(params);
+			Integer autoAffirmReceiveTime = Integer.parseInt(sysConfigDao.findConfigValue("auto_affirm_receive_time"));
+			dataList.forEach(e->{
+				e.setAutoAffirmReceiveTime(autoAffirmReceiveTime);
+			});
+		}
+		if (count == 0) {
+			dataList = new ArrayList<>();
+		}
+		pageInfo.setRows(dataList);
+		return pageInfo;
+	}
+
 }

+ 3 - 3
mec-biz/src/main/resources/config/mybatis/GoodsMapper.xml

@@ -354,10 +354,10 @@
         <result property="image" column="image_"/>
         <result property="goodsName" column="name_"/>
         <result property="goodsType" column="type_"/>
-        <result property="goodsPrice" column="market_price_"/>
-        <result property="totalGoodsPrice" column="market_price_"/>
+        <result property="goodsPrice" column="discount_price_"/>
+        <result property="totalGoodsPrice" column="discount_price_"/>
     </resultMap>
     <select id="queryGoodsSellDtos" resultMap="GoodsSellDtoMap">
-        SELECT id_,image_,name_,type_,market_price_,market_price_ FROM goods WHERE FIND_IN_SET(id_,#{goodsId})
+        SELECT id_,image_,name_,type_,discount_price_ FROM goods WHERE FIND_IN_SET(id_,#{goodsId})
     </select>
 </mapper>

+ 2 - 2
mec-biz/src/main/resources/config/mybatis/GoodsProcurementMapper.xml

@@ -114,7 +114,7 @@
 	<select id="queryGoodsProcurements" resultMap="GoodsProcurement" parameterType="map">
 		SELECT * FROM goods_procurement
 		<include refid="queryCondition"></include>
-		ORDER BY id_ <include refid="global.limit"/>
+		ORDER BY id_ DESC <include refid="global.limit"/>
 	</select>
 
 	<select id="countGoodsProcurements" resultType="int">
@@ -125,7 +125,7 @@
 	<!-- 分页查询 -->
 	<select id="queryPage" resultMap="GoodsProcurement" parameterType="map">
 		SELECT * FROM goods_procurement
-		ORDER BY id_ <include refid="global.limit"/>
+		ORDER BY id_ DESC <include refid="global.limit"/>
 	</select>
 	
 	<!-- 查询当前表的总记录数 -->

+ 33 - 0
mec-biz/src/main/resources/config/mybatis/StudentGoodsSellMapper.xml

@@ -147,4 +147,37 @@
 		LEFT JOIN student_payment_order spo ON spo.order_no_ = so.order_no_
 		WHERE spo.status_ = 'SUCCESS' AND TIMESTAMPDIFF(HOUR,spo.pay_time_,NOW()) >= #{autoAffirmReceiveTime}
 	</select>
+	<resultMap type="com.ym.mec.biz.dal.dto.StudentPaymentOrderDto" id="StudentPaymentOrderDto" extends="com.ym.mec.biz.dal.dao.StudentPaymentOrderDao.StudentPaymentOrder">
+		<result column="goods_image_" property="image" />
+		<result column="goods_name_" property="goodsName" />
+		<result column="goods_num_" property="goodsNum" />
+		<result column="goods_amount_" property="goodsAmount" />
+	</resultMap>
+	<sql id="queryStudentPaymentOrdersSql">
+		<where>
+			<if test="status != null">
+				AND spo.status_ = #{status}
+			</if>
+			<if test="receiveStatus != null and receiveStatus != ''">
+				AND spo.receive_status_ = #{receiveStatus}
+			</if>
+			<if test="studentId != null">
+				AND spo.user_id_ = #{studentId}
+			</if>
+		</where>
+	</sql>
+    <select id="queryStudentPaymentOrders" resultMap="StudentPaymentOrderDto">
+		SELECT spo.*,g.image_ goods_image_,g.name_ goods_name_,so.num_ goods_num_,so.expect_amount_ goods_amount_
+		FROM student_payment_order spo
+		LEFT JOIN sell_order so ON so.order_no_ = spo.order_no_
+		LEFT JOIN goods g ON g.id_ = so.goods_id_
+		<include refid="queryStudentPaymentOrdersSql"/>
+		ORDER BY spo.pay_time_ DESC
+		<include refid="global.limit"/>
+	</select>
+	<select id="countStudentPaymentOrders" resultType="java.lang.Integer">
+		SELECT COUNT(DISTINCT spo.id_)
+		FROM student_payment_order spo
+		<include refid="queryStudentPaymentOrdersSql"/>
+	</select>
 </mapper>

+ 1 - 1
mec-student/src/main/java/com/ym/mec/student/controller/RepairController.java

@@ -150,7 +150,7 @@ public class RepairController extends BaseController {
             return failed(HttpStatus.FORBIDDEN, "请登录");
         }
         queryInfo.setStudentId(sysUser.getId());
-        return succeed(studentGoodsSellService.queryStudentGoodsOrders(queryInfo));
+        return succeed(studentGoodsSellService.queryStudentPaymentOrders(queryInfo));
     }
 
     @ApiOperation(value = "获取学员商品订单")