Explorar o código

Merge branch 'master' into Joburgess

周箭河 %!s(int64=4) %!d(string=hai) anos
pai
achega
16d59651b6
Modificáronse 27 ficheiros con 343 adicións e 96 borrados
  1. 1 1
      cms/src/main/java/com/ym/mec/cms/controller/NewsController.java
  2. 7 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentPaymentRouteOrderDao.java
  3. 22 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/SysPaymentConfigDao.java
  4. 10 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dto/CourseHomeworkStudentDetailDto.java
  5. 3 1
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/MusicGroup.java
  6. 3 1
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/MusicGroupPaymentCalender.java
  7. 15 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/SysPaymentConfig.java
  8. 7 1
      mec-biz/src/main/java/com/ym/mec/biz/service/SysPaymentConfigService.java
  9. 16 10
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/ContractServiceImpl.java
  10. 1 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/ExtracurricularExercisesReplyServiceImpl.java
  11. 18 5
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/FinancialExpenditureServiceImpl.java
  12. 2 17
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderServiceImpl.java
  13. 13 2
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/OperatingReportServiceImpl.java
  14. 1 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentCourseHomeworkServiceImpl.java
  15. 5 2
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentPaymentRouteOrderServiceImpl.java
  16. 1 1
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentRepairServiceImpl.java
  17. 27 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/SysPaymentConfigServiceImpl.java
  18. 2 42
      mec-biz/src/main/resources/config/mybatis/EmployeeInfoMapper.xml
  19. 2 2
      mec-biz/src/main/resources/config/mybatis/MusicGroupPaymentCalenderMapper.xml
  20. 20 0
      mec-biz/src/main/resources/config/mybatis/StudentPaymentRouteOrderMapper.xml
  21. 26 1
      mec-biz/src/main/resources/config/mybatis/SysPaymentConfigMapper.xml
  22. 1 3
      mec-im/src/main/java/com/ym/common/ErrorEnum.java
  23. 127 0
      mec-thirdparty/src/main/java/com/ym/mec/thirdparty/message/provider/AwSmsPlugin.java
  24. 1 1
      mec-util/src/main/java/com/ym/mec/util/excel/POIUtil.java
  25. 8 4
      mec-web/src/main/java/com/ym/mec/web/controller/OperatingReportController.java
  26. 4 2
      mec-web/src/main/java/com/ym/mec/web/controller/StudentPaymentRouteOrderController.java
  27. BIN=BIN
      mec-web/src/main/resources/excelTemplate/财务支出导入模板.xls

+ 1 - 1
cms/src/main/java/com/ym/mec/cms/controller/NewsController.java

@@ -38,13 +38,13 @@ public class NewsController extends BaseController {
 		if(queryInfo.getTenantId() == null){
 			queryInfo.setTenantId(1);
 		}
-		
 		return succeed(sysNewsInformationService.queryPage(queryInfo));
 	}
 
 	@ApiOperation("资讯列表分页查询")
 	@GetMapping(value = "/homeList")
 	public Object getHomeList(NewsInformationQueryInfo queryInfo) {
+		queryInfo.setRows(10);
 		SysUser user = sysUserFeignService.queryUserInfo();
 		return succeed(sysNewsInformationService.getHomeList(user, queryInfo));
 	}

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

@@ -3,6 +3,7 @@ package com.ym.mec.biz.dal.dao;
 
 import com.ym.mec.biz.dal.dto.StudentPaymentOrderExportDto;
 import com.ym.mec.biz.dal.dto.StudentPaymentRouteOrderDto;
+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;
@@ -52,4 +53,10 @@ public interface StudentPaymentRouteOrderDao extends BaseDAO<Long, StudentPaymen
      * @return
      */
     Boolean deleteByOrderNo(@Param("orderNo") String orderNo);
+
+    /**
+     * 插入外部订单
+     * @return
+     */
+    int insertOrder(StudentPaymentOrder order);
 }

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

@@ -8,9 +8,31 @@ import org.apache.ibatis.annotations.Param;
 import java.util.List;
 
 public interface SysPaymentConfigDao extends BaseDAO<Integer, SysPaymentConfig> {
+    /**
+     * 获取分部的收费配置
+     * @param organId
+     * @return
+     */
     SysPaymentConfig findPaymentConfigByOrganId(@Param("organId") Integer organId);
 
+    /**
+     * 根据分部ids获取收费配置
+     * @param organIds
+     * @return
+     */
     List<SysPaymentConfig> findPaymentConfigByOrganIds(@Param("organIds") List<Integer> organIds);
 
+
+    /**
+     * 根据支付渠道获取账户
+     * @param payType
+     * @return
+     */
     List<SysPaymentConfig> getPaymentConfigs(@Param("payType") PaymentChannelEnum payType);
+
+    /**
+     *
+     * @return
+     */
+    List<SysPaymentConfig> getOutAccounts(@Param("payType") PaymentChannelEnum payType);
 }

+ 10 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/CourseHomeworkStudentDetailDto.java

