Pārlūkot izejas kodu

Merge branch 'feature/0425-bugfix' into saas

shangke 2 gadi atpakaļ
vecāks
revīzija
1ca6602ca9

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

@@ -161,6 +161,9 @@ public class SysUser extends BaseEntity implements Serializable{
 
 	private String subjectId;
 
+	@ApiModelProperty(value = "密码重置标识")
+	private Boolean resetFlag;
+
 	public String getSubjectId() {
 		return subjectId;
 	}
@@ -519,4 +522,12 @@ public class SysUser extends BaseEntity implements Serializable{
 	public void setOrganIdList(String organIdList) {
 		this.organIdList = organIdList;
 	}
+
+	public Boolean getResetFlag() {
+		return resetFlag;
+	}
+
+	public void setResetFlag(Boolean resetFlag) {
+		this.resetFlag = resetFlag;
+	}
 }

+ 5 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/CloudCoachPaymentProgramDao.java

@@ -3,8 +3,13 @@ package com.ym.mec.biz.dal.dao;
 import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.biz.dal.entity.CloudCoachPaymentProgram;
 
+import java.util.List;
+import java.util.Map;
+
 public interface CloudCoachPaymentProgramDao extends BaseDAO<Long, CloudCoachPaymentProgram> {
 
 
     CloudCoachPaymentProgram getLock(Long id);
+
+    List<Map<String,String>> queryUser(Map<String, Object> params);
 }

+ 2 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/MusicGroupPaymentCalenderDao.java

@@ -329,4 +329,6 @@ public interface MusicGroupPaymentCalenderDao extends BaseDAO<Long, MusicGroupPa
     List<Map<Long, Integer>> findCooperationByIds(@Param("calenderIds") List<Long> calenderIds);
 
     void updatePaymentNum(@Param("calenderId") Long calenderId, @Param("actualNum") Integer actualNum, @Param("expectNum") Integer expectNum);
+
+    List<Map<String,String>> queryUser(Map<String, Object> params);
 }

+ 14 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/MusicGroupPaymentCalenderResultDto.java

@@ -21,7 +21,20 @@ public class MusicGroupPaymentCalenderResultDto extends MusicGroupPaymentCalende
 
 	private String operatorName;
 
-	@Override
+
+    @ApiModelProperty(value = "审核人", required = false)
+    private String auditName;
+
+
+    public String getAuditName() {
+        return auditName;
+    }
+
+    public void setAuditName(String auditName) {
+        this.auditName = auditName;
+    }
+
+    @Override
 	public Integer getOrganId() {
 		return organId;
 	}

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

