瀏覽代碼

Merge branch 'master' of http://git.dayaedu.com/yonge/mec

yonge 5 年之前
父節點
當前提交
675d9f0df0
共有 20 個文件被更改,包括 992 次插入161 次删除
  1. 8 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/GoodsDao.java
  2. 1 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentPaymentOrderDao.java
  3. 12 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentPaymentRouteOrderDao.java
  4. 206 2
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/StudentPaymentRouteOrder.java
  5. 1 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/enums/TemplateTypeEnum.java
  6. 10 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/page/SellOrderQueryInfo.java
  7. 47 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/page/StudentPaymentRouteOrderQueryInfo.java
  8. 40 4
      mec-biz/src/main/java/com/ym/mec/biz/service/StudentPaymentRouteOrderService.java
  9. 1 1
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/ClassGroupServiceImpl.java
  10. 318 107
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentPaymentRouteOrderServiceImpl.java
  11. 1 1
      mec-biz/src/main/resources/config/mybatis/CourseScheduleMapper.xml
  12. 3 0
      mec-biz/src/main/resources/config/mybatis/GoodsMapper.xml
  13. 4 0
      mec-biz/src/main/resources/config/mybatis/SellOrderMapper.xml
  14. 1 0
      mec-biz/src/main/resources/config/mybatis/StudentPaymentOrderMapper.xml
  15. 155 14
      mec-biz/src/main/resources/config/mybatis/StudentPaymentRouteOrderMapper.xml
  16. 57 0
      mec-web/src/main/java/com/ym/mec/web/controller/ExportController.java
  17. 12 1
      mec-web/src/main/java/com/ym/mec/web/controller/ImportController.java
  18. 102 31
      mec-web/src/main/java/com/ym/mec/web/controller/StudentPaymentRouteOrderController.java
  19. 13 0
      mec-web/src/main/resources/columnMapper.ini
  20. 二進制
      mec-web/src/main/resources/excelTemplate/财务管理导入模板.xlsx

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

@@ -135,4 +135,12 @@ public interface GoodsDao extends BaseDAO<Integer, Goods> {
     List<MusicGroupGoodsAndDiscountDto> getMusicGroupGoodsAndDiscount(@Param("subjectId") Integer subjectId, @Param("type") String type);
 
     List<MusicGroupGoodsAndDiscountDto> getMusicGroupGoodsAndDiscountWithSubjects(@Param("subjectIds") String subjectIds, @Param("type") String type);
+
+    /**
+     * 是否存在已上架的商品编号
+     * @param goodsId
+     * @param status
+     * @return
+     */
+    Boolean findByIdAndStatus(@Param("goodsId") String goodsId, @Param("status") int status);
 }

+ 1 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentPaymentOrderDao.java

@@ -4,6 +4,7 @@ import com.ym.mec.biz.dal.dto.*;
 import com.ym.mec.biz.dal.entity.Goods;
 import com.ym.mec.biz.dal.entity.Organization;
 import com.ym.mec.biz.dal.entity.StudentPaymentOrder;
+import com.ym.mec.biz.dal.entity.StudentPaymentRouteOrder;
 import com.ym.mec.biz.dal.enums.DealStatusEnum;
 import com.ym.mec.biz.dal.enums.GroupType;
 import com.ym.mec.biz.dal.enums.OrderDetailTypeEnum;

+ 12 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentPaymentRouteOrderDao.java

@@ -7,6 +7,7 @@ import com.ym.mec.biz.dal.entity.StudentPaymentOrder;
 import com.ym.mec.biz.dal.entity.StudentPaymentRouteOrder;
 import com.ym.mec.biz.dal.enums.PaymentChannelEnum;
 import com.ym.mec.common.dal.BaseDAO;
+
 import org.apache.ibatis.annotations.Param;
 
 import java.math.BigDecimal;
@@ -59,4 +60,15 @@ public interface StudentPaymentRouteOrderDao extends BaseDAO<Long, StudentPaymen
      * @return
      */
     int insertOrder(StudentPaymentOrder order);
+    
+    int queryAuditCount(Map<String, Object> params);
+    
+    List<StudentPaymentRouteOrder> queryAuditPage(Map<String, Object> params);
+
+    /**
+     * 是否有重复到订单号
+     * @param transNos
+     * @return
+     */
+    List<String> countByTransNo(@Param("transNos") List<Object> transNos);
 }

+ 206 - 2
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/StudentPaymentRouteOrder.java

@@ -3,6 +3,10 @@ package com.ym.mec.biz.dal.entity;
 import java.math.BigDecimal;
 import java.util.Date;
 