@@ -57,6 +57,16 @@ public class CourseHomeworkStudentDetailDto {
 
     private String teacherName;
 
+    private String type;
+
+    public String getType() {
+        return type;
+    }
+
+    public void setType(String type) {
+        this.type = type;
+    }
+
     public Long getCourseScheduleId() {
         return courseScheduleId;
     }

+ 3 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/MusicGroup.java

@@ -187,7 +187,9 @@ public class MusicGroup {
 	}
 
 	public void setPaymentValidEndDate(String paymentValidEndDate) {
-		if(StringUtils.isNotEmpty(paymentValidEndDate)){
+		if(StringUtils.isEmpty(paymentValidEndDate)){
+			this.paymentValidEndDate = null;
+		}else {
 			this.paymentValidEndDate = paymentValidEndDate;
 		}
 	}

+ 3 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/MusicGroupPaymentCalender.java

@@ -115,7 +115,9 @@ public class MusicGroupPaymentCalender implements Comparable<MusicGroupPaymentCa
 	}
 
 	public void setPaymentValidEndDate(String paymentValidEndDate) {
-		if(StringUtils.isNotEmpty(paymentValidEndDate)){
+		if(StringUtils.isEmpty(paymentValidEndDate)){
+			this.paymentValidEndDate = null;
+		}else {
 			this.paymentValidEndDate = paymentValidEndDate;
 		}
 	}

+ 15 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/SysPaymentConfig.java

@@ -49,6 +49,13 @@ public class SysPaymentConfig {
     private Integer organId;
 
     /**
+     * 账户类型
+     */
+    @ApiModelProperty(value = "账户类型(0-内部、1-外部)")
+    private Integer accountType;
+
+
+    /**
      * 分部名称
      */
     @ApiModelProperty(value = "分部名称")
@@ -231,5 +238,13 @@ public class SysPaymentConfig {
     public void setRouteScale(String routeScale) {
         this.routeScale = routeScale;
     }
+
+    public Integer getAccountType() {
+        return accountType;
+    }
+
+    public void setAccountType(Integer accountType) {
+        this.accountType = accountType;
+    }
 }
 

+ 7 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/SysPaymentConfigService.java

@@ -31,5 +31,11 @@ public interface SysPaymentConfigService extends BaseService<Integer, SysPayment
     List<SysPaymentConfig> getPaymentConfigs(PaymentChannelEnum payType);
 
 
-
+    /**
+     * 查询收款是否包含账户类型为对外的用户
+     * @param payType
+     * @param merNos
+     * @return
+     */
+    Boolean checkOutAccount(PaymentChannelEnum payType,String merNos);
 }

+ 16 - 10
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ContractServiceImpl.java

@@ -5,13 +5,12 @@ import java.io.IOException;
 import java.math.BigDecimal;
 import java.text.DateFormat;
 import java.text.SimpleDateFormat;
-import java.util.*;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 import java.util.Map.Entry;
-import java.util.stream.Collectors;
 
-import com.ym.mec.biz.dal.dao.StudentDao;
-import com.ym.mec.thirdparty.user.realname.RealnameAuthenticationPluginContext;
-import com.ym.mec.thirdparty.user.realname.provider.LinkfaceRealnameAuthenticationPlugin;
 import org.apache.commons.io.FileUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
@@ -21,11 +20,15 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.context.annotation.Lazy;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Isolation;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.CollectionUtils;
 
 import com.ym.mec.auth.api.client.SysUserFeignService;
 import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.biz.dal.dao.MusicGroupPaymentCalenderDao;
 import com.ym.mec.biz.dal.dao.MusicGroupStudentFeeDao;
+import com.ym.mec.biz.dal.dao.StudentDao;
 import com.ym.mec.biz.dal.dao.StudentPaymentOrderDetailDao;
 import com.ym.mec.biz.dal.dto.StudentInfo;
 import com.ym.mec.biz.dal.entity.CooperationOrgan.OwnershipType;
@@ -61,14 +64,12 @@ import com.ym.mec.common.exception.BizException;
 import com.ym.mec.thirdparty.eseal.ESealPlugin;
 import com.ym.mec.thirdparty.storage.StoragePluginContext;
 import com.ym.mec.thirdparty.storage.provider.KS3StoragePlugin;
+import com.ym.mec.thirdparty.user.realname.RealnameAuthenticationPluginContext;
+import com.ym.mec.thirdparty.user.realname.provider.LinkfaceRealnameAuthenticationPlugin;
 import com.ym.mec.util.date.DateUtil;
 import com.ym.mec.util.freemarker.FreemarkerTemplateEngine;
 import com.ym.mec.util.money.MoneyUtil;
 import com.ym.mec.util.pdf.PDFUtil;
-import org.springframework.transaction.annotation.Isolation;
-import org.springframework.transaction.annotation.Propagation;
-import org.springframework.transaction.annotation.Transactional;
-import org.springframework.util.CollectionUtils;
 
 @Service
 public class ContractServiceImpl implements ContractService, InitializingBean {
@@ -979,7 +980,12 @@ public class ContractServiceImpl implements ContractService, InitializingBean {
 
 		SysUserTsign sysUserTsign = sysUserTsignService.get(userId);
 		if (sysUserTsign == null) {
-			sysUserTsign = register(userId, user.getRealName(), user.getIdCardNo(), user.getPhone());
+			try {
+				sysUserTsign = register(userId, user.getRealName(), user.getIdCardNo(), user.getPhone());
+			} catch (Exception e) {
+				logger.error("用户电子签章注册失败", e);
+				return false;
+			}
 		}
 		Date date = new Date();
 

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

@@ -96,6 +96,7 @@ public class ExtracurricularExercisesReplyServiceImpl extends BaseServiceImpl<Lo
 		detail.setStudentId(extraExerciseReply.getUserId());
 		detail.setStudentName(extraExerciseReply.getStudentName());
 		detail.setExpiryDate(extraExerciseReply.getExpireDate());
+		detail.setType("EXTRA");
 		return detail;
 	}
 

+ 18 - 5
mec-biz/src/main/java/com/ym/mec/biz/service/impl/FinancialExpenditureServiceImpl.java

@@ -17,6 +17,7 @@ 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 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;
@@ -30,10 +31,7 @@ import org.springframework.web.multipart.MultipartFile;
 
 import java.io.ByteArrayInputStream;
 import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 import java.util.stream.Collectors;
 
 @Service
@@ -112,6 +110,7 @@ public class FinancialExpenditureServiceImpl extends BaseServiceImpl<Long, Finan
 						}else {
 							objectMap.put("amount", row.get(s));
 						}
+						continue;
 					}
 					if (columnValue.equals("organName") && StringUtils.isNotEmpty(row.get(s).toString())) {
 						Integer integer = organMap.get(row.get(s));
@@ -121,6 +120,7 @@ public class FinancialExpenditureServiceImpl extends BaseServiceImpl<Long, Finan
 						}else {
 							objectMap.put("organId", integer);
 						}
+						continue;
 					}
 					if (columnValue.equals("cooperationOrganName") && StringUtils.isNotEmpty(row.get(s).toString())) {
 						Integer integer = cooperationOrganMap.get(row.get(s));
@@ -129,6 +129,19 @@ public class FinancialExpenditureServiceImpl extends BaseServiceImpl<Long, Finan
 						}else {
 							objectMap.put("cooperationOrganId", integer);
 						}
