Переглянути джерело

Merge remote-tracking branch 'origin/Joburgess' into Joburgess

周箭河 5 роки тому
батько
коміт
d4e62a82a0
29 змінених файлів з 291 додано та 61 видалено
  1. 9 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/GoodsDao.java
  2. 22 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentGoodsSellDao.java
  3. 2 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/TeacherDao.java
  4. 17 3
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/Goods.java
  5. 23 11
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/GoodsProcurement.java
  6. 11 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/SellOrder.java
  7. 11 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/StudentPaymentOrder.java
  8. 1 1
      mec-biz/src/main/java/com/ym/mec/biz/dal/enums/StockType.java
  9. 0 10
      mec-biz/src/main/java/com/ym/mec/biz/service/GoodsProcurementService.java
  10. 11 0
      mec-biz/src/main/java/com/ym/mec/biz/service/GoodsService.java
  11. 11 0
      mec-biz/src/main/java/com/ym/mec/biz/service/StudentGoodsSellService.java
  12. 0 14
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/GoodsProcurementServiceImpl.java
  13. 51 5
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/GoodsServiceImpl.java
  14. 19 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentGoodsSellServiceImpl.java
  15. 4 6
      mec-biz/src/main/resources/config/mybatis/GoodsMapper.xml
  16. 1 1
      mec-biz/src/main/resources/config/mybatis/GoodsProcurementMapper.xml
  17. 7 1
      mec-biz/src/main/resources/config/mybatis/SellOrderMapper.xml
  18. 12 1
      mec-biz/src/main/resources/config/mybatis/StudentGoodsSellMapper.xml
  19. 6 2
      mec-biz/src/main/resources/config/mybatis/StudentPaymentOrderMapper.xml
  20. 5 0
      mec-biz/src/main/resources/config/mybatis/TeacherMapper.xml
  21. 4 0
      mec-client-api/src/main/java/com/ym/mec/task/TaskRemoteService.java
  22. 5 0
      mec-client-api/src/main/java/com/ym/mec/task/fallback/TaskRemoteServiceFallback.java
  23. 7 0
      mec-student/src/main/java/com/ym/mec/student/controller/RepairController.java
  24. 19 0
      mec-task/src/main/java/com/ym/mec/task/jobs/AutoAffirmReceiveTask.java
  25. 10 1
      mec-web/src/main/java/com/ym/mec/web/controller/GoodsController.java
  26. 9 3
      mec-web/src/main/java/com/ym/mec/web/controller/GoodsProcurementContrller.java
  27. 8 0
      mec-web/src/main/java/com/ym/mec/web/controller/TaskController.java
  28. 6 2
      mec-web/src/main/resources/columnMapper.ini
  29. BIN
      mec-web/src/main/resources/excelTemplate/商品导入模板.xls

+ 9 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/GoodsDao.java

@@ -65,6 +65,15 @@ public interface GoodsDao extends BaseDAO<Integer, Goods> {
     /**
      * @describe 根据货号查找商品
      * @author Joburgess
+     * @date 2020.10.10
+     * @param sn:
+     * @return com.ym.mec.biz.dal.entity.Goods
+     */
+    Goods findBySn(@Param("sn") String sn);
+
+    /**
+     * @describe 根据货号查找商品
+     * @author Joburgess
      * @date 2020.09.28
      * @param sns:
      * @return java.util.List<com.ym.mec.biz.dal.entity.Goods>

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

@@ -46,4 +46,26 @@ public interface StudentGoodsSellDao extends BaseDAO<Integer, StudentGoodsSell>
     StudentGoodsSell findByOrderNo(@Param("orderNo") String orderNo);
 
     StudentGoodsSellDto getStudentGoodsSellDto(String orderNo);
+
+    /**
+     * @describe 获取到期未确认的订单
+     * @apiNote 时光荏苒,认真工作的时间总是过得很快,而我、享受这一刻!
+     * @author zouxuan
+     * @date 2020/10/12
+     * @time 10:09
+     * @param autoAffirmReceiveTime:
+     * @return java.util.List<java.lang.String>
+     */
+    String queryNoAffirmOrderNo(String autoAffirmReceiveTime);
+
+    /**
+     * @describe 自动确认收货
+     * @apiNote 时光荏苒,认真工作的时间总是过得很快,而我、享受这一刻!
+     * @author zouxuan
+     * @date 2020/10/12
+     * @time 10:15
+     * @param orderNo:
+     * @return void
+     */
+    void autoAffirmReceive(@Param("orderNo") String orderNo, @Param("status") String status);
 }

