Просмотр исходного кода

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

yanite 3 лет назад
Родитель
Сommit
19002c947d

+ 11 - 0
mec-auth/mec-auth-api/src/main/java/com/ym/mec/auth/api/entity/SysUser.java

@@ -156,6 +156,17 @@ public class SysUser extends BaseEntity implements Serializable{
 	
 	private String positionName;
 
+	@ApiModelProperty(value = "用户职位",required = false)
+	private String positions;
+
+	public String getPositions() {
+		return positions;
+	}
+
+	public void setPositions(String positions) {
+		this.positions = positions;
+	}
+
 	public String getCertificateType() {
 		return certificateType;
 	}

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

@@ -150,7 +150,7 @@ public interface StudentManageService {
 
     /**
      * 修改学员信息
-     * @param sysUser
+     * @param student
      * @return
      */
     int studentUpdate(Student student);

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

@@ -387,8 +387,8 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 					newCSList.add(tempPccs);
 				}
 				musicGroupPaymentCalender.setMusicGroupPaymentCalenderCourseSettingsList(newCSList);
+				musicGroupPaymentCalender.setCurrentTotalAmount(musicGroupPaymentCalenderCourseSettingsList.stream().map(e->e.getCourseCurrentPrice()).reduce(BigDecimal.ZERO,BigDecimal::add));
 			}