+						continue;
+					}
+					if (columnValue.equals("paymentTime") && 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));
 				}
@@ -137,7 +150,7 @@ public class FinancialExpenditureServiceImpl extends BaseServiceImpl<Long, Finan
 					financialExpenditure = JSONObject.parseObject(objectMap.toJSONString(),FinancialExpenditure.class);
 					financialExpenditures.add(financialExpenditure);
 				} catch (Exception ex) {
-					throw new BizException("导入数据出错");
+					throw new BizException("导入数据出错,请检查Excel表格");
 				}
 			}
 		}

+ 2 - 17
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderServiceImpl.java

@@ -156,8 +156,6 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 	public void autoUpdateMusicGroupStudentFeeStatus() {
 		Date date = new Date();
 		String format = DateUtil.format(date, DateUtil.DEFAULT_PATTERN);
-		//将有效期已截止的学员缴费信息修改为未缴费
-//		musicGroupStudentFeeDao.updateFeeStatus();
 		//获取距离缴费开启指定天数后的缴费明细
 		String configValue = sysConfigDao.findConfigValue("push_payment_detail");
 		Map<Long, Long> maps = MapUtil.convertIntegerMap(musicGroupPaymentCalenderDao.queryCalenderByDay(configValue,format));
@@ -172,11 +170,6 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 				sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.YIMEI, MessageTypeEnum.SMS_PAYMENT_DETAIL,
 						receivers, null, 0, null, null,calenderPushDto.getMusicGroupName(),
 						calenderPushDto.getPaymentValidStartDate(),calenderPushDto.getPaymentValidEndDate(),maps.get(e));
-				Map<Integer, String> receivers1 = new HashMap<>(1);
-				receivers.put(calenderPushDto.getTeacherId(),calenderPushDto.getTeacherPhone());
-				sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG, MessageTypeEnum.SMS_PAYMENT_DETAIL,
-						receivers1, null, 0, null, null,calenderPushDto.getMusicGroupName(),
-						calenderPushDto.getPaymentValidStartDate(),calenderPushDto.getPaymentValidEndDate(),maps.get(e));
 			});
 		}
 		//获取离截止还有指定时间的缴费项,并发送推送消息给指定老师
@@ -192,11 +185,6 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 				sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.YIMEI, MessageTypeEnum.SMS_PAYMENT_CREATE,
 						receivers, null, 0, null, null,calenderPushDto.getMusicGroupName(),
 						calenderPushDto.getPaymentValidStartDate(),calenderPushDto.getPaymentValidEndDate());
-				Map<Integer, String> receivers1 = new HashMap<>(1);
-				receivers.put(calenderPushDto.getTeacherId(),calenderPushDto.getTeacherId().toString());
-				sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG, MessageTypeEnum.SMS_PAYMENT_CREATE,
-						receivers1, null, 0, null, null,calenderPushDto.getMusicGroupName(),
-						calenderPushDto.getPaymentValidStartDate(),calenderPushDto.getPaymentValidEndDate());
 			});
 		}
 
@@ -209,11 +197,6 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 				sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.YIMEI, MessageTypeEnum.SMS_PAYMENT_CREATE,
 						receivers, null, 0, null, null,e.getMusicGroupName(),
 						e.getPaymentValidStartDate(),e.getPaymentValidEndDate());
