Browse Source

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

zouxuan 5 years ago
parent
commit
6faacdf9ff

+ 2 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/ClassGroupService.java

@@ -2,6 +2,7 @@ package com.ym.mec.biz.service;
 
 import com.ym.mec.biz.dal.dto.*;
 import com.ym.mec.biz.dal.entity.ClassGroup;
+import com.ym.mec.biz.dal.enums.SalarySettlementTypeEnum;
 import com.ym.mec.biz.dal.page.StudentPayLogQueryInfo;
 import com.ym.mec.biz.dal.page.VipClassQueryInfo;
 import com.ym.mec.common.entity.ImGroupModel;
@@ -122,7 +123,7 @@ public interface ClassGroupService extends BaseService<Integer, ClassGroup> {
      * @param musicGroupId
      * @return
      */
-    List<ClassGroupTeachersDto> getClassGroupAndTeacherSalary(String musicGroupId);
+    List<ClassGroupTeachersDto> getClassGroupAndTeacherSalary(String musicGroupId, SalarySettlementTypeEnum type);
 
 
     /**

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

@@ -282,7 +282,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
     }
 
     @Override
-    public List<ClassGroupTeachersDto> getClassGroupAndTeacherSalary(String musicGroupId) {
+    public List<ClassGroupTeachersDto> getClassGroupAndTeacherSalary(String musicGroupId,SalarySettlementTypeEnum type) {
         //乐团班级及班级老师
         List<ClassGroupTeachersDto> classGroupAndTeachers = getClassGroupAndTeachers(musicGroupId);
         //乐团的课程计划

+ 4 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentRegistrationServiceImpl.java

@@ -251,6 +251,10 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
 
         studentPaymentOrderDetailService.batchAdd(studentPaymentOrderDetailList);
 
+        //增加报名学生数
+//        MusicGroupSubjectPlan musicOneSubjectClassPlan = musicGroupSubjectPlanService.getMusicOneSubjectClassPlan(musicGroupId, studentPaymentOrder.get);
+//        musicOneSubjectClassPlan.setApplyStudentNum(musicOneSubjectClassPlan.getApplyStudentNum()+1);
+
         return studentPaymentOrder;
     }
 

+ 0 - 50
mec-education/src/main/java/com/ym/mec/education/enums/ApprovalStatusEnum.java

@@ -1,50 +0,0 @@
-package com.ym.mec.education.enums;
-
-import com.ym.mec.common.enums.BaseEnum;
-import java.util.Arrays;
-
-/**
- * 审核状态枚举(待审批、审批中、审批拒绝、审批通过)
- */
-public enum ApprovalStatusEnum implements BaseEnum<String, ApprovalStatusEnum> {
-    PENDING("PENDING", "待审批"),APPROVAL("APPROVAL", "审核中"), REJECT("REJECT", "拒绝"), PASS("PASS", "通过");
-
-	private String code;
-
-	private String msg;
-
-	ApprovalStatusEnum(String code, String msg) {
-		this.code = code;
-		this.msg = msg;
-	}
-
-	public void setCode(String code) {
-		this.code = code;
-	}
-
-	public String getMsg() {
-		return msg;
-	}
-
-	public void setMsg(String msg) {
-		this.msg = msg;
-	}
-
-	@Override
-	public String getCode() {
-		return this.code;
-	}
-
-    /**
-     * 根据枚举值获取枚举信息
-     *
-     * @param code 枚举值
-     * @return 枚举信息
-     */
-    public static String getMsgByCode(String code) {
-        return Arrays.stream(ApprovalStatusEnum.values())
-            .filter(AuditStatusEnum -> AuditStatusEnum.getCode().equals(code))
-            .findFirst()
-            .map(ApprovalStatusEnum::getMsg).orElse(null);
-    }
-}

+ 3 - 0
mec-education/src/main/java/com/ym/mec/education/req/ApprovalReq.java

@@ -23,4 +23,7 @@ public class ApprovalReq extends BaseQuery {
 
     @ApiModelProperty(value = "未读状态 0 未读 1 已读")
     private Integer status;
+
+    @ApiModelProperty(value = "审批事项")
+    private String approvalType;
 }

+ 8 - 16
mec-education/src/main/java/com/ym/mec/education/resp/ApprovalResp.java

@@ -22,37 +22,29 @@ public class ApprovalResp implements Serializable {
     private String applicant;
     @ApiModelProperty(value = "申请人头像")
     private String applicantImg;
-    @ApiModelProperty(value = "审批状态")
-    private String status;
-    @ApiModelProperty(value = "审批任务id")
-    private String taskId;
     @ApiModelProperty(value = "流程实例id")
     private String orderId;
     @ApiModelProperty(value = "审批事项")
     private String approvalType;
     @ApiModelProperty(value = "申请日期")
     private String approvalDate;
-    @ApiModelProperty(value = "开始时间")
-    private String startTime;
-    @ApiModelProperty(value = "结束时间")
-    private String endTime;
-    @ApiModelProperty(value = "备注")
-    private String remark;
+    @ApiModelProperty(value = "流程状态 0:结束;1:活动")
+    private Integer orderState;
+    @ApiModelProperty(value = "附属变量json")
+    private String variableJson;
     @ApiModelProperty(value = "审批历史")
     private List<ApprovalHistoryInfo> approvalHistory;
 
     @Data
     @ApiModel(description = "审批历史详情")
-    public static class ApprovalHistoryInfo implements Serializable{
+    public static class ApprovalHistoryInfo implements Serializable {
         @ApiModelProperty(value = "审批处理人")
         private String operator;
-        @ApiModelProperty(value = "审批状态")
-        private String status;
-        @ApiModelProperty(value = "拒绝原因")
-        private String reason;
+        @ApiModelProperty(value = "附属变量json")
+        private String variableJson;
     }
 
-    public static ApprovalHistoryInfo getApprovalHistoryInfo(){
+    public static ApprovalHistoryInfo getApprovalHistoryInfo() {
         return new ApprovalHistoryInfo();
     }
 }

+ 27 - 44
mec-education/src/main/java/com/ym/mec/education/service/impl/ApprovalServiceImpl.java

@@ -1,13 +1,10 @@
 package com.ym.mec.education.service.impl;
 
-import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.JSONObject;
 import com.google.common.collect.Lists;
 import com.ym.mec.education.base.BaseResponse;
 import com.ym.mec.education.base.PageResponse;
 import com.ym.mec.education.entity.SysRole;
 import com.ym.mec.education.entity.SysUser;
-import com.ym.mec.education.enums.ApprovalStatusEnum;
 import com.ym.mec.education.req.ApprovalReq;
 import com.ym.mec.education.resp.ApprovalResp;
 import com.ym.mec.education.service.ApprovalService;
@@ -18,8 +15,11 @@ import org.snaker.engine.IQueryService;
 import org.snaker.engine.access.Page;
 import org.snaker.engine.access.QueryFilter;
 import org.snaker.engine.core.AccessService;
-import org.snaker.engine.core.TaskService;
-import org.snaker.engine.entity.*;
+import org.snaker.engine.core.OrderService;
+import org.snaker.engine.entity.HistoryOrder;
+import org.snaker.engine.entity.HistoryTask;
+import org.snaker.engine.entity.Task;
+import org.snaker.engine.entity.WorkItem;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -44,7 +44,7 @@ public class ApprovalServiceImpl implements ApprovalService {
     @Autowired
     private ISysUserService userService;
     @Autowired
-    private TaskService taskService;
+    private OrderService orderService;
     @Autowired
     private ISysRoleService roleService;
 
@@ -86,6 +86,9 @@ public class ApprovalServiceImpl implements ApprovalService {
         page.setPageSize(approvalReq.getPageSize());
         QueryFilter queryFilter = new QueryFilter();
         queryFilter.setOperator(approvalReq.getUserId().toString());
+        if (StringUtils.isNotBlank(approvalReq.getApprovalType())) {
+            queryFilter.setDisplayName(approvalReq.getApprovalType());
+        }
         queryService.getHistoryOrders(page, queryFilter);
         Page<ApprovalResp> pageResult = new Page();
         BeanUtils.copyProperties(page, pageResult);
@@ -93,8 +96,8 @@ public class ApprovalServiceImpl implements ApprovalService {
         if (!CollectionUtils.isEmpty(page.getResult())) {
             page.getResult().forEach(item -> {
                 ApprovalResp approvalResp = initApprovalResp(item.getVariable(), userService.getById(item.getCreator()));
-                approvalResp.setOrderId(item.getId()).setApprovalType(item.getProcessName())
-                    .setApprovalDate(item.getCreateTime().substring(0, 10));
+                approvalResp.setOrderId(item.getId()).setApprovalType(item.getProcessName()).setApprovalDate(item.getCreateTime())
+                    .setOrderState(item.getOrderState());
                 list.add(approvalResp);
             });
         }
@@ -107,33 +110,24 @@ public class ApprovalServiceImpl implements ApprovalService {
         if (Objects.isNull(approvalReq.getOrderId())) {
             return BaseResponse.errorParam();
         }
-        Order order = queryService.getOrder(approvalReq.getOrderId());
-        ApprovalResp approvalResp = initApprovalResp(order.getVariable(), userService.getById(order.getCreator()));
+        HistoryOrder histOrder = queryService.getHistOrder(approvalReq.getOrderId());
+        ApprovalResp approvalResp = initApprovalResp(histOrder.getVariable(), userService.getById(histOrder.getCreator()));
+        approvalResp.setApprovalDate(histOrder.getCreateTime()).setOrderState(histOrder.getOrderState())
+            .setOrderId(approvalReq.getOrderId());
         QueryFilter queryFilter = new QueryFilter();
-        queryFilter.setOperator(order.getCreator()).orderBy("create_Time desc");
+        queryFilter.setOperator(histOrder.getCreator()).orderBy("create_Time desc");
         List<HistoryTask> historyTaskList = queryService.getHistoryTasks(queryFilter);
         List<Task> activeTaskList = queryService.getActiveTasks(queryFilter);
         List<ApprovalResp.ApprovalHistoryInfo> historyInfoList = Lists.newArrayList();
-        ApprovalResp.ApprovalHistoryInfo approvalHistoryInfo = ApprovalResp.getApprovalHistoryInfo();
-        approvalHistoryInfo.setOperator("我").setStatus("发起申请");
-        historyInfoList.add(approvalHistoryInfo);
         if (!CollectionUtils.isEmpty(historyTaskList)) {
             historyTaskList.forEach(task -> {
-                ApprovalResp.ApprovalHistoryInfo historyInfo = initApprovalHisotoryVariable(task.getVariable());
-                SysRole role = roleService.getById(task.getOperator());
-                if (Objects.nonNull(role)) {
-                    Optional.ofNullable(role.getRoleName()).ifPresent(roleName -> historyInfo.setOperator(roleName));
-                }
+                ApprovalResp.ApprovalHistoryInfo historyInfo = initApprovalHisotoryVariable(task.getVariable(), task.getOperator());
                 historyInfoList.add(historyInfo);
             });
         }
         if (!CollectionUtils.isEmpty(activeTaskList)) {
             historyTaskList.forEach(task -> {
-                ApprovalResp.ApprovalHistoryInfo historyInfo = initApprovalHisotoryVariable(task.getVariable());
-                SysRole role = roleService.getById(task.getOperator());
-                if (Objects.nonNull(role)) {
-                    Optional.ofNullable(role.getRoleName()).ifPresent(roleName -> historyInfo.setOperator(roleName));
-                }
+                ApprovalResp.ApprovalHistoryInfo historyInfo = initApprovalHisotoryVariable(task.getVariable(), task.getOperator());
                 historyInfoList.add(historyInfo);
             });
         }
@@ -146,12 +140,7 @@ public class ApprovalServiceImpl implements ApprovalService {
         if (Objects.isNull(approvalReq.getOrderId()) || Objects.isNull(approvalReq.getUserId())) {
             return BaseResponse.errorParam();
         }
-        //查询该实例最新的任务
-        QueryFilter queryFilter = new QueryFilter();
-        queryFilter.setOrderId(approvalReq.getOrderId()).orderBy("create_Time desc");
-        List<Task> taskList = queryService.getActiveTasks(queryFilter);
-        taskList.stream().findFirst().ifPresent(task -> taskService.withdrawTask(task.getId(),
-            approvalReq.getUserId().toString()));
+        orderService.withdraw(approvalReq.getOrderId(), approvalReq.getUserId().toString());
         return BaseResponse.success("取消成功");
     }
 
@@ -175,8 +164,7 @@ public class ApprovalServiceImpl implements ApprovalService {
         if (!CollectionUtils.isEmpty(page.getResult())) {
             page.getResult().forEach(item -> {
                 ApprovalResp approvalResp = initApprovalResp(item.getVariable(), userService.getById(item.getCreator()));
-                approvalResp.setOrderId(item.getId()).setApprovalType(item.getProcessName())
-                    .setApprovalDate(item.getCreateTime().substring(0, 10));
+                approvalResp.setOrderId(item.getId()).setApprovalType(item.getProcessName()).setApprovalDate(item.getCreateTime());
                 list.add(approvalResp);
             });
         }
@@ -192,8 +180,7 @@ public class ApprovalServiceImpl implements ApprovalService {
             page.getResult().forEach(item -> {
                 SysUser user = userService.getById(item.getCreator());
                 ApprovalResp approvalResp = initApprovalResp(item.getOrderVariable(), user);
-                approvalResp.setTaskId(item.getTaskId()).setApprovalType(item.getProcessName())
-                    .setApprovalDate(item.getOrderCreateTime().substring(0, 10));
+                approvalResp.setApprovalType(item.getProcessName()).setApprovalDate(item.getOrderCreateTime());
                 list.add(approvalResp);
             });
         }
@@ -213,21 +200,17 @@ public class ApprovalServiceImpl implements ApprovalService {
     private ApprovalResp initApprovalVariable(String variable) {
         ApprovalResp approvalResp = new ApprovalResp();
         if (StringUtils.isNotBlank(variable)) {
-            JSONObject jsonObject = JSON.parseObject(variable);
-            approvalResp.setStatus(ApprovalStatusEnum.getMsgByCode(jsonObject.getString("status")));
-            Optional.ofNullable(jsonObject.getString("startTime")).ifPresent(time -> approvalResp.setStartTime(time));
-            Optional.ofNullable(jsonObject.getString("endTime")).ifPresent(time -> approvalResp.setEndTime(time));
-            Optional.ofNullable(jsonObject.getString("remark")).ifPresent(remark -> approvalResp.setRemark(remark));
+            approvalResp.setVariableJson(variable);
         }
         return approvalResp;
     }
 
-    private ApprovalResp.ApprovalHistoryInfo initApprovalHisotoryVariable(String variable) {
+    private ApprovalResp.ApprovalHistoryInfo initApprovalHisotoryVariable(String variable, String operator) {
         ApprovalResp.ApprovalHistoryInfo historyInfo = ApprovalResp.getApprovalHistoryInfo();
-        if (StringUtils.isNotBlank(variable)) {
-            JSONObject jsonObject = JSON.parseObject(variable);
-            historyInfo.setStatus(ApprovalStatusEnum.getMsgByCode(jsonObject.getString("status")));
-            Optional.ofNullable(jsonObject.getString("reason")).ifPresent(reason -> historyInfo.setReason(reason));
+        historyInfo.setVariableJson(variable);
+        SysRole role = roleService.getById(operator);
+        if (Objects.nonNull(role)) {
+            Optional.ofNullable(role.getRoleName()).ifPresent(roleName -> historyInfo.setOperator(roleName));
         }
         return historyInfo;
     }

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

@@ -192,7 +192,7 @@ public class MusicGroupController extends BaseController {
 
         Map payMap = payService.getPayMap(orderAmount, orderNo, "https://pay.dayaedu.com/api/yqpay/notify", "http://dev.dayaedu.com", "测试订单", "测试订单");
 
-        studentRegistrationService.addOrder(userId, amount, orderNo, "双乾", courseFee, goodsGroups, goodsList, otherGoodsList, studentRegistration.getMusicGroupId());
+        studentRegistrationService.addOrder(userId, amount, orderNo, (String) payMap.get("type"), courseFee, goodsGroups, goodsList, otherGoodsList, studentRegistration.getMusicGroupId());
 
         return succeed(payMap);
     }

+ 1 - 1
mec-web/src/main/java/com/ym/mec/web/config/ResourceServerConfig.java

@@ -22,7 +22,7 @@ public class ResourceServerConfig extends ResourceServerConfigurerAdapter {
 
 	@Override
 	public void configure(HttpSecurity http) throws Exception {
-		http.csrf().disable().authorizeRequests().antMatchers("/v2/api-docs").permitAll().anyRequest().authenticated().and().httpBasic();
+		http.csrf().disable().authorizeRequests().antMatchers("/v2/api-docs","/classGroup/findMusicGroupClassTeacherSalary").permitAll().anyRequest().authenticated().and().httpBasic();
 	}
 
 	@Override

+ 5 - 4
mec-web/src/main/java/com/ym/mec/web/controller/ClassGroupController.java

@@ -3,6 +3,7 @@ package com.ym.mec.web.controller;
 import com.ym.mec.biz.dal.dto.HighClassGroupDto;
 import com.ym.mec.biz.dal.entity.ClassGroup;
 import com.ym.mec.biz.dal.entity.ClassGroupTeacherMapper;
+import com.ym.mec.biz.dal.enums.SalarySettlementTypeEnum;
 import com.ym.mec.biz.service.ClassGroupService;
 import com.ym.mec.biz.service.ClassGroupTeacherMapperService;
 import com.ym.mec.common.controller.BaseController;
@@ -117,10 +118,10 @@ public class ClassGroupController extends BaseController {
 
     @ApiOperation(value = "获取乐团班级老师课酬")
     @GetMapping("/findMusicGroupClassTeacherSalary")
-    @ApiImplicitParams({@ApiImplicitParam(name = "musicGroupId", value = "乐团编号", required = true, dataType = "Integer"),
-            @ApiImplicitParam(name = "subjectId", value = "声部编号", required = true, dataType = "Integer")})
-    public Object findMusicGroupClassTeacherSalary(String musicGroupId) {
-        return succeed(classGroupService.getClassGroupAndTeacherSalary(musicGroupId));
+    @ApiImplicitParams({@ApiImplicitParam(name = "musicGroupId", value = "乐团编号", required = true, dataType = "String"),
+            @ApiImplicitParam(name = "type", value = "结算类型(1-基准课酬,4-梯度课酬)", required = true, dataType = "Integer")})
+    public Object findMusicGroupClassTeacherSalary(String musicGroupId, SalarySettlementTypeEnum type) {
+        return succeed(classGroupService.getClassGroupAndTeacherSalary(musicGroupId,type));
     }
 
     @ApiOperation(value = "乐团班级老师课酬确认")