-			musicGroupPaymentCalender.setCurrentTotalAmount(totalPaymentAmount);
 			musicGroupPaymentCalender.setOriginalTotalAmount(musicGroupPaymentCalenderDto.getOriginalAmount());
 
 			if (paymentType == PaymentType.MUSIC_APPLY) {

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

@@ -2153,20 +2153,6 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
             studentRegistration.setUpdateTime(date);
             studentRegistrationDao.update(studentRegistration);
 
-            //更新服务指标、运营指标
-            /*int remainCourseNum = courseScheduleStudentPaymentDao.countStudentNotStartCourseNumWithCourseType(userId, null);
-            if (remainCourseNum == 0) {
-                Student student = studentDao.get(userId);
-                if (student == null) {
-                    throw new BizException("学生信息查询失败");
-                }
-                student.setServiceTag(0);
-                student.setOperatingTag(0);
-                student.setOperatingTempTag(0);
-                student.setUpdateTime(date);
-                studentDao.update(student);
-            }*/
-
             //删除进行中加学生,且在审批中或拒绝的缴费
             List<Long> paymentCalenderIdList = musicGroupPaymentCalenderDao.findStudentNoPaymentCalender(userId, musicGroupId);
             if (paymentCalenderIdList != null && paymentCalenderIdList.size() > 0) {

+ 75 - 36
mec-biz/src/main/java/com/ym/mec/biz/service/impl/TenantAssetsInfoServiceImpl.java

@@ -28,8 +28,7 @@ import java.util.*;
 import java.util.function.Predicate;
 import java.util.stream.Collectors;
 
-import static com.ym.mec.biz.dal.enums.MessageTypeEnum.EMAIL_TENANT_INSUFFICIENT_BALANCE;
-import static com.ym.mec.biz.dal.enums.MessageTypeEnum.SMS_TENANT_INSUFFICIENT_BALANCE;
+import static com.ym.mec.biz.dal.enums.MessageTypeEnum.*;
 
 /**
  * 机构资产信息(TenantAssetsInfo)表服务实现类
@@ -47,8 +46,6 @@ public class TenantAssetsInfoServiceImpl extends ServiceImpl<TenantAssetsInfoDao
     @Autowired
     private TenantCloudCourseRecordService tenantCloudCourseRecordService;
     @Autowired
-    private TenantInfoSendMsgService tenantInfoSendMsgService;
-    @Autowired
     private TenantInfoService tenantInfoService;
     @Autowired
     private SysMessageService sysMessageService;
@@ -156,42 +153,84 @@ public class TenantAssetsInfoServiceImpl extends ServiceImpl<TenantAssetsInfoDao
                 //当前余额
                 BigDecimal balance = assetsInfo.getBalance();
                 //当前余额 减 本次扣费 的剩余额度
-                BigDecimal after = balance.subtract(coursePrice).setScale(2,RoundingMode.HALF_UP);
-                //300
-                BigDecimal threeHundred = new BigDecimal(300);
-                //当前余额大于300 并且 本次扣除后剩余额度小于300 就发信息提醒
-                if (balance.compareTo(threeHundred) >= 0 && after.compareTo(threeHundred) <0) {
-                    TenantInfo t = tenantInfoService.getById(course.getTenantId());
-                    //邮件
-                    if (StringUtils.isNotBlank(t.getEmail())) {
-                        //机构名称 300 余额
-                        Object[] emailMsg = {t.getName(), 300, after.toString()};
-                        Map<Integer, String> sendPar = new HashMap<>();
-                        sendPar.put(t.getUserId(), t.getEmail());
-                        log.info("platformSendToAll>>> 余额不足 receiveUserId {} email {} objs {} sendPar {}", t.getUserId(), t.getEmail(), emailMsg, sendPar);
-                        sysMessageService.batchSendMessage(-1, MessageSenderPluginContext.MessageSender.EMAIL,
-                                EMAIL_TENANT_INSUFFICIENT_BALANCE,
-                                sendPar, null, 0, null,
-                                "SYSTEM", emailMsg);
-                    }
+                BigDecimal after = balance.subtract(coursePrice).setScale(2, RoundingMode.HALF_UP);
+                //判断是否发送信息
+                sendMsg(course.getTenantId(), balance, after);
+            }
+        });
+
+    }
+
+    /**
+     * 判断是否发送信息
+     * <p>
+     * 1.判断扣费前余额大于300并在本次扣费后剩余额度小于300就发信息提醒
+     * <p>
+     * 2.当前扣费为负数后要发邮件和短信提醒
+     *
+     * @param tenantId 机构id
+     * @param balance  扣费前金额
+     * @param after    扣费后金额
+     */
+    private void sendMsg(Integer tenantId, BigDecimal balance, BigDecimal after) {
+        TenantInfo t = tenantInfoService.getById(tenantId);
+        //当前余额大于300 并且 本次扣除后剩余额度小于300
+        BigDecimal threeHundred = new BigDecimal(300);
+        if (balance.compareTo(threeHundred) >= 0 && after.compareTo(threeHundred) < 0) {
 
-                    //短信
-                    if (StringUtils.isNotBlank(t.getPhone())) {
-                        //机构名称
-                        Object[] phoneMsg = {t.getName()};
-                        Map<Integer, String> sendPar2 = new HashMap<>();
-                        sendPar2.put(t.getUserId(), t.getPhone());
-                        log.info("platformSendToAll>>> 余额不足 receiveUserId {} phone {} objs {} sendPar {}", t.getUserId(), t.getPhone(), phoneMsg, sendPar2);
-                        sysMessageService.batchSendMessage(-1, MessageSenderPluginContext.MessageSender.AWSMS,
-                                SMS_TENANT_INSUFFICIENT_BALANCE,
-                                sendPar2, null, 0, null,
-                                "SYSTEM", phoneMsg);
-                    }
+            //邮件
+            if (StringUtils.isNotBlank(t.getEmail())) {
+                //机构名称 300 余额
+                Object[] emailMsg = {t.getName(), 300, after.toString()};
+                Map<Integer, String> sendPar = new HashMap<>();
+                sendPar.put(t.getUserId(), t.getEmail());
+                log.info("platformSendToAll>>> 余额不足 receiveUserId {} email {} objs {} sendPar {}", t.getUserId(), t.getEmail(), emailMsg, sendPar);
+                sysMessageService.batchSendMessage(-1, MessageSenderPluginContext.MessageSender.EMAIL,
+                        EMAIL_TENANT_INSUFFICIENT_BALANCE,
+                        sendPar, null, 0, null,
+                        "SYSTEM", emailMsg);
+            }
 
-                }
+            //短信
+            if (StringUtils.isNotBlank(t.getPhone())) {
+                //机构名称
+                Object[] phoneMsg = {t.getName()};
+                Map<Integer, String> sendPar2 = new HashMap<>();
+                sendPar2.put(t.getUserId(), t.getPhone());
+                log.info("platformSendToAll>>> 余额不足 receiveUserId {} phone {} objs {} sendPar {}", t.getUserId(), t.getPhone(), phoneMsg, sendPar2);
+                sysMessageService.batchSendMessage(-1, MessageSenderPluginContext.MessageSender.AWSMS,
+                        SMS_TENANT_INSUFFICIENT_BALANCE,
+                        sendPar2, null, 0, null,
+                        "SYSTEM", phoneMsg);
             }
-        });
+        }
 
