Merge branch 'version_report' of http://gitlab.ldxinyong.com/enterpriseManagement/lz_management into version_report

This commit is contained in:
杜建超 2020-09-29 19:31:52 +08:00
commit ea287c6ae3
8 changed files with 88 additions and 21 deletions

View File

@ -264,13 +264,16 @@ public class ResultRecordController extends AbstractController {
}
String superStaff = recordAuthService.selectByStaffId(resultRecord.getStaffId());
int fileCount = recordFileService.selectRecordFileCountByRecordId(resultRecord.getId());
//表示是自己查看详情
if(resultRecord.getStaffId().equals(getUserId())){
List<FlowRecord> flowRecords = flowRecordService.selectFlowRecordByResultRecordIdTypeStatus(req.getRecordResultId(),resultRecord.getType(),0);
if(flowRecords!=null && flowRecords.size() == 2) { // 表示可以撤回
List<FlowRecord> flowRecords = flowRecordService.selectFlowRecordByResultRecordIdTypeStatus(req.getRecordResultId(), resultRecord.getType(), 0);
if (flowRecords != null && flowRecords.size() == 2) { // 表示可以撤回
auth.setCancel(1);
}
if(flowRecords!=null && flowRecords.size() >= 2){
// 审批人是自己不提供催办按钮,流程结束不显示
if (flowRecords != null && flowRecords.size() >= 2 &&
!getUserId().equals(resultRecord.getCurrentApprovalStaffId()) &&
resultRecord.getCurrentApprovalStaffId() != null) {
auth.setSubmited(1);
}
}
@ -601,6 +604,22 @@ public class ResultRecordController extends AbstractController {
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/addRecordAjudex")
public R addRecordAjudex(String type) {
ResultRecord resultRecord = resultRecordService.selectCurrentMonthResultRecordByStaffIdType(getUserId(),NumberUtil.objToIntDefault(type,2));
if(resultRecord !=null){
return R.error("当月己经存在绩效,请编辑。");
}
return R.ok();
}
/**
* 删除
*/

View File

@ -40,4 +40,6 @@ public interface StaffRoleDepartmentMapper extends BaseMapper<StaffRoleDepartmen
StaffRoleDepartment selectStaffRoleDepartmentByDepartmentIdRoleIds(@Param("departmentId") Long departmentId, @Param("ids") List<Long> ids);
void deleteStaffRoleDepartment(@Param("id") Long id);
List<StaffRoleDepartment> selectStaffRoleDepartmentByStaffRoleIdDepartments(@Param("staffRoleId") Long staffRoleId, @Param("departments") List<String> departments);
}

View File

@ -11,6 +11,7 @@ import com.lz.modules.app.dto.StaffRoleResp;
import com.lz.modules.app.entity.DepartmentsEntity;
import com.lz.modules.app.entity.DepartmentsStaffRelateEntity;
import com.lz.modules.app.entity.StaffEntity;
import com.lz.modules.app.service.DepartmentsService;
import com.lz.modules.app.service.DepartmentsStaffRelateService;
import com.lz.modules.flow.dao.RecordRoleMapper;
import com.lz.modules.flow.dao.StaffRoleDepartmentMapper;
@ -69,6 +70,9 @@ public class StaffRoleServiceImpl extends ServiceImpl<StaffRoleMapper, StaffRole
@Autowired
private RecordRoleService recordRoleService;
@Autowired
private DepartmentsService departmentsService;
@Autowired
private DepartmentsStaffRelateService departmentsStaffRelateService;
@ -176,12 +180,15 @@ public class StaffRoleServiceImpl extends ServiceImpl<StaffRoleMapper, StaffRole
Map<String,List<DepartmentsEntity>> map= resultRecordService.getStringListMap(departmentsEntities);
role.setRoleId(staffRole.getId());
role.setRoleName(staffRole.getDepartmentLevel());
for(StaffRoleDepartment staffRoleDepartment: staffRoleDepartments){
List<DepartmentsEntity> list = map.get(staffRoleDepartment.getDepartmentId());
if(list == null || list.size() == 0){
menuIdList.add(NumberUtil.objToLongDefault(staffRoleDepartment.getDepartmentId(),0l));
}else{
menuIdList1.add(NumberUtil.objToLongDefault(staffRoleDepartment.getDepartmentId(),0l));
List<String> departments = departmentsService.selectAllChildDepartmentIds(staffRoleDepartment.getDepartmentId());
List<StaffRoleDepartment> departments1 = staffRoleDepartmentMapper.selectStaffRoleDepartmentByStaffRoleIdDepartments(staffRole.getId(), departments);
if (list == null || list.size() == 0 || departments1.size() <= 1) {
menuIdList.add(NumberUtil.objToLongDefault(staffRoleDepartment.getDepartmentId(), 0l));
} else {
menuIdList1.add(NumberUtil.objToLongDefault(staffRoleDepartment.getDepartmentId(), 0l));
}
}
}
@ -200,7 +207,9 @@ public class StaffRoleServiceImpl extends ServiceImpl<StaffRoleMapper, StaffRole
.collect(Collectors.toList());
List<DepartmentsStaffRelateEntity> departmentsStaffRelateEntities = departmentsStaffRelateService.selectAll();
Map<String,DepartmentsStaffRelateEntity> departmentsStaffRelateEntityMap = new HashMap<>();
Map<String,DepartmentsStaffRelateEntity> singleDepartmentsStaffRelate = new HashMap<>();
for(DepartmentsStaffRelateEntity d : departmentsStaffRelateEntities){
singleDepartmentsStaffRelate.put(d.getDepartmentId(),d);
if(new Integer(1).equals(d.getIsLeader())){
departmentsStaffRelateEntityMap.put(d.getDepartmentId(),d);
}
@ -212,34 +221,44 @@ public class StaffRoleServiceImpl extends ServiceImpl<StaffRoleMapper, StaffRole
}
List<SysMenuEntity> list = new ArrayList<>();
for (DepartmentsEntity d : parentDepartments) {
String departmentName = d.getDepartmentName() + getSuffix(departmentsStaffRelateEntityMap,staffMap,d.getDepartmentId());
String departmentName = d.getDepartmentName() + getSuffix(departmentsStaffRelateEntityMap,staffMap,d.getDepartmentId(),singleDepartmentsStaffRelate);
SysMenuEntity entity = recordRoleService.buildMenuEntity(NumberUtil.objToLongDefault(d.getDepartmentId(), 0l),departmentName , 0l, "");
getMenuList(tDepartments, entity, list,departmentsStaffRelateEntityMap,staffMap);
getMenuList(tDepartments, entity, list,departmentsStaffRelateEntityMap,staffMap,singleDepartmentsStaffRelate);
list.add(entity);
}
return list;
}
public String getSuffix(Map<String,DepartmentsStaffRelateEntity> departmentsStaffRelateEntityMap, Map<Long ,StaffEntity> staffMap,String departmentId){
String suffix = "";
public String getSuffix(Map<String, DepartmentsStaffRelateEntity> departmentsStaffRelateEntityMap, Map<Long, StaffEntity> staffMap, String departmentId,
Map<String, DepartmentsStaffRelateEntity> singleDepartmentsStaffRelate) {
DepartmentsStaffRelateEntity departmentsStaffRelateEntity = departmentsStaffRelateEntityMap.get(departmentId);
if(departmentsStaffRelateEntity !=null){
StaffEntity staffEntity = staffMap.get(departmentsStaffRelateEntity.getStaffId());
if(staffEntity !=null ){
suffix = " , "+staffEntity.getName();
}
if (departmentsStaffRelateEntity != null) {
return doGetStaff(departmentsStaffRelateEntity, staffMap);
} else {
return doGetStaff(singleDepartmentsStaffRelate.get(departmentId), staffMap);
}
return suffix;
}
public String doGetStaff(DepartmentsStaffRelateEntity departmentsStaffRelateEntity, Map<Long, StaffEntity> staffMap) {
if (departmentsStaffRelateEntity != null) {
StaffEntity staffEntity = staffMap.get(departmentsStaffRelateEntity.getStaffId());
if (staffEntity != null) {
return " , " + staffEntity.getName();
}
}
return " ";
}
public void getMenuList(List<DepartmentsEntity> tDepartments,SysMenuEntity sysMenuEntity,List<SysMenuEntity> list,
Map<String,DepartmentsStaffRelateEntity> departmentsStaffRelateEntityMap, Map<Long ,StaffEntity> staffMap) {
Map<String,DepartmentsStaffRelateEntity> departmentsStaffRelateEntityMap, Map<Long ,StaffEntity> staffMap,
Map<String,DepartmentsStaffRelateEntity> singleDepartmentsStaffRelate) {
for(DepartmentsEntity child : tDepartments) {
if(NumberUtil.objToLongDefault(child.getDepartmentParentId(),0l).equals(sysMenuEntity.getMenuId())){
String departmentName = child.getDepartmentName() + getSuffix(departmentsStaffRelateEntityMap,staffMap,child.getDepartmentId());
String departmentName = child.getDepartmentName() + getSuffix(departmentsStaffRelateEntityMap,staffMap,child.getDepartmentId(),singleDepartmentsStaffRelate);
SysMenuEntity entity = recordRoleService.buildMenuEntity(NumberUtil.objToLongDefault(child.getDepartmentId(),0l),
departmentName,sysMenuEntity.getMenuId(),sysMenuEntity.getName());
getMenuList(tDepartments,entity,list,departmentsStaffRelateEntityMap,staffMap);
getMenuList(tDepartments,entity,list,departmentsStaffRelateEntityMap,staffMap,singleDepartmentsStaffRelate);
list.add(entity);
}
}

View File

@ -65,4 +65,6 @@ public interface ResultRecordMapper extends BaseMapper<ResultRecord> {
List<ReportProgressListDto> targetReportList(@Param("req")ReportListReq req, @Param("staffIds") List<String> staffIds,@Param("page") IPage page);
ResultRecord selectLastResultRecordByStaffIdType(@Param("staffId") Long staffId, @Param("type") int type);
ResultRecord selectCurrentMonthResultRecordByStaffIdType(@Param("staffId") Long staffId, @Param("type") int type);
}

View File

@ -96,4 +96,6 @@ public interface ResultRecordService extends IService<ResultRecord> {
DepartmentsStaffRelateEntity getLeaderDepartmentsStaffRelateEntity(Long staffId);
ResultRecord selectLastResultRecordByStaffIdType(Long staffId, int type);
ResultRecord selectCurrentMonthResultRecordByStaffIdType(Long staffId, int type);
}

View File

@ -329,6 +329,11 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
return resultRecordMapper.selectLastResultRecordByStaffIdType(staffId,type);
}
@Override
public ResultRecord selectCurrentMonthResultRecordByStaffIdType(Long staffId, int type) {
return resultRecordMapper.selectCurrentMonthResultRecordByStaffIdType(staffId,type);
}
@Override
public ResultRecord createResultRecord(Long staffId, int type, Long roleId) {

View File

@ -331,6 +331,10 @@
select * from lz_result_record where is_delete = 0 and staff_id = #{staffId} and type = #{type} order by id desc limit 1
</select>
<select id="selectCurrentMonthResultRecordByStaffIdType" resultType="com.lz.modules.sys.entity.app.ResultRecord">
select * from lz_result_record where is_delete = 0 and staff_id = #{staffId} and type = #{type} and DATE_FORMAT(month_time,'%Y-%m') = DATE_FORMAT(now(),'%Y-%m') order by id desc limit 1
</select>
</mapper>

View File

@ -79,6 +79,9 @@
<select id="selectStaffRoleDepartmentByStaffRoleId" resultType="com.lz.modules.flow.entity.StaffRoleDepartment">
select * from lz_staff_role_department where staff_role_id=#{staffRoleId} and is_delete = 0
</select>
<select id="selectStaffRoleDepartmentByDepartmentId"
resultType="com.lz.modules.flow.entity.StaffRoleDepartment">
select * from lz_staff_role_department where department_id=#{departmentId} and is_delete = 0
@ -93,9 +96,20 @@
</foreach>
</select>
<delete id="deleteStaffRoleDepartment">
delete from lz_staff_role_department where id = #{id}
</delete>
<select id="selectStaffRoleDepartmentByStaffRoleIdDepartments"
resultType="com.lz.modules.flow.entity.StaffRoleDepartment">
select * from lz_staff_role_department where staff_role_id=#{staffRoleId} and is_delete = 0
and department_id in
<foreach collection="departments" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</select>
</mapper>