+import com.alibaba.fastjson.JSONObject;
+import com.ym.mec.auth.api.entity.SysUser;
+import com.ym.mec.biz.dal.enums.AuditStatusEnum;
+
 public class StudentPaymentRouteOrder {
     private Long id;
 
@@ -35,8 +39,64 @@ public class StudentPaymentRouteOrder {
     * 是否承担手续费Y-是 N-否
     */
     private String feeFlag;
+    
+    private Integer userId;
+    
+    private Integer schoolId;
+    
+    private String transNo;
+    
+    private Date payTime;
+    
+    private BigDecimal saleAmount;
+    
+    private BigDecimal serviceAmount;
+    
+    private String memo;
+    
+    private String goodsIds;
+
+    private String goodsNums;
+
+    private String goodsJson;
+    
+    private AuditStatusEnum auditStatus;
+    
+    private String auditComment;
+    
+    private Date createTime;
+    
+    private Date updateTime;
+    
+    private Integer createBy;
+    
+    private Integer updateBy;
+    
+    private CooperationOrgan cooperationOrgan = new CooperationOrgan();
+    
+    private SysUser student = new SysUser();
+    
+    private SysUser operator = new SysUser();
+    
+    private Organization organ = new Organization();
+
+	public String getGoodsIds() {
+		return goodsIds;
+	}
+
+	public void setGoodsIds(String goodsIds) {
+		this.goodsIds = goodsIds;
+	}
+
+	public String getGoodsNums() {
+		return goodsNums;
+	}
 
-    public Long getId() {
+	public void setGoodsNums(String goodsNums) {
+		this.goodsNums = goodsNums;
+	}
+
+	public Long getId() {
         return id;
     }
 
@@ -76,7 +136,71 @@ public class StudentPaymentRouteOrder {
         this.feeFlag = feeFlag;
     }
 
-    public String getOrderNo() {
+    public Integer getUserId() {
+		return userId;
+	}
+
+	public void setUserId(Integer userId) {
+		this.userId = userId;
+	}
+
+	public Integer getSchoolId() {
+		return schoolId;
+	}
+
+	public void setSchoolId(Integer schoolId) {
+		this.schoolId = schoolId;
+	}
+
+	public String getTransNo() {
+		return transNo;
+	}
+
+	public void setTransNo(String transNo) {
+		this.transNo = transNo;
+	}
+
+	public Date getPayTime() {
+		return payTime;
+	}
+
+	public void setPayTime(Date payTime) {
+		this.payTime = payTime;
+	}
+
+	public BigDecimal getSaleAmount() {
+		return saleAmount;
+	}
+
+	public void setSaleAmount(BigDecimal saleAmount) {
+		this.saleAmount = saleAmount;
+	}
+
+	public BigDecimal getServiceAmount() {
+		return serviceAmount;
+	}
+
+	public void setServiceAmount(BigDecimal serviceAmount) {
+		this.serviceAmount = serviceAmount;
+	}
+
+	public String getMemo() {
+		return memo;
+	}
+
+	public void setMemo(String memo) {
+		this.memo = memo;
+	}
+
+	public String getGoodsJson() {
+		return goodsJson;
+	}
+
+	public void setGoodsJson(String goodsJson) {
+		this.goodsJson = goodsJson;
+	}
+
+	public String getOrderNo() {
         return orderNo;
     }
 
@@ -91,4 +215,84 @@ public class StudentPaymentRouteOrder {
     public void setRouteBalanceAmount(BigDecimal routeBalanceAmount) {
         this.routeBalanceAmount = routeBalanceAmount;
     }
+
+	public AuditStatusEnum getAuditStatus() {
+		return auditStatus;
+	}
+
+	public void setAuditStatus(AuditStatusEnum auditStatus) {
+		this.auditStatus = auditStatus;
+	}
+
+	public String getAuditComment() {
+		return auditComment;
+	}
+
+	public void setAuditComment(String auditComment) {
+		this.auditComment = auditComment;
+	}
+
+	public Date getCreateTime() {
+		return createTime;
+	}
+
+	public void setCreateTime(Date createTime) {
+		this.createTime = createTime;
+	}
+
+	public Date getUpdateTime() {
+		return updateTime;
+	}
+
+	public void setUpdateTime(Date updateTime) {
+		this.updateTime = updateTime;
+	}
+
+	public Integer getCreateBy() {
+		return createBy;
+	}
+
+	public void setCreateBy(Integer createBy) {
+		this.createBy = createBy;
+	}
+
+	public Integer getUpdateBy() {
+		return updateBy;
+	}
+
+	public void setUpdateBy(Integer updateBy) {
+		this.updateBy = updateBy;
+	}
+
+	public CooperationOrgan getCooperationOrgan() {
+		return cooperationOrgan;
+	}
+
+	public void setCooperationOrgan(CooperationOrgan cooperationOrgan) {
+		this.cooperationOrgan = cooperationOrgan;
+	}
+
+	public SysUser getStudent() {
+		return student;
+	}
+
+	public void setStudent(SysUser student) {
+		this.student = student;
+	}
+
+	public SysUser getOperator() {
+		return operator;
+	}
+
+	public void setOperator(SysUser operator) {
+		this.operator = operator;
+	}
+
+	public Organization getOrgan() {
+		return organ;
+	}
+
+	public void setOrgan(Organization organ) {
+		this.organ = organ;
+	}
 }

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

@@ -4,6 +4,7 @@ import com.ym.mec.common.enums.BaseEnum;
 
 public enum TemplateTypeEnum implements BaseEnum<String, TemplateTypeEnum> {
     GOODS("GOODS","商品导入模板"),
+    ROUTE_ORDER("ROUTE_ORDER","财务管理导入模板"),
     FINANCIAL_EXPENDITURE("FINANCIAL_EXPENDITURE","财务支出导入模板");
 
     private String code;

+ 10 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/page/SellOrderQueryInfo.java

@@ -25,6 +25,8 @@ public class SellOrderQueryInfo extends QueryInfo {
     @ApiModelProperty(value = "结束时间",required = false)
     private Date endTime;
 
+    @ApiModelProperty(value = "用户名称或编号",required = false)
+    private String userName;
 
     public String getOrganIdList() {
         return organIdList;
@@ -73,4 +75,12 @@ public class SellOrderQueryInfo extends QueryInfo {
     public void setCooperationOrganId(Integer cooperationOrganId) {
         this.cooperationOrganId = cooperationOrganId;
     }
+
+	public String getUserName() {
+		return userName;
+	}
+
+	public void setUserName(String userName) {
+		this.userName = userName;
+	}
 }

+ 47 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/page/StudentPaymentRouteOrderQueryInfo.java

@@ -0,0 +1,47 @@
+package com.ym.mec.biz.dal.page;
+
+import com.ym.mec.biz.dal.enums.AuditStatusEnum;
+import com.ym.mec.common.page.QueryInfo;
+
+public class StudentPaymentRouteOrderQueryInfo extends QueryInfo {
+
+	private String transNo;
+	
+	private String organId;
+	
+	private AuditStatusEnum auditStatus;
+	
+	private String type;//SERVICE、SELL
+
+	public String getTransNo() {
+		return transNo;
+	}
+
+	public void setTransNo(String transNo) {
+		this.transNo = transNo;
+	}
+
+	public String getOrganId() {
+		return organId;
+	}
+
+	public void setOrganId(String organId) {
+		this.organId = organId;
+	}
+
+	public AuditStatusEnum getAuditStatus() {
+		return auditStatus;
+	}
+
+	public void setAuditStatus(AuditStatusEnum auditStatus) {
+		this.auditStatus = auditStatus;
+	}
+
+	public String getType() {
+		return type;
+	}
+
+	public void setType(String type) {
+		this.type = type;
+	}
+}

+ 40 - 4
mec-biz/src/main/java/com/ym/mec/biz/service/StudentPaymentRouteOrderService.java

@@ -1,25 +1,54 @@
 package com.ym.mec.biz.service;
 
 
+import java.math.BigDecimal;
+import java.util.List;
+
 import com.ym.mec.biz.dal.dto.PageInfoOrder;
 import com.ym.mec.biz.dal.dto.StudentPaymentRouteOrderDto;
 import com.ym.mec.biz.dal.entity.StudentPaymentRouteOrder;
+import com.ym.mec.biz.dal.enums.AuditStatusEnum;
 import com.ym.mec.biz.dal.page.StudentPaymentOrderQueryInfo;
+import com.ym.mec.common.page.PageInfo;
+import com.ym.mec.common.page.QueryInfo;
 import com.ym.mec.common.service.BaseService;
-
-import java.math.BigDecimal;
+import org.springframework.web.multipart.MultipartFile;
 
 
 public interface StudentPaymentRouteOrderService extends BaseService<Long, StudentPaymentRouteOrder> {
+	
+	/**
+	 * 查询审核列表
+	 * @param queryInfo
+	 * @return
+	 */
+	PageInfo<StudentPaymentRouteOrder> queryAuditList(QueryInfo queryInfo);
 
 	PageInfoOrder<StudentPaymentRouteOrderDto> OrderQueryPage(StudentPaymentOrderQueryInfo queryInfo);
 
 	/**
 	 * 添加外部订单
-	 * @param studentPaymentRouteOrderDto
+	 * @param studentPaymentRouteOrder
+	 * @return
+	 */
+	StudentPaymentRouteOrder addOutOrder(StudentPaymentRouteOrder studentPaymentRouteOrder);
+	
+	/**
+	 * 更新外部订单
+	 * @param studentPaymentRouteOrder
+	 * @return
+	 */
+	StudentPaymentRouteOrder updateOutOrder(StudentPaymentRouteOrder studentPaymentRouteOrder);
+	
+	/**
+	 * 审核外部订单
+	 * @param studentPaymentRouteOrderId
+	 * @param auditStatus
+	 * @param memo
+	 * @param operatorId
 	 * @return
 	 */
-	StudentPaymentRouteOrderDto addOutOrder(StudentPaymentRouteOrderDto studentPaymentRouteOrderDto);
+	boolean auditOutOrder(Long studentPaymentRouteOrderId,AuditStatusEnum auditStatus,String memo,Integer operatorId);
 
 	/**
 	 * 添加分润订单
@@ -37,4 +66,11 @@ public interface StudentPaymentRouteOrderService extends BaseService<Long, Stude
 	 */
 	Boolean deleteRouteOrder(Long orderId);
 
+	/**
+	 * 财务管理订单导入
+	 * @author zouxuan
+	 * @param file
+	 * @return
+	 */
+    List<StudentPaymentRouteOrder> importRouteOrder(MultipartFile file) throws Exception;
 }

+ 1 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ClassGroupServiceImpl.java

@@ -1100,7 +1100,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
 			unitPriceMap.put(
 					musicGroupPaymentCalenderCourseSettings.getCourseType(),
 					musicGroupPaymentCalenderCourseSettings.getCourseCurrentPrice().divide(
-							new BigDecimal(musicGroupPaymentCalenderCourseSettings.getCourseTotalMinuties())));
+							new BigDecimal(musicGroupPaymentCalenderCourseSettings.getCourseTotalMinuties()),CommonConstants.DECIMAL_FINAL_PLACE,BigDecimal.ROUND_DOWN));
 			
 			OriginTotalPriceMap.put(musicGroupPaymentCalenderCourseSettings.getCourseType(), musicGroupPaymentCalenderCourseSettings.getCourseCurrentPrice());
 		}

+ 318 - 107
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentPaymentRouteOrderServiceImpl.java

@@ -1,32 +1,46 @@
 package com.ym.mec.biz.service.impl;
 
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+import java.math.BigDecimal;
+import java.util.*;
+import java.util.Map.Entry;
+import java.util.stream.Collectors;
+
+import com.alibaba.fastjson.JSONArray;
+import com.ym.mec.biz.dal.entity.*;
+import com.ym.mec.biz.dal.enums.*;
+import com.ym.mec.util.date.DateUtil;
+import com.ym.mec.util.excel.IniFileUtil;
+import com.ym.mec.util.excel.POIUtil;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.io.ClassPathResource;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Isolation;
+import org.springframework.transaction.annotation.Transactional;
+
 import com.alibaba.fastjson.JSON;
-import com.ym.mec.biz.dal.dao.*;
+import com.alibaba.fastjson.JSONObject;
+import com.ym.mec.biz.dal.dao.GoodsDao;
+import com.ym.mec.biz.dal.dao.SellOrderDao;
+import com.ym.mec.biz.dal.dao.StudentPaymentOrderDao;
+import com.ym.mec.biz.dal.dao.StudentPaymentRouteOrderDao;
+import com.ym.mec.biz.dal.dao.SysUserCashAccountDao;
 import com.ym.mec.biz.dal.dto.PageInfoOrder;
 import com.ym.mec.biz.dal.dto.StudentPaymentRouteOrderDto;
-import com.ym.mec.biz.dal.entity.Goods;
-import com.ym.mec.biz.dal.entity.SellOrder;
-import com.ym.mec.biz.dal.entity.StudentPaymentOrder;
-import com.ym.mec.biz.dal.entity.StudentPaymentRouteOrder;
-import com.ym.mec.biz.dal.enums.*;
 import com.ym.mec.biz.dal.page.StudentPaymentOrderQueryInfo;
 import com.ym.mec.biz.service.GoodsService;
 import com.ym.mec.biz.service.SellOrderService;
 import com.ym.mec.biz.service.StudentPaymentRouteOrderService;
 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.IdGeneratorService;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
 import com.ym.mec.util.collection.MapUtil;
-import org.apache.ibatis.javassist.expr.NewArray;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Isolation;
-import org.springframework.transaction.annotation.Transactional;
-
-import java.math.BigDecimal;
-import java.util.*;
-import java.util.stream.Collectors;
+import org.springframework.web.multipart.MultipartFile;
 
 @Service
 public class StudentPaymentRouteOrderServiceImpl extends BaseServiceImpl<Long, StudentPaymentRouteOrder> implements StudentPaymentRouteOrderService {
@@ -54,6 +68,26 @@ public class StudentPaymentRouteOrderServiceImpl extends BaseServiceImpl<Long, S
     }
 
     @Override
+	public PageInfo<StudentPaymentRouteOrder> queryAuditList(QueryInfo queryInfo) {
+    	PageInfo<StudentPaymentRouteOrder> pageInfo = new PageInfo<StudentPaymentRouteOrder>(queryInfo.getPage(), queryInfo.getRows());
+		Map<String, Object> params = new HashMap<String, Object>();
+		MapUtil.populateMap(params, queryInfo);
+		
+		List<StudentPaymentRouteOrder> dataList = null;
+		int count = studentPaymentRouteOrderDao.queryAuditCount(params);
+		if (count > 0) {
+			pageInfo.setTotal(count);
+			params.put("offset", pageInfo.getOffset());
+			dataList = studentPaymentRouteOrderDao.queryAuditPage(params);
+		}
+		if (count == 0) {
+			dataList = new ArrayList<StudentPaymentRouteOrder>();
+		}
+		pageInfo.setRows(dataList);
+		return pageInfo;
+	}
+
+	@Override
     public PageInfoOrder<StudentPaymentRouteOrderDto> OrderQueryPage(StudentPaymentOrderQueryInfo queryInfo) {
         PageInfoOrder<StudentPaymentRouteOrderDto> pageInfo = new PageInfoOrder<>(queryInfo.getPage(), queryInfo.getRows());
         Map<String, Object> params = new HashMap<String, Object>();
@@ -88,107 +122,163 @@ public class StudentPaymentRouteOrderServiceImpl extends BaseServiceImpl<Long, S
 
     @Override
     @Transactional(rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED)
-    public StudentPaymentRouteOrderDto addOutOrder(StudentPaymentRouteOrderDto studentPaymentRouteOrderDto) {
+    public StudentPaymentRouteOrder addOutOrder(StudentPaymentRouteOrder studentPaymentRouteOrder) {
         Date nowDate = new Date();
         String orderNo = idGeneratorService.generatorId("payment") + "";
-        studentPaymentRouteOrderDto.setType(OrderTypeEnum.OUTORDER);
-        studentPaymentRouteOrderDto.setMerNos(studentPaymentRouteOrderDto.getMerNo());
-        studentPaymentRouteOrderDto.setOrderNo(orderNo);
-        studentPaymentRouteOrderDto.setGroupType(GroupType.OUTORDER);
-        studentPaymentRouteOrderDto.setRouteOrganId(studentPaymentRouteOrderDto.getOrganId());
-        studentPaymentRouteOrderDto.setExpectAmount(studentPaymentRouteOrderDto.getActualAmount());
-        studentPaymentRouteOrderDto.setStatus(DealStatusEnum.SUCCESS);
-        studentPaymentRouteOrderDto.setCreateTime(studentPaymentRouteOrderDto.getPayTime());
-        studentPaymentRouteOrderDto.setUpdateTime(nowDate);
-
-        studentPaymentRouteOrderDao.insertOrder(studentPaymentRouteOrderDto);
-        StudentPaymentRouteOrder studentPaymentRouteOrder = new StudentPaymentRouteOrder();
         studentPaymentRouteOrder.setOrderNo(orderNo);
-        studentPaymentRouteOrder.setMerNo(studentPaymentRouteOrderDto.getMerNo());
-        studentPaymentRouteOrder.setRouteOrganId(studentPaymentRouteOrderDto.getOrganId());
-        studentPaymentRouteOrder.setRouteAmount(studentPaymentRouteOrderDto.getActualAmount());
+        studentPaymentRouteOrder.setAuditStatus(AuditStatusEnum.ING);
+        studentPaymentRouteOrder.setCreateTime(nowDate);
+        studentPaymentRouteOrder.setUpdateTime(nowDate);
+        studentPaymentRouteOrder.setRouteAmount(studentPaymentRouteOrder.getSaleAmount().add(studentPaymentRouteOrder.getServiceAmount()));
         studentPaymentRouteOrder.setRouteBalanceAmount(BigDecimal.ZERO);
         studentPaymentRouteOrder.setFeeFlag("N");
+        
         studentPaymentRouteOrderDao.insert(studentPaymentRouteOrder);
-
-        if (studentPaymentRouteOrderDto.getGoodies() != null && studentPaymentRouteOrderDto.getGoodies().size() > 0) {
-            BigDecimal hasRouteAmount = BigDecimal.ZERO;
-            BigDecimal goodsTotalPrice = BigDecimal.ZERO;
-
-            List<Integer> goodsIdList = new ArrayList<>();
-            for (Map.Entry<Integer, Integer> goodsMap : studentPaymentRouteOrderDto.getGoodies().entrySet()) {
-                Goods goods = goodsDao.get(goodsMap.getKey());
-                goodsTotalPrice = goodsTotalPrice.add(goods.getGroupPurchasePrice().multiply(new BigDecimal(goodsMap.getValue())));
-                for (int i = 0; i < goodsMap.getValue(); i++) {
-                    goodsIdList.add(goodsMap.getKey());
-                }
-            }
-            List<SellOrder> sellOrderList = goodsService.subtractStock(goodsIdList, AccountType.INTERNAL);
-
-            int i = 1;
-            for (Map.Entry<Integer, Integer> goodsMap : studentPaymentRouteOrderDto.getGoodies().entrySet()) {
-                Goods goods = goodsDao.get(goodsMap.getKey());
-
-                BigDecimal actualAmount = BigDecimal.ZERO;
-                if (goodsTotalPrice.compareTo(BigDecimal.ZERO) != 0) {
-                    actualAmount = studentPaymentRouteOrderDto.getGoodsAmount().multiply(goods.getGroupPurchasePrice().multiply(new BigDecimal(goodsMap.getValue()))).divide(goodsTotalPrice, 2, BigDecimal.ROUND_HALF_UP);
-                }
-                if (i == studentPaymentRouteOrderDto.getGoodies().size()) {
-                    actualAmount = studentPaymentRouteOrderDto.getGoodsAmount().subtract(hasRouteAmount);
-                }
-                hasRouteAmount = hasRouteAmount.add(actualAmount);
-                i++;
-
-                int complementNum = goods.getComplementGoodsIdList() == null ? 1 : goods.getComplementGoodsIdList().split(",").length;
-                int goodsNum = goodsMap.getValue() * complementNum;
-                BigDecimal complementPrice = goods.getGroupPurchasePrice().multiply(new BigDecimal(goodsMap.getValue()));
-                Map<Integer, BigDecimal> complementGoodsPrice = new HashMap<>();
-                complementGoodsPrice.put(goods.getId(), goods.getGroupPurchasePrice());
-                if (goods.getComplementGoodsIdList() != null) {
-                    List<Goods> complementGoodies = goodsDao.findGoodsByIds(goods.getComplementGoodsIdList());
-                    complementGoodsPrice = complementGoodies.stream().collect(Collectors.toMap(Goods::getId, Goods::getGroupPurchasePrice));
-                    complementPrice = complementGoodies.stream().map(Goods::getGroupPurchasePrice).reduce(BigDecimal.ZERO, BigDecimal::add).multiply(new BigDecimal(goodsMap.getValue()));
-                }
-
-                BigDecimal hasRouteSellOrderActualAmount = BigDecimal.ZERO;
-                for (SellOrder sellOrder : sellOrderList) {
-                    if (!goodsMap.getKey().equals(sellOrder.getParentGoodsId()) && !goodsMap.getKey().equals(sellOrder.getGoodsId())) {
-                        continue;
-                    }
-                    BigDecimal sellOrderActualAmount = BigDecimal.ZERO;
-                    if (complementPrice.compareTo(BigDecimal.ZERO) > 0) {
-                        sellOrderActualAmount = complementGoodsPrice.get(sellOrder.getGoodsId()).multiply(new BigDecimal(sellOrder.getNum())).multiply(actualAmount).divide(complementPrice, 2, BigDecimal.ROUND_HALF_UP);
-                    }
-                    goodsNum = goodsNum - sellOrder.getNum();
-                    if (goodsNum <= 0) {
-                        sellOrderActualAmount = actualAmount.subtract(hasRouteSellOrderActualAmount);
-                    }
-                    hasRouteSellOrderActualAmount = hasRouteSellOrderActualAmount.add(sellOrderActualAmount);
-
-                    sellOrder.setSellTime(studentPaymentRouteOrderDto.getPayTime());
-                    sellOrder.setOrganId(studentPaymentRouteOrderDto.getOrganId());
-                    sellOrder.setCooperationOrganId(studentPaymentRouteOrderDto.getSchoolId());
-                    sellOrder.setTransNo(studentPaymentRouteOrderDto.getTransNo());
-                    sellOrder.setOrderId(studentPaymentRouteOrderDto.getId());
-                    sellOrder.setOrderNo(orderNo);
-                    sellOrder.setActualAmount(sellOrderActualAmount);
-                    sellOrder.setBalanceAmount(BigDecimal.ZERO);
-                    sellOrder.setExpectAmount(sellOrderActualAmount);
-                    sellOrder.setUserId(studentPaymentRouteOrderDto.getUserId());
-                    sellOrder.setPaymentChannel(studentPaymentRouteOrderDto.getPaymentChannel());
-                    sellOrder.setMerNo(studentPaymentRouteOrderDto.getMerNos());
-                    sellOrder.setSellTime(studentPaymentRouteOrderDto.getCreateTime());
-                    sellOrder.setCreateIme(nowDate);
-                    sellOrder.setUpdateTime(nowDate);
-                    sellOrder.setType(SellTypeEnum.SCHOOL_BUY);
-                }
-            }
-            sellOrderDao.batchInsert(sellOrderList);
-        }
-        return studentPaymentRouteOrderDto;
+        
+        return studentPaymentRouteOrder;
     }
 
     @Override
+	public StudentPaymentRouteOrder updateOutOrder(StudentPaymentRouteOrder studentPaymentRouteOrder) {
+    	Date nowDate = new Date();
+    	studentPaymentRouteOrder.setAuditStatus(AuditStatusEnum.ING);
+        studentPaymentRouteOrder.setUpdateTime(nowDate);
+        studentPaymentRouteOrder.setRouteAmount(studentPaymentRouteOrder.getSaleAmount().add(studentPaymentRouteOrder.getServiceAmount()));
+        studentPaymentRouteOrder.setRouteBalanceAmount(BigDecimal.ZERO);
+        studentPaymentRouteOrder.setFeeFlag("N");
+        
+        studentPaymentRouteOrderDao.update(studentPaymentRouteOrder);
+        
+		return studentPaymentRouteOrder;
+	}
+
+	@Override
+    @Transactional(rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED)
+	public boolean auditOutOrder(Long studentPaymentRouteOrderId, AuditStatusEnum auditStatus, String memo, Integer operatorId) {
+		StudentPaymentRouteOrder studentPaymentRouteOrder = studentPaymentRouteOrderDao.get(studentPaymentRouteOrderId);
+		if(studentPaymentRouteOrder == null){
+			throw new BizException("查询订单信息失败");
+		}
+		
+		if(studentPaymentRouteOrder.getAuditStatus() != AuditStatusEnum.ING){
+			throw new BizException("只有“审核中”的订单才能审核");
+		}
+		
+		Date nowDate = new Date();
+		
+		studentPaymentRouteOrder.setUpdateBy(operatorId);
+		studentPaymentRouteOrder.setUpdateTime(nowDate);
+		studentPaymentRouteOrder.setMemo(memo);
+		studentPaymentRouteOrder.setAuditStatus(auditStatus);
+		
+		studentPaymentRouteOrderDao.update(studentPaymentRouteOrder);
+		
+		if(auditStatus == AuditStatusEnum.PASS){
+			StudentPaymentOrder studentPaymentOrder = new StudentPaymentOrder();
+			studentPaymentOrder.setActualAmount(studentPaymentRouteOrder.getRouteAmount());
+			studentPaymentOrder.setMusicGroupId(studentPaymentRouteOrder.getSchoolId()+ "");
+			studentPaymentOrder.setType(OrderTypeEnum.OUTORDER);
+			studentPaymentOrder.setMerNos(studentPaymentRouteOrder.getMerNo());
+			studentPaymentOrder.setOrderNo(studentPaymentRouteOrder.getOrderNo());
+			studentPaymentOrder.setGroupType(GroupType.OUTORDER);
+			studentPaymentOrder.setOrganId(studentPaymentRouteOrder.getRouteOrganId());
+			studentPaymentOrder.setExpectAmount(studentPaymentRouteOrder.getRouteAmount());
+			studentPaymentOrder.setStatus(DealStatusEnum.SUCCESS);
+			studentPaymentOrder.setCreateTime(studentPaymentRouteOrder.getPayTime());
+			studentPaymentOrder.setUpdateTime(nowDate);
+			studentPaymentOrder.setMemo(studentPaymentRouteOrder.getMemo());
+			studentPaymentOrder.setUserId(studentPaymentRouteOrder.getUserId());
+			studentPaymentOrder.setPayTime(studentPaymentRouteOrder.getPayTime());
+			
+	        studentPaymentRouteOrderDao.insertOrder(studentPaymentOrder);
+	        
+	        if (StringUtils.isNoneBlank(studentPaymentRouteOrder.getGoodsJson())) {
+	            BigDecimal hasRouteAmount = BigDecimal.ZERO;
+	            BigDecimal goodsTotalPrice = BigDecimal.ZERO;
+
+	            List<Integer> goodsIdList = new ArrayList<>();
+	            JSONObject jsonObj = JSON.parseObject(studentPaymentRouteOrder.getGoodsJson());
+	            for (Entry<String, Object> goodsMap : jsonObj.entrySet()) {
+	            	Integer goodsId = Integer.parseInt(goodsMap.getKey());
+	            	Integer nums = Integer.parseInt(goodsMap.getValue().toString());
+	                Goods goods = goodsDao.get(goodsId);
+	                goodsTotalPrice = goodsTotalPrice.add(goods.getGroupPurchasePrice().multiply(new BigDecimal(nums)));
+	                for (int i = 0; i < nums; i++) {
+	                    goodsIdList.add(goodsId);
+	                }
+	            }
+	            List<SellOrder> sellOrderList = goodsService.subtractStock(goodsIdList, AccountType.INTERNAL);
+
+	            int i = 1;
+	            for (Entry<String, Object> goodsMap : jsonObj.entrySet()) {
+	            	Integer goodsId = Integer.parseInt(goodsMap.getKey());
+	            	Integer nums = Integer.parseInt(goodsMap.getValue().toString());
+	                Goods goods = goodsDao.get(goodsId);
+
+	                BigDecimal actualAmount = BigDecimal.ZERO;
+	                if (goodsTotalPrice.compareTo(BigDecimal.ZERO) != 0) {
+	                    actualAmount = studentPaymentRouteOrder.getSaleAmount().multiply(goods.getGroupPurchasePrice().multiply(new BigDecimal(nums))).divide(goodsTotalPrice, 2, BigDecimal.ROUND_HALF_UP);
+	                }
+	                if (i == jsonObj.entrySet().size()) {
+	                    actualAmount = studentPaymentRouteOrder.getSaleAmount().subtract(hasRouteAmount);
+	                }
+	                hasRouteAmount = hasRouteAmount.add(actualAmount);
+	                i++;
+
+	                int complementNum = goods.getComplementGoodsIdList() == null ? 1 : goods.getComplementGoodsIdList().split(",").length;
+	                int goodsNum = nums * complementNum;
+	                BigDecimal complementPrice = goods.getGroupPurchasePrice().multiply(new BigDecimal(nums));
+	                Map<Integer, BigDecimal> complementGoodsPrice = new HashMap<>();
+	                complementGoodsPrice.put(goods.getId(), goods.getGroupPurchasePrice());
+	                if (goods.getComplementGoodsIdList() != null) {
+	                    List<Goods> complementGoodies = goodsDao.findGoodsByIds(goods.getComplementGoodsIdList());
+	                    complementGoodsPrice = complementGoodies.stream().collect(Collectors.toMap(Goods::getId, Goods::getGroupPurchasePrice));
+	                    complementPrice = complementGoodies.stream().map(Goods::getGroupPurchasePrice).reduce(BigDecimal.ZERO, BigDecimal::add).multiply(new BigDecimal(nums));
+	                }
+
+	                BigDecimal hasRouteSellOrderActualAmount = BigDecimal.ZERO;
+	                for (SellOrder sellOrder : sellOrderList) {
+	                    if (!goodsMap.getKey().equals(sellOrder.getParentGoodsId()) && !goodsMap.getKey().equals(sellOrder.getGoodsId())) {
+	                        continue;
+	                    }
+	                    BigDecimal sellOrderActualAmount = BigDecimal.ZERO;
+	                    if (complementPrice.compareTo(BigDecimal.ZERO) > 0) {
+	                        sellOrderActualAmount = complementGoodsPrice.get(sellOrder.getGoodsId()).multiply(new BigDecimal(sellOrder.getNum())).multiply(actualAmount).divide(complementPrice, 2, BigDecimal.ROUND_HALF_UP);
+	                    }
+	                    goodsNum = goodsNum - sellOrder.getNum();
+	                    if (goodsNum <= 0) {
+	                        sellOrderActualAmount = actualAmount.subtract(hasRouteSellOrderActualAmount);
+	                    }
+	                    hasRouteSellOrderActualAmount = hasRouteSellOrderActualAmount.add(sellOrderActualAmount);
+
+	                    sellOrder.setSellTime(studentPaymentRouteOrder.getPayTime());
+	                    sellOrder.setOrganId(studentPaymentRouteOrder.getRouteOrganId());
+	                    sellOrder.setCooperationOrganId(studentPaymentRouteOrder.getSchoolId());
+	                    sellOrder.setTransNo(studentPaymentRouteOrder.getTransNo());
+	                    sellOrder.setOrderId(studentPaymentOrder.getId());
+	                    sellOrder.setOrderNo(studentPaymentRouteOrder.getOrderNo());
+	                    sellOrder.setActualAmount(sellOrderActualAmount);
+	                    sellOrder.setBalanceAmount(BigDecimal.ZERO);
+	                    sellOrder.setExpectAmount(sellOrderActualAmount);
+	                    sellOrder.setUserId(studentPaymentRouteOrder.getUserId());
+	                    sellOrder.setPaymentChannel(studentPaymentOrder.getPaymentChannel());
+	                    sellOrder.setMerNo(studentPaymentRouteOrder.getMerNo());
+	                    sellOrder.setSellTime(studentPaymentRouteOrder.getCreateTime());
+	                    sellOrder.setCreateIme(nowDate);
+	                    sellOrder.setUpdateTime(nowDate);
+	                    sellOrder.setType(SellTypeEnum.SCHOOL_BUY);
+	                }
+	            }
+	            sellOrderDao.batchInsert(sellOrderList);
+	        }
+		}
+		
+		
+		
+		return true;
+	}
+
+	@Override
     public StudentPaymentRouteOrder addRouteOrder(String orderNo, Integer routeOrganId, BigDecimal routeBalanceAmount) {
         StudentPaymentRouteOrder studentPaymentRouteOrder = new StudentPaymentRouteOrder();
         studentPaymentRouteOrder.setOrderNo(orderNo);
@@ -219,4 +309,125 @@ public class StudentPaymentRouteOrderServiceImpl extends BaseServiceImpl<Long, S
         return true;
     }
 
+
+	@Override
+	@Transactional(rollbackFor = Exception.class)
+	public List<StudentPaymentRouteOrder> importRouteOrder(MultipartFile file) throws Exception{
+		Map<String, List<Map<String, Object>>> sheetsListMap = POIUtil.importExcel(new ByteArrayInputStream(file.getBytes()), 2, file.getOriginalFilename());
+		InputStream inputStream = new ClassPathResource("columnMapper.ini").getInputStream();
+		Map<String,String> columns = IniFileUtil.readIniFile(inputStream, TemplateTypeEnum.ROUTE_ORDER.getMsg());
+		List<StudentPaymentRouteOrder> studentPaymentRouteOrders = new ArrayList<>();
+		Map<String, Integer> organMap = getMap("organization", "name_", "id_", true, String.class, Integer.class);
+		Map<String, Integer> cooperationOrganMap = getMap("cooperation_organ", "name_", "id_", true, String.class, Integer.class);
+		for (String e : sheetsListMap.keySet()) {
+			List<Map<String, Object>> sheet = sheetsListMap.get(e);
+			List<Object> collect = sheet.stream().map(m -> m.get("交易流水号")).collect(Collectors.toList());
+			if(collect == null || collect.size() == 0){
+				continue;
+			}
+			List<String> list = studentPaymentRouteOrderDao.countByTransNo(collect);
+			if(list != null && list.size() > 0){
+				throw new BizException("导入数据错误  重复的交易流水号:{}",list.get(0));
+			}
+
+			valueIsNull: for (Map<String, Object> row : sheet) {
+
+				if (row.size() == 0){
+					continue;
+				}
+				JSONObject objectMap = new JSONObject();
+				for (String s : row.keySet()) {
+					if(!columns.containsKey(s)){
+						continue;
+					}
+					String columnValue = columns.get(s);
+					if (columnValue.equals("transNo")) {
+						if(StringUtils.isEmpty(row.get(s).toString())){
+							continue valueIsNull;
+						}
+					}
+					if (columnValue.equals("merNo")) {
+						if(StringUtils.isEmpty(row.get(s).toString())){
+							continue valueIsNull;
+						}else {
+							objectMap.put("merNo", row.get(s));
+						}
+						continue;
+					}
+					if (columnValue.equals("organName") && StringUtils.isNotEmpty(row.get(s).toString())) {
+						Integer integer = organMap.get(row.get(s));
+						if(integer == null){
+							continue valueIsNull;
+						}else {
+							objectMap.put("routeOrganId", integer);
+						}
+						continue;
+					}
+					if (columnValue.equals("cooperationOrganName") && StringUtils.isNotEmpty(row.get(s).toString())) {
+						Integer integer = cooperationOrganMap.get(row.get(s));
+						if(integer != null){
+							objectMap.put("schoolId", integer);
+						}
+						continue;
+					}
+					if (columnValue.equals("payTime") && StringUtils.isNotEmpty(row.get(s).toString())) {
+						String toString = row.get(s).toString();
+						if(StringUtils.isNotEmpty(toString)){
+							Date date = DateUtil.stringToDate(toString, DateUtil.DEFAULT_PATTERN);
+							if(date == null){
+								throw new BizException("导入数据错误  交易日期格式错误");
+							}else {
+								objectMap.put(columnValue, DateUtil.format(date,DateUtil.DEFAULT_PATTERN));
+							}
+						}
+						continue;
+					}
+					objectMap.put(columnValue, row.get(s));
+				}
+				StudentPaymentRouteOrder studentPaymentRouteOrder = JSONObject.parseObject(objectMap.toJSONString(),StudentPaymentRouteOrder.class);
+				//是否有销售金额
+				if(studentPaymentRouteOrder.getSaleAmount() != null && studentPaymentRouteOrder.getSaleAmount().longValue() != 0l){
+					String goodsIds = studentPaymentRouteOrder.getGoodsIds();
+					String goodsNums = studentPaymentRouteOrder.getGoodsNums();
+
+					if(StringUtils.isEmpty(goodsNums)){
+						throw new BizException("导入失败:有销售金额时商品数量必填");
+					}
+					if(StringUtils.isEmpty(goodsIds)){
+						throw new BizException("导入失败:有销售金额时商品编号必填");
+					}
+					List<String> goodsIdList = new ArrayList(Arrays.asList(goodsIds.split(",")));
+					List<String> goodsNumList = new ArrayList(Arrays.asList(goodsNums.split(",")));
+					if(goodsIdList.size() != goodsNumList.size()){
+						throw new BizException("导入失败:商品编号和商品数量不一致");
+					}
+					JSONArray goodsJSON = new JSONArray();
+					for (int i = 0; i < goodsIdList.size(); i++) {
+						if(!goodsDao.findByIdAndStatus(goodsIdList.get(i), 1)){
+							throw new BizException("导入失败:商品编号{}不存在",goodsIdList.get(i));
+						}
+						try {
+							int goodsNum = Integer.parseInt(goodsNumList.get(i));
+							JSONObject jsonObject = new JSONObject();
+							jsonObject.put(goodsIdList.get(i),goodsNum);
+							goodsJSON.add(jsonObject);
+						}catch (Exception e1){
+							throw new BizException("导入失败:商品数量{}填写错误",goodsNumList.get(i));
+						}
+					}
+					studentPaymentRouteOrder.setGoodsJson(goodsJSON.toJSONString());
+				}
+				studentPaymentRouteOrders.add(studentPaymentRouteOrder);
+			}
+		}
+		if(studentPaymentRouteOrders.size() > 0){
+			Map<String, List<StudentPaymentRouteOrder>> stringListMap = studentPaymentRouteOrders.stream().collect(Collectors.groupingBy(StudentPaymentRouteOrder::getTransNo));
+			if(stringListMap.size() != studentPaymentRouteOrders.size()){
+				throw new BizException("导入失败:请勿录入重复的交易流水号");
+			}
+			studentPaymentRouteOrderDao.batchAdd(studentPaymentRouteOrders);
+		}
+		return studentPaymentRouteOrders;
+	}
+
 }

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

@@ -3343,7 +3343,7 @@
     <select id="queryRemainCourseTypeDuration" resultMap="RemainCourseTypeDurationDto">
         SELECT cs.type_ course_type_,SUM(TIMESTAMPDIFF(MINUTE,STR_TO_DATE(concat(cs.class_date_,' ',cs.start_class_time_),'%Y-%m-%d %H:%i:%s'), 
         STR_TO_DATE(concat(cs.class_date_,' ',cs.end_class_time_),'%Y-%m-%d %H:%i:%s'))) remain_minutes_ 
-		from course_schedule cs where cs.class_group_id_ in (#{classgroupId}) and cs.status_ = 'NOT_START' group by cs.type_
+		from course_schedule cs where FIND_IN_SET(cs.class_group_id_,#{classgroupId}) and cs.status_ = 'NOT_START' group by cs.type_
     </select>
 
 </mapper>

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

@@ -387,4 +387,7 @@
             AND g.type_ = #{type}
         </if>
     </select>
+    <select id="findByIdAndStatus" resultType="java.lang.Boolean">
+        SELECT COUNT(0) FROM goods WHERE status_ = #{status} AND id_ = #{goodsId}
+    </select>
 </mapper>

+ 4 - 0
mec-biz/src/main/resources/config/mybatis/SellOrderMapper.xml

@@ -287,6 +287,7 @@
     <!-- 查询当前表的总记录数 -->
     <select id="queryCount" resultType="int">
         SELECT COUNT(*) FROM sell_order so
+        LEFT JOIN sys_user su ON so.user_id_ = su.id_
         LEFT JOIN student_payment_order spo ON so.order_id_ = spo.id_
         <include refid="queryPageSql"/>
     </select>
@@ -296,6 +297,9 @@
             <if test="search != null and search != ''">
                 AND (so.order_no_ = #{search} OR so.trans_no_ = #{search})
             </if>
+            <if test="userName != null and userName != ''">
+                AND (so.user_id_ like concat('%',#{userName},'%') OR su.username_ like concat('%',#{userName},'%'))
+            </if>
             <if test="organIdList != null and organIdList != ''">
                 AND FIND_IN_SET(so.organ_id_,#{organIdList})
             </if>

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

@@ -101,6 +101,7 @@
                 #{classGroupId}, #{payTime})
     </insert>
 
+
     <!-- 根据主键查询一条记录 -->
     <update id="update" parameterType="com.ym.mec.biz.dal.entity.StudentPaymentOrder">
         UPDATE student_payment_order

+ 155 - 14
mec-biz/src/main/resources/config/mybatis/StudentPaymentRouteOrderMapper.xml

@@ -11,6 +11,20 @@
         <result column="mer_no_" property="merNo"/>
         <result column="order_no_" property="orderNo"/>
         <result column="fee_flag_" property="feeFlag"/>
+        <result column="user_id_" property="userId"/>
+        <result column="school_id_" property="schoolId"/>
+        <result column="trans_no_" property="transNo"/>
+        <result column="pay_time_" property="payTime"/>
+        <result column="sale_amount_" property="saleAmount"/>
+        <result column="service_amount_" property="serviceAmount"/>
+        <result column="memo_" property="memo"/>
+        <result column="goods_json_" property="goodsJson"/>
+        <result column="audit_status_" property="auditStatus" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler" />
+        <result column="audit_comment_" property="auditComment"/>
+        <result column="create_time_" property="createTime"/>
+        <result column="create_by_" property="createBy"/>
+        <result column="update_time_" property="updateTime"/>
+        <result column="update_by_" property="updateBy"/>
     </resultMap>
 
     <resultMap id="StudentPaymentRouteOrderDto" type="com.ym.mec.biz.dal.dto.StudentPaymentRouteOrderDto"
@@ -25,16 +39,26 @@
         <result column="fee_flag_" property="feeFlag"/>
     </resultMap>
 
+    <resultMap id="StudentPaymentRouteOrderMap" type="com.ym.mec.biz.dal.entity.StudentPaymentRouteOrder" extends="StudentPaymentRouteOrder">
+        <result column="username_" property="student.username"/>
+        <result column="phone_" property="student.phone"/>
+        <result column="school_name_" property="cooperationOrgan.name"/>
+        <result column="organ_name_" property="organ.name"/>
+        <result column="operator_name_" property="operator.username"/>
+    </resultMap>
+
     <sql id="Base_Column_List">
         <!--@mbg.generated-->
-        id_, route_organ_id_, route_amount_,route_balance_amount_, mer_no_, order_no_, fee_flag_
+        id_, route_organ_id_, route_amount_,route_balance_amount_, mer_no_, order_no_, fee_flag_,user_id_,school_id_,trans_no_,pay_time_,sale_amount_,service_amount_,memo_,goods_json_,audit_status_,audit_comment_,create_time_,create_by_,update_time_,update_by_
     </sql>
-    <select id="get" parameterType="java.lang.Long" resultMap="StudentPaymentRouteOrder">
+    <select id="get" parameterType="java.lang.Long" resultMap="StudentPaymentRouteOrderMap">
         <!--@mbg.generated-->
-        select
-        <include refid="Base_Column_List"/>
-        from student_payment_route_order
-        where id_ = #{id}
+       SELECT spro.*,u.username_,u.phone_,s.name_ school_name_,o.name_ organ_name_,ou.username_ operator_name_ FROM student_payment_route_order spro
+        left join sys_user u on spro.user_id_ = u.id_
+        left join sys_user ou on ou.id_ = spro.create_by_
+        left join school s on s.id_ = spro.school_id_
+        left join organization o on o.id_ = spro.route_organ_id_
+        where spro.id_ = #{id}
     </select>
     <delete id="delete" parameterType="java.lang.Long">
         <!--@mbg.generated-->
@@ -45,8 +69,8 @@
             parameterType="com.ym.mec.biz.dal.entity.StudentPaymentRouteOrder" useGeneratedKeys="true">
         <!--@mbg.generated-->
         insert into student_payment_route_order (route_organ_id_, route_amount_,route_balance_amount_, mer_no_,
-        order_no_, fee_flag_)
-        values (#{routeOrganId}, #{routeAmount},#{routeBalanceAmount}, #{merNo}, #{orderNo}, #{feeFlag})
+        order_no_, fee_flag_,user_id_,school_id_,trans_no_,pay_time_,sale_amount_,service_amount_,memo_,goods_json_,audit_status_,audit_comment_,create_time_,update_time_,create_by_,update_by_)
+        values (#{routeOrganId}, #{routeAmount},#{routeBalanceAmount}, #{merNo}, #{orderNo}, #{feeFlag},#{userId},#{schoolId},#{transNo},#{payTime},#{saleAmount},#{serviceAmount},#{memo},#{goodsJson},#{auditStatus,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{auditComment},#{createTime},#{updateTime},#{createBy},#{updateBy})
     </insert>
     <update id="update" parameterType="com.ym.mec.biz.dal.entity.StudentPaymentRouteOrder">
         <!--@mbg.generated-->
@@ -58,12 +82,60 @@
             <if test="routeAmount != null">
                 route_amount_ = #{routeAmount},
             </if>
+            <if test="routeBalanceAmount != null">
+                route_balance_amount_ = #{routeBalanceAmount},
+            </if>
             <if test="merNo != null">
                 mer_no_ = #{merNo},
             </if>
             <if test="orderNo != null">
                 order_no_ = #{orderNo},
             </if>
+            <if test="feeFlag != null">
+                fee_flag_ = #{feeFlag},
+            </if>
+            <if test="userId != null">
+                user_id_ = #{userId},
+            </if>
+            <if test="schoolId != null">
+                school_id_ = #{schoolId},
+            </if>
+            <if test="transNo != null">
+                trans_no_ = #{transNo},
+            </if>
+            <if test="payTime != null">
+                pay_time_ = #{payTime},
+            </if>
+            <if test="saleAmount != null">
+                sale_amount_ = #{saleAmount},
+            </if>
+            <if test="serviceAmount != null">
+                service_amount_ = #{serviceAmount},
+            </if>
+            <if test="memo != null">
+                memo_ = #{memo},
+            </if>
+            <if test="goodsJson != null">
+                goods_json_ = #{goodsJson},
+            </if>
+            <if test="auditStatus != null">
+                audit_status_ = #{auditStatus,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
+            </if>
+            <if test="auditComment != null">
+                audit_comment_ = #{auditComment},
+            </if>
+            <if test="createTime != null">
+                create_time_ = #{createTime},
+            </if>
+            <if test="updateTime != null">
+                update_time_ = #{updateTime},
+            </if>
+            <if test="createBy != null">
+                create_by_ = #{createBy},
+            </if>
+            <if test="updateBy != null">
+                update_by_ = #{updateBy},
+            </if>
         </set>
         where id_ = #{id}
     </update>
@@ -71,16 +143,23 @@
     <insert id="batchAdd" parameterType="java.util.List" useGeneratedKeys="true" keyColumn="id"
             keyProperty="id">
         INSERT INTO student_payment_route_order
-        (order_no_,route_organ_id_, route_amount_,route_balance_amount_, mer_no_,fee_flag_)
+        (order_no_,route_organ_id_, route_amount_,route_balance_amount_, mer_no_,fee_flag_,user_id_,
+        school_id_,trans_no_,pay_time_,sale_amount_,service_amount_,memo_,goods_json_,audit_status_,
+        audit_comment_,create_time_,update_time_,create_by_,update_by_)
         VALUE
         <foreach collection="routeOrders" item="routeOrder" separator=",">
-            (#{routeOrder.orderNo},#{routeOrder.routeOrganId},#{routeOrder.routeAmount},#{routeOrder.routeBalanceAmount},#{routeOrder.merNo},#{routeOrder.feeFlag})
+            (#{routeOrder.orderNo},#{routeOrder.routeOrganId},#{routeOrder.routeAmount},
+            #{routeOrder.routeBalanceAmount},#{routeOrder.merNo},#{routeOrder.feeFlag},
+            #{routeOrder.userId},#{routeOrder.schoolId},#{routeOrder.transNo},#{routeOrder.payTime},
+            #{routeOrder.saleAmount},#{routeOrder.serviceAmount},#{routeOrder.memo},#{routeOrder.goodsJson},
+            #{routeOrder.auditStatus,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{routeOrder.auditComment},
+            #{routeOrder.createTime},#{routeOrder.updateTime},NOW(),NOW())
         </foreach>
     </insert>
 
     <select id="queryPageOrder" parameterType="map" resultMap="StudentPaymentRouteOrderDto">
-        SELECT spo.*,spro.*,u.username_,u.phone_ FROM student_payment_order spo
-        LEFT JOIN student_payment_route_order spro ON spo.order_no_ = spro.order_no_
+        SELECT spo.*,spro.*,u.username_,u.phone_ FROM student_payment_route_order spro
+        LEFT JOIN student_payment_order spo ON spo.order_no_ = spro.order_no_
         left join sys_user u on spo.user_id_ = u.id_
         <include refid="queryPaymentOrder"/>
         ORDER BY spo.id_ DESC
@@ -102,8 +181,8 @@
 
     <!-- 查询当前表的总记录数 -->
     <select id="queryCount" resultType="int" parameterType="map">
-        SELECT COUNT(spo.id_) FROM student_payment_order spo
-        LEFT JOIN student_payment_route_order spro ON spo.order_no_ = spro.order_no_
+        SELECT COUNT(spo.id_) FROM student_payment_route_order spro
+        LEFT JOIN student_payment_order spo ON spo.order_no_ = spro.order_no_
         LEFT JOIN sys_user u on spo.user_id_ = u.id_
         <include refid="queryPaymentOrder"/>
     </select>
@@ -214,6 +293,12 @@
         <include refid="queryPaymentOrder"/>
         ORDER BY spo.id_ ASC
     </select>
+    <select id="countByTransNo" resultType="java.lang.String">
+        SELECT order_no_ FROM student_payment_route_order WHERE trans_no_ IN
+        <foreach collection="transNos" open="(" close=")" item="item" separator=",">
+            #{item}
+        </foreach>
+    </select>
 
     <delete id="deleteByOrderNo">
         DELETE
@@ -241,4 +326,60 @@
         #{classGroupId}, #{payTime})
     </insert>
 
+    <select id="queryAuditCount" parameterType="map" resultType="int">
+		SELECT count(spro.id_) FROM student_payment_route_order spro
+        left join sys_user u on spro.user_id_ = u.id_
+        <where>
+        	<if test="transNo != null and transNo != ''">
+        		and spro.trans_no_ = #{transNo}
+        	</if>
+        	<if test="organId != null and organId != ''">
+        		and spro.route_organ_id_ = #{organId}
+        	</if>
+        	<if test="auditStatus != null">
+        		and spro.audit_status_ = #{auditStatus,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
+        	</if>
+        	<if test="type != null and type != ''">
+        		and
+        		<if test="type == 'SERVICE'">
+        			spro.service_amount_ is not null
+        		</if>
+        		<if test="type == 'SELL'">
+        			spro.sale_amount_ is not null
+        		</if>
+        	</if>
+        </where>
+		order by spro.id_ desc
+	</select>
+
+	<select id="queryAuditPage" parameterType="map" resultMap="StudentPaymentRouteOrderMap">
+		SELECT spro.*,u.username_,u.phone_,s.name_ school_name_,o.name_ organ_name_,ou.username_ operator_name_ FROM student_payment_route_order spro
+        left join sys_user u on spro.user_id_ = u.id_
+        left join sys_user ou on ou.id_ = spro.create_by_
+        left join cooperation_organ s on s.id_ = spro.school_id_
+        left join organization o on o.id_ = spro.route_organ_id_
+        <where>
+        	<if test="transNo != null and transNo != ''">
+        		and spro.trans_no_ = #{transNo}
+        	</if>
+        	<if test="organId != null and organId != ''">
+        		and spro.route_organ_id_ = #{organId}
+        	</if>
+        	<if test="auditStatus != null">
+        		and spro.audit_status_ = #{auditStatus,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
+        	</if>
+        	<if test="type != null and type != ''">
+        		and
+        		<if test="type == 'SERVICE'">
+        			(spro.service_amount_ is not null or spro.service_amount_ = 0) 
+        		</if>
+        		<if test="type == 'SELL'">
+        			(spro.sale_amount_ is not null or spro.sale_amount_ = 0)
+        		</if>
+        	</if>
+        </where>
+		order by spro.id_ desc
+		<include refid="global.limit" />
+	</select>
+
 </mapper>

+ 57 - 0
mec-web/src/main/java/com/ym/mec/web/controller/ExportController.java

@@ -104,6 +104,8 @@ public class ExportController extends BaseController {
     private MusicGroupBuildLogDao musicGroupBuildLogDao;
     @Autowired
     private MusicGroupPaymentCalenderService musicGroupPaymentCalenderService;
+    @Autowired
+    private SellOrderService sellOrderService;
 
     @ApiOperation(value = "乐团管理--修改--缴费设置--缴费记录导出")
     @PostMapping("export/musicGroupPaymentCalenderDetail")
@@ -2326,4 +2328,59 @@ public class ExportController extends BaseController {
             }
         }
     }
+
+    @ApiOperation(value = "销售列表导出")
+    @RequestMapping("export/exportSellOrders")
+    @PreAuthorize("@pcs.hasPermissions('export/exportSellOrders')")
+    public void exportSellOrders(HttpServletResponse response, SellOrderQueryInfo queryInfo) throws IOException {
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        if (sysUser == null) {
+            throw new BizException("用户信息获取失败");
+        }
+        if (!sysUser.getIsSuperAdmin()) {
+            Employee employee = employeeDao.get(sysUser.getId());
+            if (StringUtils.isEmpty(queryInfo.getOrganIdList())) {
+                queryInfo.setOrganIdList(employee.getOrganIdList());
+            } else if (StringUtils.isEmpty(employee.getOrganIdList())) {
+                throw new BizException("用户所在分部异常");
+            } else {
+                List<String> list = Arrays.asList(employee.getOrganIdList().split(","));
+                if (!list.containsAll(Arrays.asList(queryInfo.getOrganIdList().split(",")))) {
+                    throw new BizException("非法请求");
+                }
+            }
+        }
+        if (queryInfo.getEndTime() != null) {
+            queryInfo.setEndTime(DateUtil.getLastTimeWithDay(queryInfo.getEndTime()));
+        }
+        queryInfo.setPage(1);
+        queryInfo.setRows(49999);
+        List<SellOrder> rows = sellOrderService.queryPage(queryInfo).getRows();
+        OutputStream outputStream = response.getOutputStream();
+        try {
+            HSSFWorkbook workbook = POIUtil.exportExcel(new String[]{
+                    "交易流水号", "订单号", "销售日期", "销售类型", "商品名称", "数量","应付金额(元)", "余额支付(元)",
+                    "现金支付(元)", "销售成本(元)", "学员姓名","交易方式", "收款账户", "账户类型", "扣减库存", "所属分部",
+                    "所属学校", "教务老师", "确认收货", "状态"}, new String[]{
+                    "transNo", "orderId", "sellTime", "type.desc", "goodsName", "num", "expectAmount", "balanceAmount",
+                    "actualAmount", "sellCost", "userName", "paymentChannel", "merNo", "accountType.msg", "stockType.msg", "organName",
+                    "schoolName", "eduTeacher", "receiveStatus", "status.msg"}, rows);
+            response.setContentType("application/octet-stream");
+            response.setHeader("Content-Disposition", "attachment;filename=lender-" + DateUtil.getDate(new Date()) + ".xls");
+            response.flushBuffer();
+            outputStream = response.getOutputStream();
+            workbook.write(outputStream);
+            outputStream.flush();
+        } catch (Exception e) {
+            e.printStackTrace();
+        } finally {
+            if (outputStream != null) {
+                try {
+                    outputStream.close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+        }
+    }
 }

+ 12 - 1
mec-web/src/main/java/com/ym/mec/web/controller/ImportController.java

@@ -4,9 +4,11 @@ import com.ym.mec.auth.api.client.SysUserFeignService;
 import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.biz.dal.entity.FinancialExpenditure;
 import com.ym.mec.biz.dal.entity.Goods;
+import com.ym.mec.biz.dal.entity.StudentPaymentRouteOrder;
 import com.ym.mec.biz.dal.enums.TemplateTypeEnum;
 import com.ym.mec.biz.service.FinancialExpenditureService;
 import com.ym.mec.biz.service.GoodsService;
+import com.ym.mec.biz.service.StudentPaymentRouteOrderService;
 import com.ym.mec.common.controller.BaseController;
 import com.ym.mec.common.entity.HttpResponseResult;
 import com.ym.mec.util.date.DateUtil;
@@ -37,6 +39,8 @@ public class ImportController extends BaseController {
     private FinancialExpenditureService financialExpenditureService;
     @Autowired
     private SysUserFeignService sysUserFeignService;
+    @Autowired
+    private StudentPaymentRouteOrderService studentPaymentRouteOrderService;
 
     @ApiOperation(value = "导入商品")
     @PostMapping(value = "goods")
@@ -56,11 +60,18 @@ public class ImportController extends BaseController {
         return succeed(financialExpenditureService.importFinancialExpenditure(file));
     }
 
+    @ApiOperation(value = "导入财务管理订单")
+    @PostMapping(value = "routeOrder")
+    @PreAuthorize("@pcs.hasPermissions('import/routeOrder')")
+    public HttpResponseResult<List<StudentPaymentRouteOrder>> importRouteOrder(@RequestParam("file") MultipartFile file) throws Exception {
+        return succeed(studentPaymentRouteOrderService.importRouteOrder(file));
+    }
+
     @ApiOperation(value = "下载导入模板")
     @GetMapping(value = "downloadTemplate")
     @PreAuthorize("@pcs.hasPermissions('import/downloadTemplate')")
     public void getGoodsTemplate(HttpServletResponse response, TemplateTypeEnum templateType) throws IOException {
-        InputStream inputStream = new ClassPathResource("excelTemplate/" + templateType.getMsg() + ".xls").getInputStream();
+        InputStream inputStream = new ClassPathResource("excelTemplate/" + templateType.getMsg() + ".xlsx").getInputStream();
         OutputStream outputStream = response.getOutputStream();
         try {
             response.setContentType("application/octet-stream");

+ 102 - 31
mec-web/src/main/java/com/ym/mec/web/controller/StudentPaymentRouteOrderController.java

@@ -1,39 +1,40 @@
 package com.ym.mec.web.controller;
 
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+
+import java.math.BigDecimal;
+import java.util.Arrays;
+import java.util.List;
+import java.util.stream.Collectors;
+
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
 import com.ym.mec.auth.api.client.SysUserFeignService;
 import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.biz.dal.dao.EmployeeDao;
 import com.ym.mec.biz.dal.dao.SellOrderDao;
 import com.ym.mec.biz.dal.dao.StudentPaymentOrderDao;
-import com.ym.mec.biz.dal.dao.SysConfigDao;
 import com.ym.mec.biz.dal.dto.BasicUserDto;
 import com.ym.mec.biz.dal.dto.OutOrderInfoDto;
 import com.ym.mec.biz.dal.dto.StudentPaymentRouteOrderDto;
 import com.ym.mec.biz.dal.entity.Employee;
 import com.ym.mec.biz.dal.entity.SellOrder;
-import com.ym.mec.biz.dal.entity.StudentPaymentOrder;
-import com.ym.mec.biz.dal.page.SporadicOrderQueryInfo;
+import com.ym.mec.biz.dal.entity.StudentPaymentRouteOrder;
+import com.ym.mec.biz.dal.enums.AuditStatusEnum;
 import com.ym.mec.biz.dal.page.StudentPaymentOrderQueryInfo;
-import com.ym.mec.biz.service.SellOrderService;
-import com.ym.mec.biz.service.StudentPaymentOrderDetailService;
-import com.ym.mec.biz.service.StudentPaymentOrderService;
+import com.ym.mec.biz.dal.page.StudentPaymentRouteOrderQueryInfo;
 import com.ym.mec.biz.service.StudentPaymentRouteOrderService;
 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.ApiImplicitParam;
-import io.swagger.annotations.ApiImplicitParams;
-import io.swagger.annotations.ApiOperation;
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.web.bind.annotation.*;
-
-import java.math.BigDecimal;
-import java.util.Arrays;
-import java.util.List;
-import java.util.stream.Collectors;
 
 @RequestMapping("routeOrder")
 @Api(tags = "分润订单服务")
@@ -85,26 +86,96 @@ public class StudentPaymentRouteOrderController extends BaseController {
         return succeed(studentPaymentRouteOrderPageInfo);
     }
 
+    @ApiOperation(value = "财务订单列表")
+    @GetMapping("/queryPage")
+    @PreAuthorize("@pcs.hasPermissions('routeOrder/queryPage')")
+    public HttpResponseResult<PageInfo<StudentPaymentRouteOrder>> queryPage(StudentPaymentRouteOrderQueryInfo queryInfo) {
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        if (sysUser == null) {
+            return failed("用户信息获取失败");
+        }
+        if (!sysUser.getIsSuperAdmin()) {
+            Employee employee = employeeDao.get(sysUser.getId());
+            if (StringUtils.isEmpty(queryInfo.getOrganId())) {
+                queryInfo.setOrganId(employee.getOrganIdList());
+            } else if (StringUtils.isEmpty(employee.getOrganIdList())) {
+                return failed("用户所在分部异常");
+            } else {
+                List<String> list = Arrays.asList(employee.getOrganIdList().split(","));
+                if (!list.containsAll(Arrays.asList(queryInfo.getOrganId().split(",")))) {
+                    return failed("非法请求");
+                }
+            }
+        }
+
+        return succeed(studentPaymentRouteOrderService.queryAuditList(queryInfo));
+    }
+
+    @ApiOperation(value = "财务订单列表")
+    @GetMapping("/query")
+    @PreAuthorize("@pcs.hasPermissions('routeOrder/query')")
+    public HttpResponseResult<StudentPaymentRouteOrder> query(Long id) {
+    	StudentPaymentRouteOrder studentPaymentRouteOrder = studentPaymentRouteOrderService.get(id);
+    	
+        return succeed(studentPaymentRouteOrder);
+    }
+
 
     @ApiOperation(value = "添加订单")
     @PostMapping("/add")
     @PreAuthorize("@pcs.hasPermissions('routeOrder/add')")
-    public HttpResponseResult<StudentPaymentRouteOrderDto> add(@RequestBody StudentPaymentRouteOrderDto studentPaymentRouteOrderDto) {
-        if (studentPaymentRouteOrderDto.getUserId() == null) {
-            SysUser sysUser = sysUserFeignService.queryUserInfo();
-            studentPaymentRouteOrderDto.setUserId(sysUser.getId());
+    public HttpResponseResult<StudentPaymentRouteOrder> add(@RequestBody StudentPaymentRouteOrder studentPaymentRouteOrder) {
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        if (studentPaymentRouteOrder.getUserId() == null) {
+            studentPaymentRouteOrder.setUserId(sysUser.getId());
         }
-        if (studentPaymentRouteOrderDto.getSchoolId() != null) {
-            studentPaymentRouteOrderDto.setMusicGroupId(studentPaymentRouteOrderDto.getSchoolId().toString());
+        if (studentPaymentRouteOrder.getServiceAmount() == null) {
+        	studentPaymentRouteOrder.setServiceAmount(BigDecimal.ZERO);
         }
-        if (studentPaymentRouteOrderDto.getServiceAmount() == null) {
-            studentPaymentRouteOrderDto.setServiceAmount(BigDecimal.ZERO);
+        if (studentPaymentRouteOrder.getSaleAmount() == null) {
+        	studentPaymentRouteOrder.setSaleAmount(BigDecimal.ZERO);
         }
-        if (studentPaymentRouteOrderDto.getGoodsAmount() == null) {
-            studentPaymentRouteOrderDto.setGoodsAmount(BigDecimal.ZERO);
+        studentPaymentRouteOrder.setCreateBy(sysUser.getId());
+        studentPaymentRouteOrder.setUpdateBy(sysUser.getId());
+
+        return succeed(studentPaymentRouteOrderService.addOutOrder(studentPaymentRouteOrder));
+    }
+
+
+	@ApiOperation(value = "订单审核")
+	@PostMapping("/auditOutOrder")
+	@PreAuthorize("@pcs.hasPermissions('routeOrder/auditOutOrder')")
+	public HttpResponseResult<String> auditOutOrder(Long studentPaymentRouteOrderId, AuditStatusEnum auditStatus, String memo) {
+		SysUser sysUser = sysUserFeignService.queryUserInfo();
+		studentPaymentRouteOrderService.auditOutOrder(studentPaymentRouteOrderId, auditStatus, memo, sysUser.getId());
+		return succeed();
+	}
+
+
+    @ApiOperation(value = "修改订单")
+    @PostMapping("/update")
+    @PreAuthorize("@pcs.hasPermissions('routeOrder/update')")
+    public HttpResponseResult<StudentPaymentRouteOrder> update(@RequestBody StudentPaymentRouteOrder studentPaymentRouteOrder) {
+    	StudentPaymentRouteOrder originOrder = studentPaymentRouteOrderService.get(studentPaymentRouteOrder.getId());
+    	if(originOrder == null){
+    		return failed("参数不正确");
+    	}
+    	if(originOrder.getAuditStatus() != AuditStatusEnum.REJECT ){
+    		return failed("只有“拒绝”状态才能修改订单");
+    	}
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        if (studentPaymentRouteOrder.getUserId() == null) {
+            studentPaymentRouteOrder.setUserId(sysUser.getId());
         }
-        studentPaymentRouteOrderDto.setActualAmount(studentPaymentRouteOrderDto.getServiceAmount().add(studentPaymentRouteOrderDto.getGoodsAmount()));
-        return succeed(studentPaymentRouteOrderService.addOutOrder(studentPaymentRouteOrderDto));
+        if (studentPaymentRouteOrder.getServiceAmount() == null) {
+        	studentPaymentRouteOrder.setServiceAmount(BigDecimal.ZERO);
+        }
+        if (studentPaymentRouteOrder.getSaleAmount() == null) {
+        	studentPaymentRouteOrder.setSaleAmount(BigDecimal.ZERO);
+        }
+        studentPaymentRouteOrder.setUpdateBy(sysUser.getId());
+
+        return succeed(studentPaymentRouteOrderService.updateOutOrder(studentPaymentRouteOrder));
     }
 
     @ApiOperation(value = "获取订单信息")

+ 13 - 0
mec-web/src/main/resources/columnMapper.ini

@@ -33,3 +33,16 @@
 备注 = itemDetail
 付款时间 = paymentTime
 事由 = cause
+
+
+[财务管理导入模板]
+所属分部 = organName
+所属学校 = cooperationOrganName
+交易流水号 = transNo
+收款账户 = merNo
+交易日期 = payTime
+销售金额 = saleAmount
+服务金额 = serviceAmount
+商品编号 = goodsIds
+商品数量 = goodsNums
+备注 = memo

二進制
mec-web/src/main/resources/excelTemplate/财务管理导入模板.xlsx