-				Map<Integer, String> receivers1 = new HashMap<>(1);
-				receivers.put(e.getTeacherId(),e.getTeacherId().toString());
-				sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG, MessageTypeEnum.SMS_PAYMENT_CREATE,
-						receivers1, null, 0, null, null,e.getMusicGroupName(),
-						e.getPaymentValidStartDate(),e.getPaymentValidEndDate());
 			});
 		}
 	}
@@ -439,6 +422,8 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 		}
 		calender.setStartPaymentDate(paymentCalender.getStartPaymentDate());
 		calender.setDeadlinePaymentDate(paymentCalender.getDeadlinePaymentDate());
+		calender.setPaymentValidStartDate(paymentCalender.getPaymentValidStartDate());
+		calender.setPaymentValidEndDate(paymentCalender.getPaymentValidEndDate());
 		calender.setPaymentPattern(paymentCalender.getPaymentPattern());
 		calender.setUpdateTime(date);
 		if (paymentCalender.getDeadlinePaymentDate().before(date) && !DateUtil.isSameDay(date,paymentCalender.getDeadlinePaymentDate())) {

+ 13 - 2
mec-biz/src/main/java/com/ym/mec/biz/service/impl/OperatingReportServiceImpl.java

@@ -5,6 +5,7 @@ import com.ym.mec.biz.dal.dto.OrganFullJobResourceNumDto;
 import com.ym.mec.biz.dal.entity.CooperationOrgan;
 import com.ym.mec.biz.dal.entity.FinancialExpenditure;
 import com.ym.mec.biz.dal.entity.OperatingReport;
+import com.ym.mec.biz.dal.entity.Organization;
 import com.ym.mec.biz.dal.enums.ExpenditureTypeEnum;
 import com.ym.mec.biz.service.OperatingReportService;
 import com.ym.mec.common.dal.BaseDAO;
@@ -30,6 +31,8 @@ public class OperatingReportServiceImpl extends BaseServiceImpl<Integer, Operati
     private FinancialExpenditureDao financialExpenditureDao;
     @Autowired
     private SysConfigDao sysConfigDao;
+    @Autowired
+    private OrganizationDao organizationDao;
 
 
     @Override
@@ -47,7 +50,7 @@ public class OperatingReportServiceImpl extends BaseServiceImpl<Integer, Operati
         Map<Integer, OperatingReport> cooperationOperating = new HashMap<>();
         Map<Integer, OperatingReport> organOperating = new HashMap<>();
 
-        //1获取分部的全职资源数的分摊费用
+        //1.1 获取分部的全职资源数的分摊费用
         BigDecimal fullJobFee = new BigDecimal(sysConfigDao.findConfigValue("full_job_fee"));
         List<OrganFullJobResourceNumDto> organFullJobResources = cooperationOrganDao.getOrganFullJobResourceNum();
         for (OrganFullJobResourceNumDto organFullJobResource : organFullJobResources) {
@@ -56,7 +59,15 @@ public class OperatingReportServiceImpl extends BaseServiceImpl<Integer, Operati
             operatingReport.setDistributionAmount(new BigDecimal(organFullJobResource.getNum()).multiply(fullJobFee).divide(new BigDecimal(12), 2, BigDecimal.ROUND_HALF_UP));
             organOperating.put(organFullJobResource.getOrganId(), operatingReport);
         }
-        //1、合作单位的全职资源分摊费用
+        //1.2 初始化没有全职资源数的分部
+        List<Organization> organs = organizationDao.findAllOrgans();
+        for (Organization organ : organs) {
+            if(organOperating.containsKey(organ.getId())) continue;
+            OperatingReport operatingReport = new OperatingReport();
+            operatingReport.setOrganId(organ.getId());
+            organOperating.put(organ.getId(), operatingReport);
+        }
+        //1.3 合作单位的全职资源分摊费用
         List<CooperationOrgan> allCooperationOrgan = cooperationOrganDao.getAllCooperationOrgan();
         for (CooperationOrgan cooperationOrgan : allCooperationOrgan) {
             OperatingReport operatingReport = new OperatingReport();

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

@@ -192,6 +192,7 @@ public class StudentCourseHomeworkServiceImpl extends BaseServiceImpl<Long, Stud
                 courseHomeworkStudentDetail.setTeacherName(teacher.getRealName());
             }
         }
+        courseHomeworkStudentDetail.setType("HOMEWORK");
         return courseHomeworkStudentDetail;
     }
 

+ 5 - 2
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentPaymentRouteOrderServiceImpl.java

@@ -92,7 +92,7 @@ public class StudentPaymentRouteOrderServiceImpl extends BaseServiceImpl<Long, S
         studentPaymentRouteOrderDto.setCreateTime(studentPaymentRouteOrderDto.getPayTime());
         studentPaymentRouteOrderDto.setUpdateTime(nowDate);
 
-        studentPaymentOrderDao.insert(studentPaymentRouteOrderDto);
+        studentPaymentRouteOrderDao.insertOrder(studentPaymentRouteOrderDto);
         StudentPaymentRouteOrder studentPaymentRouteOrder = new StudentPaymentRouteOrder();
         studentPaymentRouteOrder.setOrderNo(orderNo);
         studentPaymentRouteOrder.setMerNo(studentPaymentRouteOrderDto.getMerNo());