+        //当前余额已经扣为负数
+        if (after.compareTo(BigDecimal.ZERO) < 0) {
+            //邮件
+            if (StringUtils.isNotBlank(t.getEmail())) {
+                //机构名称 余额
+                Object[] emailMsg = {t.getName(), after.toString()};
+                Map<Integer, String> sendPar = new HashMap<>();
+                sendPar.put(t.getUserId(), t.getEmail());
+                log.info("platformSendToAll>>> 已欠费 receiveUserId {} email {} objs {} sendPar {}", t.getUserId(), t.getEmail(), emailMsg, sendPar);
+                sysMessageService.batchSendMessage(-1, MessageSenderPluginContext.MessageSender.EMAIL,
+                        EMAIL_TENANT_EXPIRE, sendPar, null, 0, null,
+                        "SYSTEM", emailMsg);
+            }
+
+            //短信
+            if (StringUtils.isNotBlank(t.getPhone())) {
+                //机构名称
+                Object[] phoneMsg = {t.getName()};
+                Map<Integer, String> sendPar2 = new HashMap<>();
+                sendPar2.put(t.getUserId(), t.getPhone());
+                log.info("platformSendToAll>>> 已欠费 receiveUserId {} phone {} objs {} sendPar {}", t.getUserId(), t.getPhone(), phoneMsg, sendPar2);
+                sysMessageService.batchSendMessage(-1, MessageSenderPluginContext.MessageSender.AWSMS,
+                        SMS_TENANT_EXPIRE, sendPar2, null, 0, null,
+                        "SYSTEM", phoneMsg);
+            }
+        }
     }
 
     /**

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

@@ -12,7 +12,7 @@
 		<result column="tenant_id_" property="tenantId" />
 	</resultMap>
 		
-	<resultMap type="com.ym.mec.biz.dal.dto.SysEmployeePositionDto" id="SysEmployeePositionDto">
+	<resultMap type="com.ym.mec.biz.dal.dto.SysEmployeePositionDto" id="SysEmployeePositionDto" extends="SysEmployeePosition">
 		<result column="position_name_" property="positionName" />
 		<result column="position_code_" property="positionCode" />
 	</resultMap>

+ 2 - 132
mec-web/src/main/java/com/ym/mec/web/controller/EmployeeController.java

@@ -1,5 +1,6 @@
 package com.ym.mec.web.controller;
 
+import com.alibaba.fastjson.JSONObject;
 import com.ym.mec.biz.dal.dao.TeacherDao;
 import com.ym.mec.common.exception.BizException;
 import io.swagger.annotations.Api;
@@ -164,6 +165,7 @@ public class EmployeeController extends BaseController {
             
             List<SysEmployeePositionDto> sysEmployeePositionDtoList = sysEmployeePositionService.queryByUserId(sysUser.getId());
             if(sysEmployeePositionDtoList != null && sysEmployeePositionDtoList.size() > 0){
+                sysUser.setPositions(StringUtils.join(sysEmployeePositionDtoList.stream().map(SysEmployeePositionDto :: getRoleId).collect(Collectors.toSet()),","));
             	sysUser.setPositionName(sysEmployeePositionDtoList.stream().map(SysEmployeePositionDto :: getPositionName).collect(Collectors.joining(",")));
             }
             return succeed(sysUser);
@@ -171,138 +173,6 @@ public class EmployeeController extends BaseController {
         return failed("获取用户信息失败");
     }
 
-    /*@ApiOperation(value = "获取教务人员")
-    @GetMapping("/findEducationUsers")
-    public HttpResponseResult findEducationUsers(Integer userId, Integer organId){
-        SysUser sysUser;
-        if(userId == null){
-            sysUser = sysUserFeignService.queryUserInfo();
-            if (sysUser == null) {
-                return failed("用户信息获取失败");
-            }
-        }else {
-            sysUser = sysUserFeignService.queryUserById(userId);
-        }
-        String organIds = new String();
-        if(Objects.isNull(organId)){
-            Employee employee = employeeService.get(sysUser.getId());
-            if (StringUtils.isEmpty(organIds)) {
-                organIds = employee.getOrganIdList();
-            }
-        }else{
-            organIds = organId.toString();
-        }
-        return succeed(employeeService.findByRole("4,5",organIds));
-    }
-
-    @ApiOperation(value = "获取对应角色的员工")
-    @GetMapping("/findUserByRole")
-    public HttpResponseResult findEducationUsers(Integer userId, Integer organId, EmployeeRoleEnum employeeRole){
-        SysUser sysUser;
-        if(userId == null){
-            sysUser = sysUserFeignService.queryUserInfo();
-            if (sysUser == null) {
-                return failed("用户信息获取失败");
-            }
-        }else {
-            sysUser = sysUserFeignService.queryUserById(userId);
-        }
-        String organIds = new String();
-        if(Objects.isNull(organId)){
-            Employee employee = employeeService.get(sysUser.getId());
-            if (StringUtils.isEmpty(organIds)) {
-                organIds = employee.getOrganIdList();
-            }
-        }else{
-            organIds = organId.toString();
-        }
-        HashMap<String, Object> map = new HashMap<>();
-        if(employeeRole == null){
-            map.put("TEAM_TEACHER",employeeService.findByRole("5",organIds));
-            map.put("TRANSACTION",employeeService.findByRole("58",organIds));
-            map.put("EDUCATION",employeeService.findByRole("4",organIds));
-        }else if(employeeRole == EmployeeRoleEnum.TEAM_TEACHER){
-            map.put("TEAM_TEACHER",employeeService.findByRole("5",organIds));
-        }else if(employeeRole == EmployeeRoleEnum.TRANSACTION){
-            map.put("TRANSACTION",employeeService.findByRole("58",organIds));
-        }else {
-            map.put("EDUCATION",employeeService.findByRole("4",organIds));
-        }
-        return succeed(map);
-    }
-
-    @ApiOperation(value = "获取对应角色的员工")
-    @GetMapping("/queryEmployeeByRole")
-    public HttpResponseResult queryEmployeeByRole(Integer organId, String roleId){
-        SysUser sysUser = sysUserFeignService.queryUserInfo();
-        if (sysUser == null) {
-            return failed(HttpStatus.FORBIDDEN,"请登录");
-        }
-        String organIds = new String();
-        if(Objects.isNull(organId)){
-            Employee employee = employeeService.get(sysUser.getId());
-            if (StringUtils.isEmpty(organIds)) {
-                organIds = employee.getOrganIdList();
-            }
-        }else{
-            organIds = organId.toString();
-        }
-        return succeed(employeeService.findByRole(roleId, organIds));
-    }
-
-    @ApiOperation(value = "获取教务老师")
-    @GetMapping("/findEducationTeacher")
-    public HttpResponseResult findEducationTeacher(Integer userId){
-        SysUser sysUser;
-        if(userId == null){
-            sysUser = sysUserFeignService.queryUserInfo();
-            if (sysUser == null) {
-                return failed("用户信息获取失败");
-            }
-        }else {
-            sysUser = sysUserFeignService.queryUserById(userId);
-        }
-        String organIds = new String();
-        Employee employee = employeeService.get(sysUser.getId());
-        if (StringUtils.isEmpty(organIds)) {
-            organIds = employee.getOrganIdList();
-        }
-        return succeed(employeeService.findByRole("4",organIds));
-    }
-
-    @ApiOperation(value = "获取维修技师")
-    @GetMapping("/findTechnician")
-    @PreAuthorize("@pcs.hasPermissions('employee/findTechnician')")
-    public HttpResponseResult findTechnician(String organIds){
-        SysUser sysUser = sysUserFeignService.queryUserInfo();
-        if (sysUser == null) {
-            return failed("用户信息获取失败");
-        }
-        if(StringUtils.isEmpty(organIds)){
-            Employee employee = employeeService.get(sysUser.getId());
-            if (StringUtils.isEmpty(organIds)) {
-                organIds=employee.getOrganIdList();
-            }
-        }
-        return succeed(employeeService.findByRole("37",organIds));
-    }
-
-    @ApiOperation(value = "获取所有维修技师(包含离职和冻结的)")
-    @GetMapping("/findAllTechnician")
-    @PreAuthorize("@pcs.hasPermissions('employee/findAllTechnician')")
-    public HttpResponseResult<List<SimpleUserDto>> findAllTechnician(){
-        SysUser sysUser = sysUserFeignService.queryUserInfo();
-        String organIds = new String();
-        if (sysUser == null) {
-            return failed("用户信息获取失败");
-        }
-        Employee employee = employeeService.get(sysUser.getId());
-        if (StringUtils.isEmpty(organIds)) {
-            organIds=employee.getOrganIdList();
-        }
-        return succeed(employeeService.findAllByRole("37",organIds));
-    }*/
-
     @ApiOperation(value = "获取所选用户离职所需交接信息")
     @GetMapping("/levelDetail")
     @PreAuthorize("@pcs.hasPermissions('employee/levelDetail')")