+ 2 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/TeacherDao.java

@@ -474,4 +474,6 @@ public interface TeacherDao extends BaseDAO<Integer, Teacher> {
     int countStudent(Map<String, Object> params);
     
     List<TeacherDefaultSalaryDto> queryTeacherDefaultSalary(@Param("organIdList") String organIdList);
+
+    BasicUserDto findUserByPhone(String phone);
 }

+ 17 - 3
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/Goods.java

@@ -122,17 +122,31 @@ public class Goods {
 	@ApiModelProperty(value = "商品类型", required = false)
 	private GoodsType type;
 
+	@ApiModelProperty(value = "备查货号,进货渠道")
 	private String supplyChannel;
 
-	private Integer clientShow;
+	@ApiModelProperty(value = "客户端是否展示")
+	private YesOrNoEnum clientShow;
 
+	@ApiModelProperty(value = "库存类型")
 	private StockType stockType;
 
-	public Integer getClientShow() {
+	@ApiModelProperty(value = "库存预警")
+	private YesOrNoEnum stockWarning;
+
+	public YesOrNoEnum getStockWarning() {
+		return stockWarning;
+	}
+
+	public void setStockWarning(YesOrNoEnum stockWarning) {
+		this.stockWarning = stockWarning;
+	}
+
+	public YesOrNoEnum getClientShow() {
 		return clientShow;
 	}
 
-	public void setClientShow(Integer clientShow) {
+	public void setClientShow(YesOrNoEnum clientShow) {
 		this.clientShow = clientShow;
 	}
 

+ 23 - 11
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/GoodsProcurement.java

@@ -1,5 +1,6 @@
 package com.ym.mec.biz.dal.entity;
 
+import io.swagger.annotations.ApiModelProperty;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 
 /**
@@ -7,35 +8,38 @@ import org.apache.commons.lang3.builder.ToStringBuilder;
  */
 public class GoodsProcurement {
 
-	/**  */
+	@ApiModelProperty(value = "编号")
 	private Long id;
 	
-	/** 商品编号 */
+	@ApiModelProperty(value = "商品编号")
 	private Integer goodsId;
 	
-	/** 商品分类 */
+	@ApiModelProperty(value = "商品分类")
 	private Integer goodsCategoryId;
 	
-	/** 进货渠道 */
+	@ApiModelProperty(value = "进货渠道")
 	private String supplyChannel;
 	
-	/** 采购价一 */
+	@ApiModelProperty(value = "采购价一")
 	private java.math.BigDecimal discountPrice;
 	
-	/** 采购价二 */
+	@ApiModelProperty(value = "采购价二")
 	private java.math.BigDecimal agreeCostPrice;
 	
-	/** 总进货数量 */
+	@ApiModelProperty(value = "总进货数量")
 	private Integer totalQuantity;
 	
-	/** 税务数量 */
+	@ApiModelProperty(value = "税务数量")
 	private Integer taxQuantity;
 	
-	/** 进货人编号 */
+	@ApiModelProperty(value = "进货人编号")
 	private Integer operatorId;
 
-	/** 批次号 */
+	@ApiModelProperty(value = "批次号")
 	private String batchNo;
+
+	@ApiModelProperty(value = "售出数量")
+	private int soldNum;
 	
 	/**  */
 	private java.util.Date createTime;
@@ -138,7 +142,15 @@ public class GoodsProcurement {
 	public java.util.Date getUpdateTime(){
 		return this.updateTime;
 	}
-			
+
+	public int getSoldNum() {
+		return soldNum;
+	}
+
+	public void setSoldNum(int soldNum) {
+		this.soldNum = soldNum;
+	}
+
 	@Override
 	public String toString() {
 		return ToStringBuilder.reflectionToString(this);

+ 11 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/SellOrder.java

@@ -179,6 +179,17 @@ public class SellOrder {
     @ApiModelProperty(value="更新时间")
     private Date updateTime;
 
+    @ApiModelProperty(value = "收货状态,NO_RECEIVE 未确认,MANUAL_RECEIVE 手动确认,AUTO_RECEIVE 自动确认",required = true)
+    private String receiveStatus;
+
+    public String getReceiveStatus() {
+        return receiveStatus;
+    }
+
+    public void setReceiveStatus(String receiveStatus) {
+        this.receiveStatus = receiveStatus;
+    }
+
     public Integer getId() {
         return id;
     }

+ 11 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/StudentPaymentOrder.java

@@ -107,6 +107,9 @@ public class StudentPaymentOrder {
 	//收款账户
 	private String merNos;
 
+	@ApiModelProperty(value = "收货状态,NO_RECEIVE 未确认,MANUAL_RECEIVE 手动确认,AUTO_RECEIVE 自动确认",required = true)
+	private String receiveStatus;
+
 	private PaymentChannelTypeEnum paymentChannelType;
 	
 	private SysUser user = new SysUser();
@@ -117,6 +120,14 @@ public class StudentPaymentOrder {
 	//课程优惠金额
 	private BigDecimal courseRemitFee;
 
+	public String getReceiveStatus() {
+		return receiveStatus;
+	}
+
+	public void setReceiveStatus(String receiveStatus) {
+		this.receiveStatus = receiveStatus;
+	}
+
 	public void setId(Long id){
 		this.id = id;
 	}

+ 1 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/enums/StockType.java

@@ -9,7 +9,7 @@ import com.ym.mec.common.enums.BaseEnum;
 public enum StockType implements BaseEnum<String, StockType> {
     INTERNAL("INTERNAL", "内部"),
     EXTERNAL("EXTERNAL", "外部"),
-    ALL("ALL", "全部"),;
+    ALL("ALL", "内部、外部");
 
     private String code;
     private String msg;

+ 0 - 10
mec-biz/src/main/java/com/ym/mec/biz/service/GoodsProcurementService.java

@@ -3,7 +3,6 @@ package com.ym.mec.biz.service;
 import com.ym.mec.biz.dal.entity.GoodsProcurement;
 import com.ym.mec.biz.dal.page.GoodsProcurementQueryInfo;
 import com.ym.mec.common.page.PageInfo;
-import com.ym.mec.common.page.QueryInfo;
 import com.ym.mec.common.service.BaseService;
 
 public interface GoodsProcurementService extends BaseService<Long, GoodsProcurement> {
@@ -17,13 +16,4 @@ public interface GoodsProcurementService extends BaseService<Long, GoodsProcurem
      */
     PageInfo<GoodsProcurement> queryGoodsProcurements(GoodsProcurementQueryInfo queryInfo);
 
-    /**
-     * @describe 修改进货清单
-     * @author Joburgess
-     * @date 2020.10.09
-     * @param goodsProcurement:
-     * @return void
-     */
-    void updateGoodsProcurements(GoodsProcurement goodsProcurement);
-
 }

+ 11 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/GoodsService.java

@@ -11,6 +11,8 @@ import java.util.List;
 
 public interface GoodsService extends BaseService<Integer, Goods> {
 
+    void addGoodsProcurement(Goods goods, Integer operatorId);
+
     /**
      * 通过科目编号查询商品(教材、辅件)列表
      *
@@ -62,4 +64,13 @@ public interface GoodsService extends BaseService<Integer, Goods> {
      * @return void
      */
     void repertoryWarn();
+
+    /**
+     * @describe 扣减商品库存
+     * @author Joburgess
+     * @date 2020.10.12
+     * @param goodsIds:
+     * @return java.lang.String
+     */
+    String subtractStock(List<Integer> goodsIds);
 }

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

@@ -19,4 +19,15 @@ public interface StudentGoodsSellService extends BaseService<Integer, StudentGoo
      * @return java.lang.Object
      */
     PageInfo<StudentGoodsSellDto> queryStudentGoodsOrders(GoodsSellQueryInfo queryInfo);
+
+    /**
+     * @describe 确认收货
+     * @apiNote 时光荏苒,认真工作的时间总是过得很快,而我、享受这一刻!
+     * @author zouxuan
+     * @date 2020/10/10
+     * @time 17:53
+     * @param orderNo:
+     * @return void
+     */
+    void affirmReceive(String orderNo);
 }

+ 0 - 14
mec-biz/src/main/java/com/ym/mec/biz/service/impl/GoodsProcurementServiceImpl.java

@@ -6,10 +6,8 @@ import com.ym.mec.biz.dal.page.GoodsProcurementQueryInfo;
 import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.page.PageInfo;
-import com.ym.mec.common.page.QueryInfo;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
 import com.ym.mec.util.collection.MapUtil;
-import org.apache.poi.ss.formula.functions.T;
 import org.springframework.beans.factory.annotation.Autowired;
 import com.ym.mec.biz.dal.entity.GoodsProcurement;
 import com.ym.mec.biz.service.GoodsProcurementService;
@@ -46,16 +44,4 @@ public class GoodsProcurementServiceImpl extends BaseServiceImpl<Long, GoodsProc
 		pageInfo.setRows(dataList);
 		return pageInfo;
 	}
-
-	@Override
-	public void updateGoodsProcurements(GoodsProcurement goodsProcurement) {
-		if(Objects.isNull(goodsProcurement.getId())){
-			throw new BizException("请指定进货清单");
-		}
-		GoodsProcurement existsGoodsProcurement = goodsProcurementDao.get(goodsProcurement.getId());
-		if(Objects.isNull(existsGoodsProcurement)){
-			throw new BizException("进货清单不存在");
-		}
-
-	}
 }

+ 51 - 5
mec-biz/src/main/java/com/ym/mec/biz/service/impl/GoodsServiceImpl.java

@@ -1,11 +1,14 @@
 package com.ym.mec.biz.service.impl;
 
+import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.ym.mec.auth.api.client.SysUserFeignService;
 import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.biz.dal.dao.GoodsDao;
 import com.ym.mec.biz.dal.dao.GoodsProcurementDao;
 import com.ym.mec.biz.dal.dao.SysConfigDao;
+import com.ym.mec.biz.dal.dao.TeacherDao;
+import com.ym.mec.biz.dal.dto.BasicUserDto;
 import com.ym.mec.biz.dal.entity.Goods;
 import com.ym.mec.biz.dal.entity.GoodsProcurement;
 import com.ym.mec.biz.dal.enums.GoodsType;
@@ -56,7 +59,7 @@ public class GoodsServiceImpl extends BaseServiceImpl<Integer, Goods>  implement
 	@Autowired
 	private SysMessageService sysMessageService;
 	@Autowired
-	private SysUserFeignService sysUserFeignService;
+	private TeacherDao teacherDao;
 
 	@Override
 	public BaseDAO<Integer, Goods> getDAO() {
@@ -64,6 +67,34 @@ public class GoodsServiceImpl extends BaseServiceImpl<Integer, Goods>  implement
 	}
 
 	@Override
+	@Transactional(rollbackFor = Exception.class)
+	public void addGoodsProcurement(Goods goods, Integer operatorId) {
+		Goods existsGood = goodsDao.findBySn(goods.getSn());
+		if(Objects.nonNull(existsGood)){
+			existsGood.setStockCount(existsGood.getStockCount()+goods.getStockCount());
+			existsGood.setTaxStockCount(existsGood.getTaxStockCount()+existsGood.getTaxStockCount());
+			goodsDao.update(existsGood);
+		}else{
+			goodsDao.insert(existsGood);
+		}
+
+		String batchNo = idGeneratorService.generatorId("payment") + "";
+
+		GoodsProcurement gp = new GoodsProcurement();
+		gp.setGoodsId(existsGood.getId());
+		gp.setGoodsCategoryId(goods.getGoodsCategoryId());
+		gp.setSupplyChannel(goods.getSupplyChannel());
+		gp.setDiscountPrice(goods.getDiscountPrice());
+		gp.setAgreeCostPrice(goods.getAgreeCostPrice());
+		gp.setTotalQuantity(goods.getStockCount());
+		gp.setTaxQuantity(goods.getTaxStockCount());
+		gp.setOperatorId(operatorId);
+		gp.setBatchNo(batchNo);
+
+		goodsProcurementDao.insert(gp);
+	}
+
+	@Override
 	public List<Goods> findGoodsBySubId(Integer subjectId,String type) {
 		return goodsDao.findGoodsBySubId(subjectId,type);
 	}
@@ -147,7 +178,7 @@ public class GoodsServiceImpl extends BaseServiceImpl<Integer, Goods>  implement
 					goods = JSONObject.parseObject(objectMap.toJSONString(),Goods.class);
 					goodsList.add(goods);
 				} catch (Exception ex) {
-					throw new BizException("导入数据出错");
+					throw new BizException("导入数据出错", ex);
 				}
 			}
 		}
@@ -207,12 +238,12 @@ public class GoodsServiceImpl extends BaseServiceImpl<Integer, Goods>  implement
 		if(StringUtils.isEmpty(repertoryWarnPhone)){
 			return;
 		}
-		SysUser sysUser = sysUserFeignService.queryUserByMobile(repertoryWarnPhone);
-		if(sysUser == null || sysUser.getId() == null){
+		BasicUserDto sysUser = teacherDao.findUserByPhone(repertoryWarnPhone);
+		if(sysUser == null || sysUser.getUserId() == null){
 			throw new BizException("库存预警手机号不存在");
 		}
 		Map<Integer, String> receivers = new HashMap<>(1);
-		receivers.put(sysUser.getId(), repertoryWarnPhone);
+		receivers.put(sysUser.getUserId(), repertoryWarnPhone);
 		//内部库存预警
 		String innerRepertoryWarnNum = sysConfigDao.findConfigValue("inner_repertory_warn_num");
 		if(StringUtils.isNotEmpty(innerRepertoryWarnNum)){
@@ -233,4 +264,19 @@ public class GoodsServiceImpl extends BaseServiceImpl<Integer, Goods>  implement
 			}
 		}
 	}
+
+	@Override
+	@Transactional(rollbackFor = Exception.class)
+	public String subtractStock(List<Integer> goodsIds) {
+		List result = new ArrayList();
+		if(CollectionUtils.isEmpty(goodsIds)){
+			return JSONObject.toJSONString(result);
+		}
+		List<Goods> tempGoods = goodsDao.getGoodies(goodsIds);
+		List<Integer> realGoodIds = new ArrayList<>();
+		for (Goods tempGood : tempGoods) {
+
+		}
+		return null;
+	}
 }

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

@@ -2,6 +2,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.entity.StudentGoodsSell;
 import com.ym.mec.biz.dal.page.GoodsSellQueryInfo;
@@ -11,8 +12,10 @@ import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.page.QueryInfo;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
 import com.ym.mec.util.collection.MapUtil;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 
 import java.util.ArrayList;
 import java.util.HashMap;
@@ -24,6 +27,8 @@ public class StudentGoodsSellServiceImpl extends BaseServiceImpl<Integer, Studen
 	
 	@Autowired
 	private StudentGoodsSellDao studentGoodsSellDao;
+	@Autowired
+	private SysConfigDao sysConfigDao;
 
 	@Override
 	public BaseDAO<Integer, StudentGoodsSell> getDAO() {
@@ -49,4 +54,18 @@ public class StudentGoodsSellServiceImpl extends BaseServiceImpl<Integer, Studen
 		pageInfo.setRows(dataList);
 		return pageInfo;
 	}
+
+	@Override
+	@Transactional(rollbackFor = Exception.class)
+	public void affirmReceive(String orderNo) {
+		//如果订单编号为空,那么自动确认
+		if(StringUtils.isEmpty(orderNo)){
+			String autoAffirmReceiveTime = sysConfigDao.findConfigValue("auto_affirm_receive_time");
+			//获取到期的订单编号
+			orderNo = studentGoodsSellDao.queryNoAffirmOrderNo(autoAffirmReceiveTime);
+		}
+		if(StringUtils.isNotEmpty(orderNo)){
+			studentGoodsSellDao.autoAffirmReceive(orderNo,"AUTO_RECEIVE");
+		}
+	}
 }

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

@@ -144,9 +144,6 @@
             <if test="taxStockCount != null">
                 tax_stock_count_ = #{taxStockCount},
             </if>
-            <if test="supplyChannel != null">
-                supply_channel_ = #{supplyChannel},
-            </if>
         </set>
         WHERE id_ = #{id}
     </update>
@@ -221,9 +218,6 @@
                 <if test="goods.taxStockCount != null">
                     tax_stock_count_ = #{goods.taxStockCount},
                 </if>
-                <if test="goods.supplyChannel != null">
-                    supply_channel_ = #{goods.supplyChannel},
-                </if>
                     update_time_ = NOW()
             </set>
             WHERE id_ = #{goods.id}
@@ -302,6 +296,10 @@
         </foreach>
     </select>
 
+    <select id="findBySn" resultMap="Goods">
+        SELECT * FROM goods WHERE sn_ = #{sn}
+    </select>
+
     <select id="findBySns" resultMap="Goods">
         SELECT * FROM goods WHERE sn_ IN
         <foreach collection="sns" item="sn" separator="," open="(" close=")">

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

@@ -94,7 +94,7 @@
 			<if test="goodsId!=null">
 				AND goods_id_ = #{goodsId}
 			</if>
-			<if test="enterStorageStartTime!=null AND enterStorageEndTime!=null">
+			<if test="enterStorageStartTime!=null and enterStorageEndTime!=null">
 				AND DATE_FORMAT(create_time_, '%Y-%m-%d') BETWEEN #{enterStorageStartTime} AND #{enterStorageEndTime}
 			</if>
 			<if test="search!=null and search!=''">

+ 7 - 1
mec-biz/src/main/resources/config/mybatis/SellOrderMapper.xml

@@ -33,6 +33,7 @@
         <result column="sell_time_" property="sellTime"/>
         <result column="create_ime_" property="createIme"/>
         <result column="update_time_" property="updateTime"/>
+        <result column="receive_status_" property="receiveStatus"/>
     </resultMap>
     <sql id="Base_Column_List">
         <!--@mbg.generated-->
@@ -162,12 +163,13 @@
 
     <!-- 分页查询 -->
     <select id="queryPage" resultMap="SellOrder" parameterType="map">
-        SELECT so.*,su.username_ user_name_,su.phone_,o.name_ organ_name_,co.name_ school_name_,t.real_name_ eduTeacher
+        SELECT so.*,su.username_ user_name_,su.phone_,o.name_ organ_name_,co.name_ school_name_,t.real_name_ eduTeacher,spo.receive_status_
         FROM sell_order so
         LEFT JOIN sys_user su ON so.user_id_ = su.id_
         LEFT JOIN organization o ON o.id_ = so.organ_id_
         LEFT JOIN cooperation_organ co ON co.id_= so.cooperation_organ_id_
         LEFT JOIN sys_user t ON t.id_ = so.edu_teacher_id_
+        LEFT JOIN student_payment_order spo ON so.order_id_ = spo.id_
         <include refid="queryPageSql"/>
         ORDER BY so.create_ime_ DESC
         <include refid="global.limit"/>
@@ -176,6 +178,7 @@
     <!-- 查询当前表的总记录数 -->
     <select id="queryCount" resultType="int">
         SELECT COUNT(*) FROM sell_order so
+        LEFT JOIN student_payment_order spo ON so.order_id_ = spo.id_
         <include refid="queryPageSql"/>
     </select>
 
@@ -199,6 +202,9 @@
             <if test="type != null">
                 AND so.type_ = #{type,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
             </if>
+            <if test="receiveStatus != null and receiveStatus != ''">
+                AND spo.receive_status_ = #{receiveStatus}
+            </if>
             <if test="startTime != null">
                 AND so.sell_time_ >= #{startTime}
             </if>

+ 12 - 1
mec-biz/src/main/resources/config/mybatis/StudentGoodsSellMapper.xml

@@ -75,7 +75,10 @@
 		update_time_ = NOW()
 		</set> WHERE id_ = #{id}
 	</update>
-	
+	<update id="autoAffirmReceive">
+		UPDATE student_payment_order SET receive_status_ = #{status},update_time_ = NOW() WHERE FIND_IN_SET(order_no_,#{orderNo})
+	</update>
+
 	<!-- 根据主键删除一条记录 -->
 	<delete id="delete" >
 		DELETE FROM student_goods_sell WHERE id_ = #{id} 
@@ -114,6 +117,9 @@
 			<if test="status != null">
 				AND spo.status_ = #{status}
 			</if>
+			<if test="receiveStatus != null and receiveStatus != ''">
+				AND spo.receive_status_ = #{receiveStatus}
+			</if>
 			<if test="search != null and search != ''">
 				AND (su.username_ LIKE CONCAT('%',#{search},'%') OR su.phone_ LIKE CONCAT('%',#{search},'%'))
 			</if>
@@ -136,4 +142,9 @@
 		LEFT JOIN student_goods_sell sgs ON spo.order_no_ = sgs.order_no_
 		WHERE spo.order_no_ = #{orderNo} LIMIT 1
 	</select>
+    <select id="queryNoAffirmOrderNo" resultType="java.lang.String">
+		SELECT GROUP_CONCAT(DISTINCT so.order_no_) FROM sell_order so
+		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>
 </mapper>

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

@@ -33,6 +33,7 @@
         <result column="class_group_id_" property="classGroupId"/>
         <result column="pay_time_" property="payTime"/>
         <result column="version_" property="version"/>
+        <result column="receive_status_" property="receiveStatus"/>
     </resultMap>
 
     <resultMap type="com.ym.mec.biz.dal.entity.StudentPaymentOrder" extends="StudentPaymentOrder"
@@ -88,7 +89,7 @@
          per_amount_,
          balance_payment_amount_, remit_fee_, course_remit_fee_, trans_no_,
          status_, memo_, create_time_, update_time_, payment_channel_, payment_business_channel_,
-         payment_account_no_, mer_nos_, order_no_, music_group_id_, class_group_id_, pay_time_)
+         payment_account_no_, mer_nos_, order_no_, music_group_id_, class_group_id_, pay_time_,receive_status_)
         VALUES (#{id}, #{groupType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
                 #{userId}, #{organId}, #{routingOrganId},
                 #{type,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
@@ -97,13 +98,16 @@
                 #{status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}, #{memo}, now(), now(),
                 #{paymentChannel}, #{paymentBusinessChannel}, #{paymentAccountNo}, #{merNos}, #{orderNo},
                 #{musicGroupId},
-                #{classGroupId}, #{payTime})
+                #{classGroupId}, #{payTime},#{receiveStatus})
     </insert>
 
     <!-- 根据主键查询一条记录 -->
     <update id="update" parameterType="com.ym.mec.biz.dal.entity.StudentPaymentOrder">
         UPDATE student_payment_order
         <set>
+            <if test="receiveStatus != null and receiveStatus != ''">
+                receive_status_ = #{receiveStatus},
+            </if>
             <if test="status != null">
                 status_ = #{status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
             </if>

+ 5 - 0
mec-biz/src/main/resources/config/mybatis/TeacherMapper.xml

@@ -1188,4 +1188,9 @@
 		</where>
 		GROUP BY t.`id_` 
     </select>
+    <select id="findUserByPhone" resultMap="com.ym.mec.biz.dal.dao.MusicGroupDao.BasicUserDto">
+        SELECT username_,id_ user_id_,avatar_ head_url_,
+        gender_,user_type_
+        FROM sys_user WHERE phone_ = #{phone}
+    </select>
 </mapper>

+ 4 - 0
mec-client-api/src/main/java/com/ym/mec/task/TaskRemoteService.java

@@ -140,4 +140,8 @@ public interface TaskRemoteService {
 	//商品库存预警
 	@GetMapping("task/repertoryWarn")
     void goodsRepertoryFBIWarnTask();
+
+	//自动确认收货
+	@GetMapping("task/autoAffirmReceiveTask")
+    void autoAffirmReceiveTask();
 }

+ 5 - 0
mec-client-api/src/main/java/com/ym/mec/task/fallback/TaskRemoteServiceFallback.java

@@ -175,4 +175,9 @@ public class TaskRemoteServiceFallback implements TaskRemoteService {
 	public void goodsRepertoryFBIWarnTask() {
 		logger.info("商品库存预警推送失败");
 	}
+
+	@Override
+	public void autoAffirmReceiveTask() {
+		logger.info("确认收货执行失败");
+	}
 }

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

@@ -158,4 +158,11 @@ public class RepairController extends BaseController {
     public Object getStudentGoodsOrder(Integer goodsSellId) {
         return succeed(studentGoodsSellService.get(goodsSellId));
     }
+
+    @ApiOperation(value = "确认收货")
+    @PostMapping("/affirmReceive")
+    public Object affirmReceive(String orderNo) {
+        studentGoodsSellService.affirmReceive(orderNo);
+        return succeed();
+    }
 }

+ 19 - 0
mec-task/src/main/java/com/ym/mec/task/jobs/AutoAffirmReceiveTask.java

@@ -0,0 +1,19 @@
+package com.ym.mec.task.jobs;
+
+import com.ym.mec.task.TaskRemoteService;
+import com.ym.mec.task.core.BaseTask;
+import com.ym.mec.task.core.TaskException;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+@Service
+public class AutoAffirmReceiveTask extends BaseTask {
+
+	@Autowired
+	private TaskRemoteService taskRemoteService;
+
+	@Override
+	public void execute() throws TaskException {
+		taskRemoteService.autoAffirmReceiveTask();
+	}
+}

+ 10 - 1
mec-web/src/main/java/com/ym/mec/web/controller/GoodsController.java

@@ -1,5 +1,7 @@
 package com.ym.mec.web.controller;
 
+import com.ym.mec.auth.api.client.SysUserFeignService;
+import com.ym.mec.auth.api.entity.SysUser;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
@@ -25,12 +27,19 @@ public class GoodsController extends BaseController {
 
     @Autowired
     private GoodsService goodsService;
+    @Autowired
+    private SysUserFeignService sysUserFeignService;
 
     @ApiOperation(value = "新增商品(教材、辅件)")
     @PostMapping("/add")
     @PreAuthorize("@pcs.hasPermissions('goods/add')")
     public Object add(Goods goods){
-        return succeed(goodsService.insert(goods));
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        if (sysUser == null) {
+            return failed("用户信息获取失败");
+        }
+        goodsService.addGoodsProcurement(goods,sysUser.getId());
+        return succeed();
     }
 
     @ApiOperation(value = "删除商品(教材、辅件)")

+ 9 - 3
mec-web/src/main/java/com/ym/mec/web/controller/GoodsProcurementContrller.java

@@ -1,18 +1,25 @@
 package com.ym.mec.web.controller;
 
+import com.ym.mec.biz.dal.entity.GoodsProcurement;
 import com.ym.mec.biz.dal.page.GoodsProcurementQueryInfo;
 import com.ym.mec.biz.service.GoodsProcurementService;
 import com.ym.mec.common.controller.BaseController;
 import com.ym.mec.common.entity.HttpResponseResult;
+import com.ym.mec.common.page.PageInfo;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.util.List;
+
 /**
  * @Author Joburgess
  * @Date 2020.10.09
  */
+@Api(tags = "进货清单")
 @RestController
 @RequestMapping("goodsProcurement")
 public class GoodsProcurementContrller extends BaseController {
@@ -20,11 +27,10 @@ public class GoodsProcurementContrller extends BaseController {
     @Autowired
     private GoodsProcurementService goodsProcurementService;
 
+    @ApiOperation(value = "分页查询进货清单")
     @GetMapping("queryGoodsProcurements")
-    public HttpResponseResult queryGoodsProcurements(GoodsProcurementQueryInfo queryInfo){
+    public HttpResponseResult<PageInfo<GoodsProcurement>> queryGoodsProcurements(GoodsProcurementQueryInfo queryInfo){
         return succeed(goodsProcurementService.queryGoodsProcurements(queryInfo));
     }
 
-
-
 }

+ 8 - 0
mec-web/src/main/java/com/ym/mec/web/controller/TaskController.java

@@ -75,6 +75,14 @@ public class TaskController extends BaseController {
 
 	@Autowired
 	private GoodsService goodsService;
+	@Autowired
+	private StudentGoodsSellService studentGoodsSellService;
+
+	@GetMapping(value = "/autoAffirmReceiveTask")
+	// 自动确认收货
+	public void affirmReceive(){
+		studentGoodsSellService.affirmReceive(null);
+	}
 
 	@GetMapping(value = "/repertoryWarn")
 	// 商品库存预警

+ 6 - 2
mec-web/src/main/resources/columnMapper.ini

@@ -11,9 +11,13 @@
 商品图片(插入一张图片) = image
 商品明细 = desc
 商品采购价2(元) = agreeCostPrice
-商品数量 = stockCount
-税务数量 = taxStockCount
+内部库存 = stockCount
+税务库存 = taxStockCount
 备查货号 = supplyChannel
+是否App展示 = clientShow
+库存类型 = stockType
+商品详情 = desc
+库存预警 = stockWarning
 
 [财务支出导入模板]
 财务流程编号 = financialProcessNo

BIN
mec-web/src/main/resources/excelTemplate/商品导入模板.xls