|
@@ -120,6 +120,74 @@ public class TempTestServiceImpl extends BaseServiceImpl<Long, TempTest> impleme
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public boolean processBiz1(List<Map<String, Object>> datas) {
|
|
|
+
|
|
|
+ String mobile, idCard, realName, orderNo;
|
|
|
+ SysUser user = null;
|
|
|
+ Integer userId = null;
|
|
|
+ Date classDate = null;
|
|
|
+
|
|
|
+ BigDecimal courseFee = null;
|
|
|
+
|
|
|
+ List<UserSalary> userSalaryList = new ArrayList<UserSalary>();
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");
|
|
|
+ UserSalary userSalary = null;
|
|
|
+
|
|
|
+ //数据整合
|
|
|
+ for (Map<String, Object> row : datas) {
|
|
|
+ realName = row.get("收款人姓名").toString();
|
|
|
+ courseFee = new BigDecimal(row.get("收款金额").toString());
|
|
|
+ classDate = DateUtil.stringToDate(row.get("月份").toString(), "yyyy/MM/dd");
|
|
|
+ classDate = DateUtil.addMonths(classDate, -1);
|
|
|
+
|
|
|
+ user = teacherDao.getUserWithRealName(realName);
|
|
|
+
|
|
|
+ if(user == null){
|
|
|
+ System.out.println("[" + realName + "]用户找不到");
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ userSalary = new UserSalary(null, user, sdf.format(classDate), courseFee, null);
|
|
|
+ userSalaryList.add(userSalary);
|
|
|
+ }
|
|
|
+
|
|
|
+ Map<String,UserSalary> userSalaryMap = new HashMap<String, UserSalary>();
|
|
|
+
|
|
|
+ for(UserSalary us : userSalaryList){
|
|
|
+ if(userSalaryMap.containsKey(us.getBatchNo())){
|
|
|
+ userSalary = userSalaryMap.get(us.getBatchNo());
|
|
|
+ userSalary.setCourseFee(userSalary.getCourseFee().add(us.getCourseFee()));
|
|
|
+
|
|
|
+ userSalaryMap.put(us.getBatchNo(), userSalary);
|
|
|
+ }else{
|
|
|
+ userSalaryMap.put(us.getBatchNo(), us);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ for (Entry<String, UserSalary> entry : userSalaryMap.entrySet()) {
|
|
|
+
|
|
|
+ userSalary = entry.getValue();
|
|
|
+ userId = userSalary.getUserId();
|
|
|
+
|
|
|
+ //查询课程,优先vip课
|
|
|
+ List<TempTest> tempTestList = tempTestDao.queryCourseScheduleInfo(userId, userSalary.getClassMonth());
|
|
|
+
|
|
|
+ tempTestList = extractCourseSchedule(tempTestList, userSalary.getCourseFee());
|
|
|
+ if(tempTestList.size() > 0){
|
|
|
+ try{
|
|
|
+ tempTestDao.batchInsert(tempTestList);
|
|
|
+ }catch(Exception e){
|
|
|
+ System.out.println("userId:" + userId + " mobile:" + entry.getValue().getMobile() + " month:" + entry.getValue().getClassMonth() + " message:" + e.getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
private List<TempTest> extractCourseSchedule(List<TempTest> srcTempTestList, BigDecimal limitSalary){
|
|
|
|
|
|
BigDecimal courseSalary = BigDecimal.ZERO;
|