@@ -174,6 +174,14 @@ public class MusicGroupPaymentCalender extends BaseEntity {
 	@ApiModelProperty(value = "课程展现形式",required = false)
 	private CourseViewTypeEnum courseViewType;
 
+
+    @ApiModelProperty(value = "审核人", required = false)
+    private Integer audit;
+
+
+    @ApiModelProperty(value = "审核时间", required = false)
+    private Date auditTime;
+
 	//会员有效期(月)
 	//废弃字段
 	private Integer memberValidDate;
@@ -221,7 +229,24 @@ public class MusicGroupPaymentCalender extends BaseEntity {
 	@ApiModelProperty(value = "缴费项目名称", required = false)
 	private String name;
 
-	public String getName() {
+
+    public Integer getAudit() {
+        return audit;
+    }
+
+    public void setAudit(Integer audit) {
+        this.audit = audit;
+    }
+
+    public Date getAuditTime() {
+        return auditTime;
+    }
+
+    public void setAuditTime(Date auditTime) {
+        this.auditTime = auditTime;
+    }
+
+    public String getName() {
 		return name;
 	}
 

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

@@ -13,6 +13,16 @@ public class CloudCoachPaymentProgramQueryInfo extends QueryInfo {
 
     private String status;
 
+    private Integer audit;
+
+    public Integer getAudit() {
+        return audit;
+    }
+
+    public void setAudit(Integer audit) {
+        this.audit = audit;
+    }
+
     public String getOrganId() {
         return organId;
     }

+ 25 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/page/MusicGroupPaymentCalenderQueryInfo.java

@@ -4,6 +4,7 @@ import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender;
 import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PayUserType;
 import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PaymentCalenderStatusEnum;
 import com.ym.mec.common.page.QueryInfo;
+import io.swagger.annotations.ApiModelProperty;
 
 public class MusicGroupPaymentCalenderQueryInfo extends QueryInfo {
 	
@@ -19,7 +20,30 @@ public class MusicGroupPaymentCalenderQueryInfo extends QueryInfo {
 	
 	private String batchNo;
 
-	public MusicGroupPaymentCalender.PaymentType getPaymentType() {
+
+    private Integer audit;
+
+
+    @ApiModelProperty(value = "乐团缴费MUSIC, 云教练CLOUD",required = true)
+    private String type;
+
+    public String getType() {
+        return type;
+    }
+
+    public void setType(String type) {
+        this.type = type;
+    }
+
+    public Integer getAudit() {
+        return audit;
+    }
+
+    public void setAudit(Integer audit) {
+        this.audit = audit;
+    }
+
+    public MusicGroupPaymentCalender.PaymentType getPaymentType() {
 		return paymentType;
 	}
 

+ 6 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/EmployeeService.java

@@ -44,6 +44,12 @@ public interface EmployeeService extends BaseService<Integer, Employee> {
     void updateEmployee(Employee employee);
 
     /**
+     * 修改员工角色
+     * @param employee Employee
+     */
+    void updateEmployeeRole(Employee employee);
+
+    /**
      * 是否有课程组关联的教务老师
      * @param employeeId
      * @return

+ 2 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/MusicGroupPaymentCalenderService.java

@@ -208,4 +208,6 @@ public interface MusicGroupPaymentCalenderService extends BaseService<Long, Musi
 	* @date 2022/3/17 11:16
 	*/
 	Map<Long, Integer>  findCooperationByIds(List<Long> calenderIds);
+
+    Object queryUser(MusicGroupPaymentCalenderQueryInfo queryInfo);
 }

+ 40 - 8
mec-biz/src/main/java/com/ym/mec/biz/service/impl/EmployeeServiceImpl.java

@@ -145,10 +145,17 @@ public class EmployeeServiceImpl extends BaseServiceImpl<Integer, Employee> impl
                 employee.setUserId(user.getId());
                 employee.setId(user.getId());
                 employeeDao.insert(employee);
-                //新增用户角色
-                employeeDao.batchAddEmployeeRole(user.getId(), employee.getRoleIds(), tenantId);
-                //新增用户职位
-                employeePositionService.batchAddPosition(employee.getId(), employee.getPositionIds(), tenantId);
+
+                if (org.apache.commons.collections.CollectionUtils.isNotEmpty(employee.getRoleIds())) {
+                    //新增用户角色
+                    employeeDao.batchAddEmployeeRole(user.getId(), employee.getRoleIds(), tenantId);
+                }
+
+                if (org.apache.commons.collections.CollectionUtils.isNotEmpty(employee.getPositionIds())) {
+
+                    //新增用户职位
+                    employeePositionService.batchAddPosition(employee.getId(), employee.getPositionIds(), tenantId);
+                }
                 employee.setUserType(user.getUserType() + ",SYSTEM");
                 teacherDao.updateUser(employee);
                 return;
@@ -164,10 +171,16 @@ public class EmployeeServiceImpl extends BaseServiceImpl<Integer, Employee> impl
         teacherDao.addSysUser(employee);
         employee.setUserId(employee.getId());
         employeeDao.insert(employee);
-        //新增用户角色
-        employeeDao.batchAddEmployeeRole(employee.getId(), employee.getRoleIds(), tenantId);
-        //新增用户职位
-        employeePositionService.batchAddPosition(employee.getId(), employee.getPositionIds(), tenantId);
+
+        if (org.apache.commons.collections.CollectionUtils.isNotEmpty(employee.getRoleIds())) {
+            //新增用户角色
+            employeeDao.batchAddEmployeeRole(employee.getId(), employee.getRoleIds(), tenantId);
+        }
+
+        if (org.apache.commons.collections.CollectionUtils.isNotEmpty(employee.getPositionIds())) {
+            //新增用户职位
+            employeePositionService.batchAddPosition(employee.getId(), employee.getPositionIds(), tenantId);
+        }
         //添加用户现金账户
         sysUserCashAccountDao.insert(new SysUserCashAccount(employee.getId(), tenantId, "CNY"));
         ImResult imResult = imFeignService.register(new ImUserModel(employee.getId().toString(), employee.getUsername(), null));
@@ -280,6 +293,25 @@ public class EmployeeServiceImpl extends BaseServiceImpl<Integer, Employee> impl
     }
 
     @Override
+    public void updateEmployeeRole(Employee employee) {
+
+        Employee employee1 = employeeDao.get(employee.getId());
+        if (null == employee1) {
+            throw new BizException("员工信息不存在");
+        }
+
+        //新增用户角色
+        Integer tenantId = TenantContextHolder.getTenantId();
+        if(employee.getRoleIds() != null && employee.getRoleIds().size() > 0){
+
+            //删除当前用户角色
+            employeeDao.delEmployeeRole(employee.getId());
+            // 批量新增角色
+            employeeDao.batchAddEmployeeRole(employee.getId(), employee.getRoleIds(), tenantId);
+        }
+    }
+
+    @Override
     public PageInfo queryEmployByOrganId(EmployeeQueryInfo queryInfo) {
         SysUser user = sysUserFeignService.queryUserInfo();
         if (user == null) {

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

@@ -129,6 +129,9 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
     @Autowired
     private MemberFeeSettingService memberFeeSettingService;
 
+    @Autowired
+    private CloudCoachPaymentProgramDao cloudCoachPaymentProgramDao;
+
     @Override
     public BaseDAO<Long, MusicGroupPaymentCalender> getDAO() {
         return musicGroupPaymentCalenderDao;
@@ -930,6 +933,8 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
                 }
                 musicGroupPaymentCalender.setAuditMemo(auditMemo);
                 musicGroupPaymentCalender.setUpdateTime(date);
+                musicGroupPaymentCalender.setAudit(sysUserService.getUserId());
+                musicGroupPaymentCalender.setAuditTime(date);
 
                 if (musicGroupPaymentCalender.getPaymentType() == PaymentType.ADD_STUDENT) {
                     musicGroupPaymentCalender.setExpectNum(1);
@@ -1248,6 +1253,19 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
     }
 
     @Override
+    public Object queryUser(MusicGroupPaymentCalenderQueryInfo queryInfo) {
+        Map<String, Object> params = new HashMap<>();
+        MapUtil.populateMap(params, queryInfo);
+        if ("MUSIC".equals(queryInfo.getType())) {
+            return musicGroupPaymentCalenderDao.queryUser(params);
+        } else if ("CLOUD".equals(queryInfo.getType())) {
+            return cloudCoachPaymentProgramDao.queryUser(params);
+        } else {
+            return null;
+        }
+    }
+
+    @Override
     @Transactional(rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED)
     public boolean autoUpdateMusicGroupPaymentCalenderStatus() {
         Date date = new Date();

+ 15 - 0
mec-biz/src/main/resources/config/mybatis/CloudCoachPaymentProgramMapper.xml

@@ -124,6 +124,9 @@
 			<if test="tenantId != null">
 				AND ccpp.tenant_id_ = #{tenantId}
 			</if>
+            <if test="audit != null">
+                AND ccpp.audit_ = #{audit}
+            </if>
 			<if test="period != null and period != ''">
 				AND ccpp.period_ = #{period}
 			</if>
@@ -160,4 +163,16 @@
 	<select id="getLock" resultMap="CloudCoachPaymentProgram">
 		SELECT * FROM cloud_coach_payment_program WHERE id_ = #{id} FOR UPDATE
 	</select>
+
+	<select id="queryUser" resultType="java.util.Map">
+        SELECT distinct mgpc.audit_ as audit,su.real_name_ as auditName
+        FROM cloud_coach_payment_program mgpc
+        left join sys_user su on mgpc.audit_ = su.id_
+        <where>
+            mgpc.audit_ is not null
+            <if test="organId != null and organId != ''">
+                AND FIND_IN_SET(mgpc.organ_id_,#{organId})
+            </if>
+        </where>
+    </select>
 </mapper>

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

@@ -45,6 +45,8 @@
         <result column="calender_fee_type_" property="calenderFeeType"/>
         <result column="calender_fee_json_" property="calenderFeeJson"/>
         <result column="contract_url_" property="contractUrl"/>
+        <result column="auditTime" property="auditTime"/>
+        <result column="audit" property="audit"/>
     </resultMap>
 
     <!-- 根据主键查询一条记录 -->
@@ -265,6 +267,12 @@
 	            <if test="item.isShowSalePrice != null">
 	                is_show_sale_price_ = #{item.isShowSalePrice},
 	            </if>
+                <if test="item.audit != null">
+                    audit = #{item.audit},
+                </if>
+                <if test="item.auditTime != null">
+                    audit_time = #{item.auditTime},
+                </if>
 	        </set>
 	        WHERE id_ = #{item.id} and tenant_id_ = #{item.tenantId}
 		</foreach>
@@ -675,6 +683,9 @@
             <if test="tenantId != null">
                 AND mgpc.tenant_id_ = #{tenantId}
             </if>
+            <if test="audit != null">
+                AND mgpc.audit = #{audit}
+            </if>
         </where>
     </sql>
     <select id="countCalender" resultType="java.lang.Integer">
@@ -687,15 +698,17 @@
                extends="MusicGroupPaymentCalender">
         <result column="music_group_name_" property="musicGroupName"/>
         <result column="operator_name_" property="operatorName"/>
+        <result column="auditName" property="auditName"/>
     </resultMap>
     <select id="queryCalenderPage" resultMap="MusicGroupPaymentCalenderResultDto">
         SELECT mgpc.id_,mgpc.music_group_id_,mgpc.music_group_organization_course_settings_id_,mgpc.pay_user_type_,mgpc.reject_reason_,
         mgpc.start_payment_date_,mgpc.deadline_payment_date_,mgpc.status_,mgpc.expect_num_,
         mgpc.actual_num_,mgpc.memo_,mgpc.create_time_,mgpc.update_time_,
         mgpc.payment_pattern_,mgpc.payment_type_,mgpc.batch_no_,mgpc.audit_memo_,mgpc.operator_,mgpc.attribute1_,
-        mgpc.attribute2_,mgpc.student_ids_,mgpc.current_total_amount_,mgpc.original_total_amount_,mg.name_ music_group_name_,mgpc.organ_id_
+        mgpc.attribute2_,mgpc.student_ids_,mgpc.current_total_amount_,mgpc.original_total_amount_,mg.name_ music_group_name_,mgpc.organ_id_,mgpc.audit,mgpc.audit_time auditTime,su.real_name_  auditName
         FROM music_group_payment_calender mgpc
         LEFT JOIN music_group mg ON mg.id_ = mgpc.music_group_id_
+        left join sys_user su on su.id_ = mgpc.audit
         <include refid="queryCalenderPageSql"/>
         ORDER BY mgpc.id_ DESC
         <include refid="global.limit"/>
@@ -716,4 +729,16 @@
             #{id}
         </foreach>
     </select>
+
+    <select id="queryUser" resultType="java.util.Map">
+        SELECT distinct mgpc.audit as audit,su.real_name_ as auditName
+        FROM music_group_payment_calender mgpc
+        left join sys_user su on mgpc.audit = su.id_
+        <where>
+            mgpc.audit is not null
+            <if test="organId != null and organId != ''">
+                AND FIND_IN_SET(mgpc.organ_id_,#{organId})
+            </if>
+        </where>
+    </select>
 </mapper>

+ 26 - 1
mec-web/src/main/java/com/ym/mec/web/controller/EmployeeController.java

@@ -7,6 +7,7 @@ import com.ym.mec.biz.dal.dto.EmployeeLevelDto;
 import com.ym.mec.biz.dal.dto.SysEmployeePositionDto;
 import com.ym.mec.biz.dal.entity.Employee;
 import com.ym.mec.biz.dal.enums.EmployeeOperateEnum;
+import com.ym.mec.biz.dal.enums.ParamEnum;
 import com.ym.mec.biz.dal.page.EmployeeQueryInfo;
 import com.ym.mec.biz.dal.page.UserBasicQueryInfo;
 import com.ym.mec.biz.service.EmployeeService;
@@ -21,6 +22,7 @@ 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.security.crypto.bcrypt.BCryptPasswordEncoder;
 import org.springframework.web.bind.annotation.*;
 
 import java.util.Date;
@@ -128,6 +130,16 @@ public class EmployeeController extends BaseController {
         return succeed();
     }
 
+    @ApiOperation(value = "修改员工角色")
+    @PostMapping("/updateRole")
+    @PreAuthorize("@pcs.hasPermissions('employee/updateRole')")
+    public Object updateRole(@RequestBody Employee employee) {
+        TenantContextHolder.setTenantId(employee.getTenantId());
+        employee.setUpdateTime(new Date());
+        employeeService.updateEmployeeRole(employee);
+        return succeed();
+    }
+
     @ApiOperation(value = "修改员工")
     @PostMapping("/simpleUpdate")
     @PreAuthorize("@pcs.hasPermissions('employee/simpleUpdate')")
@@ -174,11 +186,24 @@ public class EmployeeController extends BaseController {
             sysUser.setOpenBankAddress(employee.getOpenBankAddress());
             sysUser.setPostDeptIds(employee.getPostDeptIds());
             sysUser.setOrganIdList(employee.getOrganIdList());
+
+            // 默认初始密钥
+            int phoneStrLen = sysUser.getPhone().length();
+            String defaultPassword = "gym" + sysUser.getPhone().substring(phoneStrLen - 4, phoneStrLen);
+            // 密码重置标识
+            sysUser.setResetFlag(false);
+
+            String password = sysUser.getPassword();
+            if (StringUtils.isNotBlank(password)
+                    && (new BCryptPasswordEncoder().matches(ParamEnum.INIT_PASSWORD.getCode().toString(), password)
+                    || new BCryptPasswordEncoder().matches(defaultPassword, password))) {
+                sysUser.setResetFlag(true);
+            }
             
             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(",")));
+                sysUser.setPositionName(sysEmployeePositionDtoList.stream().map(SysEmployeePositionDto :: getPositionName).collect(Collectors.joining(",")));
             }
             return succeed(sysUser);
         }

+ 8 - 0
mec-web/src/main/java/com/ym/mec/web/controller/MusicGroupPaymentCalenderController.java

@@ -50,6 +50,14 @@ public class MusicGroupPaymentCalenderController extends BaseController {
         return succeed(musicGroupPaymentCalenderService.queryCalenderPage(queryInfo));
     }
 
+
+    @ApiOperation(value = "查询审核人")
+    @GetMapping(value = "/queryUser")
+    public Object queryUser(MusicGroupPaymentCalenderQueryInfo queryInfo) {
+        queryInfo.setOrganId(organizationService.getEmployeeOrgan(queryInfo.getOrganId()));
+        return succeed(musicGroupPaymentCalenderService.queryUser(queryInfo));
+    }
+
     @ApiOperation(value = "获取缴费信息")
     @GetMapping("/getDetail")
     @PreAuthorize("@pcs.hasPermissions('musicGroupPaymentCalender/getDetail')")