@@ -116,7 +116,10 @@ public class StudentPaymentRouteOrderServiceImpl extends BaseServiceImpl<Long, S
             for (Map.Entry<Integer, Integer> goodsMap : studentPaymentRouteOrderDto.getGoodies().entrySet()) {
                 Goods goods = goodsDao.get(goodsMap.getKey());
 
-                BigDecimal actualAmount = studentPaymentRouteOrderDto.getGoodsAmount().multiply(goods.getGroupPurchasePrice().multiply(new BigDecimal(goodsMap.getValue()))).divide(goodsTotalPrice, 2, BigDecimal.ROUND_HALF_UP);
+                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);
                 }

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

@@ -732,7 +732,7 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
         return pageInfo;
     }
 
-    private void saveSellOrder(String orderNo){
+    public void saveSellOrder(String orderNo){
         StudentPaymentOrder orderByOrderNo = studentPaymentOrderService.findOrderByOrderNo(orderNo);
         StudentGoodsSell studentGoodsSell = studentGoodsSellDao.findByOrderNo(orderNo);
         String goodsJson = studentGoodsSell.getGoodsJson();

+ 27 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/SysPaymentConfigServiceImpl.java

@@ -6,6 +6,7 @@ import com.ym.mec.biz.dal.enums.PaymentChannelEnum;
 import com.ym.mec.biz.service.SysPaymentConfigService;
 import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -35,4 +36,30 @@ public class SysPaymentConfigServiceImpl extends BaseServiceImpl<Integer, SysPay
     public List<SysPaymentConfig> getPaymentConfigs(PaymentChannelEnum payType) {
         return sysPaymentConfigDao.getPaymentConfigs(payType);
     }
+
+    @Override
+    public Boolean checkOutAccount(PaymentChannelEnum payType, String merNos) {
+        if ((!payType.equals(PaymentChannelEnum.ADAPAY) && !payType.equals(PaymentChannelEnum.YQPAY)) || StringUtils.isBlank(merNos)) {
+            return false;
+        }
+        List<SysPaymentConfig> accounts = sysPaymentConfigDao.getOutAccounts(payType);
+        String[] merNoArr = merNos.split(",");
+        boolean hasOutAccount = false;
+        NODE1:
+        for (String merNo : merNoArr) {
+            for (SysPaymentConfig account : accounts) {
+                String accountNo = "";
+                if (payType.equals(PaymentChannelEnum.ADAPAY)) {
+                    accountNo = account.getHfMerNo();
+                } else {
+                    accountNo = account.getYqMerNo();
+                }
+                if (accountNo.equals(merNo)) {
+                    hasOutAccount = true;
+                    break NODE1;
+                }
+            }
+        }
+        return hasOutAccount;
+    }
 }

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

@@ -70,85 +70,45 @@
 			<if test="subjectIdList != null">
 				subject_id_list_ = #{subjectIdList},
 			</if>
-			<if test="gender != null">
 				gender_ = #{gender},
-			</if>
-			<if test="entryDate != null">
 				entry_date_ = #{entryDate},
-			</if>
-			<if test="otherComment != null">
 				other_comment_ = #{otherComment},
-			</if>
 			<if test="status != null">
 				status_ = #{status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
 			</if>
-			<if test="educationalBackground != null">
 				educational_background_ = #{educationalBackground},
-			</if>
-			<if test="emergencyContactPhone != null">
 				emergency_contact_phone_ = #{emergencyContactPhone},
-			</if>
 				resignation_date_ = #{resignationDate},
-			<if test="position != null">
 				position_ = #{position,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
-			</if>
 			<if test="updateTime != null">
 				update_time_ = #{updateTime},
 			</if>
-			<if test="emergencyContactRelation != null">
 				emergency_contact_relation_ = #{emergencyContactRelation},
-			</if>
 			<if test="id != null">
 				id_ = #{id},
 			</if>
-			<if test="bankCardNo != null">
 				bank_card_no_ = #{bankCardNo},
-			</if>
-			<if test="realName != null">
 				real_name_ = #{realName},
-			</if>
-			<if test="idCard != null">
 				id_card_ = #{idCard},
-			</if>
-			<if test="age != null">
 				age_ = #{age},
-			</if>
-			<if test="liveCity != null">
 				live_city_ = #{liveCity},
-			</if>
-			<if test="intentionCity != null">
 				intention_city_ = #{intentionCity},
-			</if>
 			<if test="createTime != null">
 				create_time_ = #{createTime},
 			</if>
-			<if test="wechatNo != null">
 				wechat_no_ = #{wechatNo},
-			</if>
-			<if test="assessmentResult != null">
 				assessment_result_ = #{assessmentResult},
-			</if>
-			<if test="mobileNo != null">
 				mobile_no_ = #{mobileNo},
-			</if>
-			<if test="emergencyContactName != null">
 				emergency_contact_name_ = #{emergencyContactName},
-			</if>
-			<if test="birthdate != null">
 				birthdate_ = #{birthdate},
-			</if>
-			<if test="bankAddress != null">
 				bank_address_ = #{bankAddress},
-			</if>
 			<if test="organId != null">
 				organ_id_ = #{organId},
 			</if>
 			<if test="operatorId != null">
 				operator_id_ = #{operatorId},
 			</if>
-			<if test="sourceFrom != null">
-				source_from_ = #{sourceFrom},
-			</if>
+				source_from_ = #{sourceFrom}
 		</set>
 		WHERE id_ = #{id}
 	</update>
@@ -189,7 +149,7 @@
 		left join sys_user u on u.id_ = ei.operator_id_
         <include refid="queryPageMap"/>
         GROUP BY ei.id_
-		ORDER BY ei.update_time_
+		ORDER BY ei.update_time_ desc
 		<include refid="global.limit" />
 	</select>
 

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

@@ -230,9 +230,9 @@
         SELECT COUNT(*) FROM music_group_payment_calender mgpc
         WHERE music_group_id_ = #{musicGroupId}
         AND (payment_valid_end_date_ IS NULL OR payment_valid_start_date_ BETWEEN #{paymentValidStartDate} AND #{paymentValidEndDate}
-        OR payment_valid_end_date_ BETWEEN #{paymentValidStartDate} AND #{paymentValidEndDate})
+        OR payment_valid_end_date_ BETWEEN #{paymentValidStartDate} AND #{paymentValidEndDate}) AND payment_valid_start_date_ IS NOT NULL
         <if test="calenderId != null">
-            AND mgpc.id_ = #{calenderId}
+            AND mgpc.id_ != #{calenderId}
         </if>
     </select>
     <select id="queryCalenderByDay" resultType="java.util.Map">

+ 20 - 0
mec-biz/src/main/resources/config/mybatis/StudentPaymentRouteOrderMapper.xml

@@ -221,4 +221,24 @@
         where order_no_ = #{orderNo}
     </delete>
 
+    <!-- 向数据库增加一条记录 -->
+    <insert id="insertOrder" parameterType="com.ym.mec.biz.dal.entity.StudentPaymentOrder" useGeneratedKeys="true"
+            keyColumn="id" keyProperty="id">
+        INSERT INTO student_payment_order
+        (id_, group_type_, user_id_, organ_id_, routing_organ_id_, type_, expect_amount_, actual_amount_, com_amount_,
+        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_)
+        VALUES (#{id}, #{groupType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
+        #{userId}, #{organId}, #{routingOrganId},
+        #{type,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
+        #{expectAmount}, #{actualAmount}, #{comAmount}, #{perAmount}, #{balancePaymentAmount},
+        #{remitFee}, #{courseRemitFee}, #{transNo},
+        #{status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}, #{memo}, #{createTime}, now(),
+        #{paymentChannel}, #{paymentBusinessChannel}, #{paymentAccountNo}, #{merNos}, #{orderNo},
+        #{musicGroupId},
+        #{classGroupId}, #{payTime})
+    </insert>
+
 </mapper>

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

@@ -5,6 +5,7 @@
         <!--@Table sys_payment_config-->
         <id column="id_" jdbcType="INTEGER" property="id"/>
         <result column="organ_id_" property="organId"/>
+        <result column="account_tyoe_" property="accountType"/>
         <result column="pay_type_" property="payType"/>
         <result column="yq_mer_no_" property="yqMerNo"/>
         <result column="hf_mer_no_" property="hfMerNo"/>
@@ -22,7 +23,7 @@
     </resultMap>
     <sql id="Base_Column_List">
         <!--@mbg.generated-->
-        id_, organ_id_,pay_type_,yq_mer_no_,hf_mer_no_,type_,route_scale_,create_time_, update_time_
+        id_, organ_id_,account_type_,pay_type_,yq_mer_no_,hf_mer_no_,type_,route_scale_,create_time_, update_time_
     </sql>
     <select id="get" parameterType="java.lang.Integer" resultMap="SysPaymentConfig">
         <!--@mbg.generated-->
@@ -44,6 +45,9 @@
             <if test="organId != null">
                 organ_id_,
             </if>
+            <if test="accountType != null">
+                account_type_,
+            </if>
             <if test="payType != null">
                 pay_type_,
             </if>
@@ -70,6 +74,9 @@
             <if test="organId != null">
                 #{organId},
             </if>
+            <if test="accountType != null">
+                #{accountType},
+            </if>
             <if test="payType != null">
                 #{payType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
             </if>
@@ -100,6 +107,9 @@
             <if test="organId != null">
                 organ_id_ = #{organId},
             </if>
+            <if test="accountType != null">
+                account_type_ = #{accountType},
+            </if>
             <if test="payType != null">
                 pay_type_ = #{payType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
             </if>
@@ -174,6 +184,21 @@
                 AND spc.hf_mer_no_ !=''
             </if>
         </where>
+    </select>
 
+    <!-- 获取所有账户类型为外部的账户 -->
+    <select id="getOutAccounts" resultMap="SysPaymentConfig">
+        SELECT * FROM sys_payment_config WHERE account_type_ = 1
+        <where>
+            <if test="payType != null">
+                AND pay_type_ = #{payType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
+            </if>
+            <if test='payType != null and payType.code.equals("YQPAY")'>
+                AND yq_mer_no_ != ''
+            </if>
+            <if test='payType != null and payType.code.equals("ADAPAY")'>
+                AND hf_mer_no_ !=''
+            </if>
+        </where>
     </select>
 </mapper>

+ 1 - 3
mec-im/src/main/java/com/ym/common/ErrorEnum.java

@@ -36,9 +36,7 @@ public enum ErrorEnum {
     ERR_OVER_MAX_COUNT(31, "Over max count"),
     ERR_TEACHER_EXIST_IN_ROOM(32, "Teacher exist in room"),
     ERR_DOWNGRADE_ROLE(33, "Can't downgrade role"),
-    ERR_CHANGE_ROLE(34, "Only change student to teacher"),
-
-    ;
+    ERR_CHANGE_ROLE(34, "Only change student to teacher");
 
     private @Getter int errCode;
     private @Getter String errMsg;

+ 127 - 0
mec-thirdparty/src/main/java/com/ym/mec/thirdparty/message/provider/AwSmsPlugin.java

@@ -0,0 +1,127 @@
+package com.ym.mec.thirdparty.message.provider;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.InitializingBean;
+import org.springframework.stereotype.Service;
+
+import com.alibaba.fastjson.JSONObject;
+import com.ym.mec.thirdparty.exception.ThirdpartyException;
+import com.ym.mec.thirdparty.message.MessageSenderPlugin;
+import com.ym.mec.util.http.HttpUtil;
+
+/**
+ * 昂网短信
+ */
+@Service
+public class AwSmsPlugin implements MessageSenderPlugin, InitializingBean {
+	/**
+	 * 请求地址
+	 */
+	private String reqURL = "http://47.104.84.72:8513/sms/Api/ReturnJson/Send.do";
+
+	private String appId = "2041";
+
+	/**
+	 * 账号
+	 */
+	private String account = "jmylhy";
+
+	/**
+	 * 密码
+	 */
+	private String pswd = "0Q!R1d@A";
+
+	private String signature = "【管乐迷】";
+
+	public static String getName() {
+		return "awsms";
+	}
+
+	@Override
+	public void afterPropertiesSet() throws Exception {
+		// 参数检查
+		if (StringUtils.isBlank(reqURL)) {
+			throw new RuntimeException("Init parameter [reqURL] can not blank");
+		}
+		if (StringUtils.isBlank(account)) {
+			throw new RuntimeException("Init parameter [account] can not blank");
+		}
+		if (StringUtils.isBlank(pswd)) {
+			throw new RuntimeException("Init parameter [pswd] can not blank");
+		}
+	}
+
+	public void setReqURL(String reqURL) {
+		this.reqURL = reqURL;
+	}
+
+	public void setAccount(String account) {
+		this.account = account;
+	}
+
+	public void setPswd(String pswd) {
+		this.pswd = pswd;
+	}
+
+	@Override
+	public boolean send(String subject, String content, String receiver, String url, String jpushType) throws IOException {
+		try {
+			Map<String, Object> reqParams = new HashMap<String, Object>();
+			reqParams.put("SpCode", appId);
+			reqParams.put("LoginName", account);
+			reqParams.put("Password", pswd);
+			reqParams.put("MessageContent", signature + content);
+			reqParams.put("UserNumber", receiver);
+			// reqParams.put("SerialNumber", "");
+			// reqParams.put("ScheduleTime", "");
+			// reqParams.put("subPort", "");
+			String resultParams = HttpUtil.postForHttp(reqURL, reqParams);
+			JSONObject jsonObject = JSONObject.parseObject(resultParams);
+			if (jsonObject.get("result").equals("0")) {
+				return true;
+			} else {
+				throw new ThirdpartyException("短信发送失败:{}", jsonObject.get("description"));
+			}
+		} catch (Exception e) {
+			throw new ThirdpartyException("Failed to invoke awsms service", e);
+		}
+	}
+
+	@Override
+	public boolean batchSend(String subject, String content, String[] receivers, String url, String jpushType) throws IOException {
+		StringBuilder stringBuilder = new StringBuilder("");
+		for (int i = 0; i < receivers.length - 1; i++) {
+			stringBuilder.append(receivers[i]).append(",");
+		}
+		stringBuilder.append(receivers[receivers.length - 1]);
+		try {
+			Map<String, Object> reqParams = new HashMap<String, Object>();
+			reqParams.put("SpCode", appId);
+			reqParams.put("LoginName", account);
+			reqParams.put("Password", pswd);
+			reqParams.put("MessageContent", signature + content);
+			reqParams.put("UserNumber", stringBuilder.toString().trim());
+			// reqParams.put("SerialNumber", "");
+			// reqParams.put("ScheduleTime", "");
+			// reqParams.put("subPort", "");
+			String resultParams = HttpUtil.postForHttp(reqURL, reqParams);
+			JSONObject jsonObject = JSONObject.parseObject(resultParams);
+			if (jsonObject.get("result").equals("0")) {
+				return true;
+			} else {
+				throw new ThirdpartyException("短信发送失败:{}", jsonObject.get("description"));
+			}
+		} catch (Exception e) {
+			throw new ThirdpartyException("Failed to invoke awsms service", e);
+		}
+	}
+
+	public static void main(String[] args) throws IOException {
+		AwSmsPlugin plugin = new AwSmsPlugin();
+		plugin.send("测试", "您的验证码为274160(5分钟内有效),您正在进行商户认证,请不要向他人透露验证码", "13720176797", "", "");
+	}
+}

+ 1 - 1
mec-util/src/main/java/com/ym/mec/util/excel/POIUtil.java

@@ -479,7 +479,7 @@ public class POIUtil {
 					cellIter = row.iterator();
 					// 列号清零
 					currentCellNum = 0;
-					while (cellIter.hasNext()) {
+					while (cellIter.hasNext() && currentCellNum < fieldsName.length) {
 						cell = cellIter.next();
 						int columnIndex = cell.getColumnIndex();
 						cell.setCellType(Cell.CELL_TYPE_STRING);

+ 8 - 4
mec-web/src/main/java/com/ym/mec/web/controller/OperatingReportController.java

@@ -91,6 +91,10 @@ public class OperatingReportController extends BaseController {
                 }
             }
         }
+        if (queryInfo.getMonth() != null) {
+            queryInfo.setStartTime(DateUtil.getFirstDayOfMonth(queryInfo.getMonth()));
+            queryInfo.setEndTime(DateUtil.getLastDayOfMonth(queryInfo.getMonth()));
+        }
         queryInfo.setRows(65000);
         queryInfo.setType("organ");
         PageInfo<OperatingReport> pageList = operatingReportService.queryPage(queryInfo);
@@ -104,15 +108,15 @@ public class OperatingReportController extends BaseController {
         OutputStream outputStream = response.getOutputStream();
         try {
 
-            String[] header = {"分部", "销售收入(元)", "服务收入(元)", "业务退费(元)", "收入合计(元)", "销售成本(元)", "固定支出(元)", "变动支出(元)", "分摊费用(元)", "成本费用合计(元)", "利润(元)"};
-            String[] body = {"organName", "sellAmount", "serviceAmount", "refundAmount", "incomeTotal", "sellCost", "expensesAmount", "variableCost", "distributionAmount", "costAmount", "profit"};
+            String[] header = {"分部", "销售收入(元)", "服务收入(元)","其他收入(元)", "业务退费(元)", "收入合计(元)", "销售成本(元)", "固定支出(元)", "变动支出(元)", "分摊费用(元)", "成本费用合计(元)", "利润(元)"};
+            String[] body = {"organName", "sellAmount", "serviceAmount","otherIncome", "refundAmount", "incomeTotal", "sellCost", "expensesAmount", "variableCost", "distributionAmount", "costAmount", "profit"};
             HSSFWorkbook workbook = POIUtil.multipleSheetExportExcel(header, body, pageList.getRows(), null);
 
 
             queryInfo.setType("school");
             pageList = operatingReportService.queryPage(queryInfo);
-            String[] header2 = {"分部", "学校", "销售收入(元)", "服务收入(元)", "业务退费(元)", "收入合计(元)", "销售成本(元)", "固定支出(元)", "变动支出(元)", "分摊费用(元)", "成本费用合计(元)", "利润(元)"};
-            String[] body2 = {"organName", "schoolName", "sellAmount", "serviceAmount", "refundAmount", "incomeTotal", "sellCost", "expensesAmount", "variableCost", "distributionAmount", "costAmount", "profit"};
+            String[] header2 = {"分部", "学校", "销售收入(元)", "服务收入(元)","其他收入(元)", "业务退费(元)", "收入合计(元)", "销售成本(元)", "固定支出(元)", "变动支出(元)", "分摊费用(元)", "成本费用合计(元)", "利润(元)"};
+            String[] body2 = {"organName", "schoolName", "sellAmount", "serviceAmount","otherIncome", "refundAmount", "incomeTotal", "sellCost", "expensesAmount", "variableCost", "distributionAmount", "costAmount", "profit"};
             workbook = POIUtil.multipleSheetExportExcel(header2, body2, pageList.getRows(), workbook);
 
             response.setContentType("application/octet-stream");

+ 4 - 2
mec-web/src/main/java/com/ym/mec/web/controller/StudentPaymentRouteOrderController.java

@@ -90,8 +90,10 @@ public class StudentPaymentRouteOrderController extends BaseController {
     @PostMapping("/add")
     @PreAuthorize("@pcs.hasPermissions('routeOrder/add')")
     public HttpResponseResult<StudentPaymentRouteOrderDto> add(@RequestBody StudentPaymentRouteOrderDto studentPaymentRouteOrderDto) {
-        SysUser sysUser = sysUserFeignService.queryUserInfo();
-        studentPaymentRouteOrderDto.setUserId(sysUser.getId());
+        if (studentPaymentRouteOrderDto.getUserId() == null) {
+            SysUser sysUser = sysUserFeignService.queryUserInfo();
+            studentPaymentRouteOrderDto.setUserId(sysUser.getId());
+        }
         if (studentPaymentRouteOrderDto.getSchoolId() != null) {
             studentPaymentRouteOrderDto.setMusicGroupId(studentPaymentRouteOrderDto.getSchoolId().toString());
         }

BIN=BIN
mec-web/src/main/resources/excelTemplate/财务支出导入模板.xls