提交修改

This commit is contained in:
quyixiao 2020-09-22 17:08:26 +08:00
commit a6ef4bd937
10 changed files with 51 additions and 35 deletions

View File

@ -8,6 +8,8 @@ import com.dingtalk.api.DingTalkClient;
import com.dingtalk.api.request.*;
import com.dingtalk.api.response.*;
import com.lz.modules.app.entity.StaffEntity;
import com.lz.modules.app.entity.StaffOccupationEntity;
import com.lz.modules.app.service.StaffOccupationService;
import com.lz.modules.app.service.StaffService;
import com.lz.modules.job.model.responseBo.DepartmentInfosBo;
import com.lz.modules.job.model.responseBo.DepartmentStaffBo;
@ -55,6 +57,9 @@ public class DingTalkUtil {
@Autowired
private SysUserTokenService sysUserTokenService;
@Autowired
StaffOccupationService staffOccupationService;
CloseableHttpClient getHttpClient(){
@ -325,20 +330,26 @@ public class DingTalkUtil {
if(json.getIntValue("errcode") == 0){
String employeeId = json.getString("userid");
StaffEntity staffEntity = staffService.selectStaffByEmployeeId(employeeId);
if(staffEntity != null){
//登录操作
SysUserEntity user = new SysUserEntity();
user.setPassword(staffEntity.getPassword());
user.setMobile(staffEntity.getMobile());
user.setUserId(staffEntity.getId());
user.setEmail(staffEntity.getEmail());
user.setSalt(staffEntity.getSalt());
user.setStatus(1);
user.setType(1);
user.setRealName(staffEntity.getName());
user.setUsername(staffEntity.getMobile());
user.setUserNo(staffEntity.getMobile());
return sysUserTokenService.createTokenSetTokenCode(user, code);
StaffOccupationEntity staffOccupationEntity =
staffOccupationService.getStaffOccupationByStaffId(staffEntity.getId());
if(staffOccupationEntity != null && staffOccupationEntity.getStaffStatus() == 0){
//登录操作
SysUserEntity user = new SysUserEntity();
user.setPassword(staffEntity.getPassword());
user.setMobile(staffEntity.getMobile());
user.setUserId(staffEntity.getId());
user.setEmail(staffEntity.getEmail());
user.setSalt(staffEntity.getSalt());
user.setStatus(1);
user.setType(1);
user.setRealName(staffEntity.getName());
user.setUsername(staffEntity.getMobile());
user.setUserNo(staffEntity.getMobile());
return sysUserTokenService.createTokenSetTokenCode(user, code);
}
}
return R.error("用户不存在");
}

View File

@ -64,8 +64,6 @@ public class ShiroConfig {
filterMap.put("/captcha.jpg", "anon");
filterMap.put("/aaa.txt", "anon");
filterMap.put("/dtlg/login", "anon");
filterMap.put("/oneCode/**", "anon");
filterMap.put("/modules/**", "anon");//临时添加后期去掉
filterMap.put("/dtlg/luck", "anon");
filterMap.put("/dtlg/look", "anon");
filterMap.put("/dtlg/jump", "anon");

View File

@ -54,19 +54,20 @@ public class ReportResultController extends AbstractController{
@RequestMapping("chart")
public R reportChart(String monthTime,String departmentId){
if(StringUtil.isBlank(monthTime)){
monthTime = YearMonth.now().toString();
public R reportChart(String selectMonthTime,String departmentId){
if(StringUtil.isBlank(selectMonthTime)){
selectMonthTime = YearMonth.now().toString();
}
ReportChartResp data = new ReportChartResp();
//月初目标
List<GraphicsStatisticalDto> start = chartService.resultProgressDistribution(ResultRecordTypeEnum.TARGET.getType(),monthTime,departmentId);
List<GraphicsStatisticalDto> start = chartService.resultProgressDistribution(ResultRecordTypeEnum.TARGET.getType(),selectMonthTime,departmentId);
//月末结果
List<GraphicsStatisticalDto> end = chartService.resultProgressDistribution(ResultRecordTypeEnum.RESULT.getType(),monthTime,departmentId);
List<GraphicsStatisticalDto> end = chartService.resultProgressDistribution(ResultRecordTypeEnum.RESULT.getType(),selectMonthTime,departmentId);
//人员等级分布
List<String> allDeparmentIds = staffService.selectAllDeparmentIdsByDepartmentParentId(departmentId);
int total = staffService.countStaffByAllDeparmentIds(allDeparmentIds);
List<GraphicsStatisticalDto> staffLevels = resultRecordService.staffDistribution(monthTime);
List<String> strings = staffService.staffsByAllDeparmentIds(allDeparmentIds);
int total = strings.size();
List<GraphicsStatisticalDto> staffLevels = resultRecordService.staffDistribution(selectMonthTime,strings);
List<String> names = new ArrayList<>();
List<Double> datas = new ArrayList<>();
int konwn = 0;
@ -90,7 +91,6 @@ public class ReportResultController extends AbstractController{
barDto.setDatas(datas);
barDto.setTotal(total);
data.setStaffDistribution(barDto);
data.setMonthTime(YearMonth.now().toString());
return R.ok().put("data",data);
}

View File

@ -80,8 +80,8 @@ public interface StaffService extends IService<StaffEntity> {
//查询部门下的所有子部门
List<String> selectAllDeparmentIdsByDepartmentParentId(String departmentId);
//统计部门下的人
int countStaffByAllDeparmentIds(List<String> deparmentIds);
//统计部门下的人
List<String> staffsByAllDeparmentIds(List<String> deparmentIds);
List<StaffEntity> selectAll();
}

View File

@ -404,9 +404,9 @@ public class StaffServiceImpl extends ServiceImpl<StaffDao, StaffEntity> impleme
@Override
public int countStaffByAllDeparmentIds(List<String> deparmentIds) {
public List<String> staffsByAllDeparmentIds(List<String> deparmentIds) {
if(CollectionUtils.isEmpty(deparmentIds)){
return 0;
return Lists.newArrayList();
}
//获取所有子部门
List<DepartmentsStaffRelateEntity> list = departmentsStaffRelateService.list(new QueryWrapper<DepartmentsStaffRelateEntity>()
@ -414,12 +414,12 @@ public class StaffServiceImpl extends ServiceImpl<StaffDao, StaffEntity> impleme
.eq("is_delete", 0)
.in("department_id", deparmentIds));
if(CollectionUtils.isEmpty(list)){
return 0;
return Lists.newArrayList();
}
//获取人员个数去重
List<String> staffs = list.stream().map(e -> e.getStaffId() + "").collect(Collectors.toList());
List<String> staffdistincts = staffs.stream().distinct().collect(Collectors.toList());
return staffdistincts.size();
return staffdistincts;
}

View File

@ -54,7 +54,7 @@ public interface ResultRecordMapper extends BaseMapper<ResultRecord> {
List<OwnResultResp> ownResult(@Param("userId") Long userId, @Param("status") int status);
List<GraphicsStatisticalDto> staffDistribution(@Param("monthTime") String monthTime);
List<GraphicsStatisticalDto> staffDistribution(@Param("monthTime") String monthTime,@Param("staffIds") List<String> staffIds);
ResultRecord selectResultRecordByStaffIdStatus(@Param("staffId") Long staffId, @Param("status") int status);
}

View File

@ -79,7 +79,7 @@ public interface ResultRecordService extends IService<ResultRecord> {
* @param monthTime
* @return
*/
List<GraphicsStatisticalDto> staffDistribution(String monthTime);
List<GraphicsStatisticalDto> staffDistribution(String monthTime,List<String> staffIds);
Map<String, List<DepartmentsEntity>> getStringListMap(List<DepartmentsEntity> tDepartments);

View File

@ -30,7 +30,7 @@ public class ChartServiceImpl implements ChartService {
List<GraphicsStatisticalDto> dtos = new ArrayList<>();
//获取所有人员总数
List<String> allDeparmentIds = staffService.selectAllDeparmentIdsByDepartmentParentId(departmentId);
int total = staffService.countStaffByAllDeparmentIds(allDeparmentIds);
int total = staffService.staffsByAllDeparmentIds(allDeparmentIds).size();
//已提交
int commit = resultRecordService.count(new QueryWrapper<ResultRecord>()
.eq("is_delete", 0)

View File

@ -691,7 +691,8 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
}
@Override
public List<GraphicsStatisticalDto> staffDistribution(String monthTime) {
return resultRecordMapper.staffDistribution(monthTime);
public List<GraphicsStatisticalDto> staffDistribution(String monthTime,List<String> staffIds) {
return resultRecordMapper.staffDistribution(monthTime,staffIds);
}
}

View File

@ -265,7 +265,13 @@
</select>
<select id="staffDistribution" resultType="com.lz.modules.app.dto.GraphicsStatisticalDto">
SELECT count(score_level) number ,score_level category from lz_result_record where is_delete = 0 and status =4 and type =2 and score_level !=0 and DATE_FORMAT(month_time,'%Y-%m') = #{monthTime} GROUP BY score_level
SELECT count(score_level) number ,score_level category from lz_result_record where
is_delete = 0 and status =4 and type =2 and score_level !=0 and DATE_FORMAT(month_time,'%Y-%m') = #{monthTime}
and staff_id in
<foreach collection="staffIds" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
GROUP BY score_level
</select>