|
@@ -2,6 +2,7 @@ package com.jpsoft.shinestar.modules.mobile.controller;
|
|
|
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
import cn.hutool.core.date.Week;
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
|
import com.alipay.api.domain.Person;
|
|
|
import com.github.pagehelper.Page;
|
|
|
import com.jpsoft.shinestar.modules.base.dto.CompanyAndPersonDTO;
|
|
@@ -27,6 +28,7 @@ import org.springframework.format.annotation.DateTimeFormat;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import java.util.*;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* @author 墨鱼_mo
|
|
@@ -44,6 +46,9 @@ public class AdjustShiftApiController {
|
|
|
@Autowired
|
|
|
private PersonPopedomService personPopedomService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private PersonCompanyService personCompanyService;
|
|
|
+
|
|
|
@Autowired
|
|
|
private WorkScheduleAttendanceService workScheduleAttendanceService;
|
|
|
|
|
@@ -186,12 +191,12 @@ public class AdjustShiftApiController {
|
|
|
PersonPopedom personPopedom = personPopedomService.get(person.getPopedom());
|
|
|
CompanyInfo companyInfo = companyInfoService.get(personPopedom.getCompanyId());
|
|
|
|
|
|
- List<CompanyInfo> companyInfoList = companyInfoService.findAllCompanyByCode(companyInfo.getCode()+"%");
|
|
|
+ List<CompanyInfo> companyInfoList = companyInfoService.findAllCompanyByCode(companyInfo.getCode() + "%");
|
|
|
List<String> companyIdList = Arrays.asList(companyInfo.getCode().split(","));
|
|
|
- if (companyIdList.size()>0){
|
|
|
- for (String id : companyIdList){
|
|
|
+ if (companyIdList.size() > 0) {
|
|
|
+ for (String id : companyIdList) {
|
|
|
CompanyInfo companyInfo1 = companyInfoService.get(id);
|
|
|
- if (!companyInfoList.contains(companyInfo1)){
|
|
|
+ if (!companyInfoList.contains(companyInfo1)) {
|
|
|
companyInfoList.add(companyInfo1);
|
|
|
}
|
|
|
}
|
|
@@ -214,7 +219,7 @@ public class AdjustShiftApiController {
|
|
|
ownerShiftDTO.setName(workShiftInfo.getNumber() + "-" + workShiftInfo.getName() + " " + workShiftInfo.getWorkTime() + "-" + workShiftInfo.getClosingTime());
|
|
|
ownerShiftDTO.setWorkTime(workShiftInfo.getWorkTime());
|
|
|
ownerShiftDTO.setClosingTime(workShiftInfo.getClosingTime());
|
|
|
- if (!list.contains(ownerShiftDTO)){
|
|
|
+ if (!list.contains(ownerShiftDTO)) {
|
|
|
list.add(ownerShiftDTO);
|
|
|
}
|
|
|
|
|
@@ -245,7 +250,6 @@ public class AdjustShiftApiController {
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
@ApiOperation(value = "申请批量补卡选择到时间")
|
|
|
@PostMapping(value = "allShift")
|
|
|
public MessageResult<Map> allShift(String token, @RequestAttribute String subject) {
|
|
@@ -261,14 +265,14 @@ public class AdjustShiftApiController {
|
|
|
List<WorkShiftInfo> workShiftInfoList = workShiftInfoService.list();
|
|
|
|
|
|
List<OwnerShiftDTO> list = new ArrayList<>();
|
|
|
- if (workShiftInfoList.size()>0){
|
|
|
- for (WorkShiftInfo workShiftInfo : workShiftInfoList){
|
|
|
+ if (workShiftInfoList.size() > 0) {
|
|
|
+ for (WorkShiftInfo workShiftInfo : workShiftInfoList) {
|
|
|
OwnerShiftDTO ownerShiftDTO = new OwnerShiftDTO();
|
|
|
ownerShiftDTO.setId(workShiftInfo.getId());
|
|
|
ownerShiftDTO.setName(workShiftInfo.getNumber() + "-" + workShiftInfo.getName() + " " + workShiftInfo.getWorkTime() + "-" + workShiftInfo.getClosingTime());
|
|
|
ownerShiftDTO.setWorkTime(workShiftInfo.getWorkTime());
|
|
|
ownerShiftDTO.setClosingTime(workShiftInfo.getClosingTime());
|
|
|
- if (!list.contains(ownerShiftDTO)){
|
|
|
+ if (!list.contains(ownerShiftDTO)) {
|
|
|
list.add(ownerShiftDTO);
|
|
|
}
|
|
|
}
|
|
@@ -292,10 +296,55 @@ public class AdjustShiftApiController {
|
|
|
}
|
|
|
|
|
|
|
|
|
+ @ApiOperation(value = "根据条件获取审核人能使用的模板")
|
|
|
+ @PostMapping(value = "processTemplateList")
|
|
|
+ public MessageResult<Map> examinePerson(String token, @RequestAttribute String subject, String formId) {
|
|
|
+
|
|
|
+
|
|
|
+ MessageResult<Map> messageResult = new MessageResult<>();
|
|
|
+ try {
|
|
|
+
|
|
|
+ PersonInfo person = personInfoService.get(Long.parseLong(subject));
|
|
|
+ PersonPopedom personPopedom = personPopedomService.get(person.getPopedom());
|
|
|
+
|
|
|
+
|
|
|
+ if (StringUtils.isBlank(formId)) {
|
|
|
+ throw new Exception("缺乏业务关键字");
|
|
|
+ }
|
|
|
+ List<ProcessTemplate> list = new ArrayList<>();
|
|
|
+
|
|
|
+ List<TemplateDepartment> templateDepartments = templateDepartmentService.findByFormIdDepartmentId(formId, personPopedom.getCompanyId(), personPopedom.getPersonRoleId());
|
|
|
+ if (templateDepartments.size() == 0) {
|
|
|
+ throw new Exception("您的部门没有相应流程模板");
|
|
|
+ }
|
|
|
+ for (TemplateDepartment templateDepartment : templateDepartments){
|
|
|
+ ProcessTemplate processTemplate = processTemplateService.get(templateDepartment.getProcessTemplateId());
|
|
|
+ if (!list.contains(processTemplate)){
|
|
|
+ list.add(processTemplate);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ map.put("list", list);
|
|
|
+ messageResult.setData(map);
|
|
|
+ messageResult.setCode(200);
|
|
|
+ messageResult.setResult(true);
|
|
|
+ } catch (Exception ex) {
|
|
|
+ log.error(ex.getMessage(), ex);
|
|
|
+ messageResult.setCode(400);
|
|
|
+ messageResult.setMessage(ex.getMessage());
|
|
|
+ messageResult.setResult(false);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ return messageResult;
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
@ApiOperation(value = "根据条件获取审核人")
|
|
|
@PostMapping(value = "examinePerson")
|
|
|
- public MessageResult<Map> examinePerson(String token, @RequestAttribute String subject, String formId,String days) {
|
|
|
+ public MessageResult<Map> examinePerson(String token, @RequestAttribute String subject, String formId, String processTemplateId, String days) {
|
|
|
|
|
|
|
|
|
MessageResult<Map> messageResult = new MessageResult<>();
|
|
@@ -304,20 +353,26 @@ public class AdjustShiftApiController {
|
|
|
PersonInfo person = personInfoService.get(Long.parseLong(subject));
|
|
|
PersonPopedom personPopedom = personPopedomService.get(person.getPopedom());
|
|
|
|
|
|
- if (StringUtils.isBlank(formId)) {
|
|
|
+
|
|
|
+ if (StringUtils.isBlank(formId) && StrUtil.isBlank(processTemplateId)) {
|
|
|
throw new Exception("缺乏业务关键字");
|
|
|
}
|
|
|
|
|
|
- TemplateDepartment templateDepartment = templateDepartmentService.findByFormIdDepartmentId(formId, personPopedom.getCompanyId(),personPopedom.getPersonRoleId());
|
|
|
- if (templateDepartment == null) {
|
|
|
- throw new Exception("您的部门没有相应流程模板");
|
|
|
+
|
|
|
+ if (StrUtil.isBlank(processTemplateId)) {
|
|
|
+ List<TemplateDepartment> templateDepartments = templateDepartmentService.findByFormIdDepartmentId(formId, personPopedom.getCompanyId(), personPopedom.getPersonRoleId());
|
|
|
+ if (templateDepartments.size() == 0) {
|
|
|
+ throw new Exception("您的部门没有相应流程模板");
|
|
|
+ }
|
|
|
+ TemplateDepartment templateDepartment = templateDepartments.get(0);
|
|
|
+ processTemplateId = templateDepartment.getProcessTemplateId();
|
|
|
}
|
|
|
|
|
|
|
|
|
- ProcessTemplate processTemplate = processTemplateService.get(templateDepartment.getProcessTemplateId());
|
|
|
+ ProcessTemplate processTemplate = processTemplateService.get(processTemplateId);
|
|
|
|
|
|
|
|
|
- ExaminePersonDTO examinePersonDTO = processSetService.getExaminePerson(null, processTemplate.getId(), personPopedom, 1,days);
|
|
|
+ ExaminePersonDTO examinePersonDTO = processSetService.getExaminePerson(null, processTemplate.getId(), personPopedom, 1, days);
|
|
|
|
|
|
|
|
|
if (StringUtils.isBlank(examinePersonDTO.getPersonNames())) {
|
|
@@ -332,7 +387,7 @@ public class AdjustShiftApiController {
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
map.put("operation", operation);
|
|
|
map.put("name", examinePersonDTO.getPersonNames());
|
|
|
- map.put("processActivityId",examinePersonDTO.getActivityId());
|
|
|
+ map.put("processActivityId", examinePersonDTO.getActivityId());
|
|
|
|
|
|
messageResult.setData(map);
|
|
|
messageResult.setCode(200);
|
|
@@ -358,7 +413,7 @@ public class AdjustShiftApiController {
|
|
|
@ApiImplicitParam(name = "formId", value = "页面路径", required = true, paramType = "form"),
|
|
|
@ApiImplicitParam(name = "draft", value = "状态(0:草稿,1:提交)", required = true, paramType = "form")
|
|
|
})
|
|
|
- public MessageResult<Map> adjustShiftSubmit(String ids,String draft,String date, String shiftIds, String remark, String formId, String token, @RequestAttribute String subject) {
|
|
|
+ public MessageResult<Map> adjustShiftSubmit(String ids, String draft, String date, String shiftIds, String remark, String formId, String token, @RequestAttribute String subject) {
|
|
|
|
|
|
|
|
|
MessageResult<Map> messageResult = new MessageResult<>();
|
|
@@ -368,7 +423,7 @@ public class AdjustShiftApiController {
|
|
|
PersonPopedom personPopedom = personPopedomService.get(person.getPopedom());
|
|
|
|
|
|
|
|
|
- String id = adjustShiftService.adjustShiftSubmit(personPopedom, date, shiftIds, remark, formId,ids,draft);
|
|
|
+ String id = adjustShiftService.adjustShiftSubmit(personPopedom, date, shiftIds, remark, formId, ids, draft);
|
|
|
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
map.put("id", id);
|
|
@@ -412,7 +467,7 @@ public class AdjustShiftApiController {
|
|
|
//调班
|
|
|
if ("1".equals(procinst.getType())) {
|
|
|
AdjustShift adjustShift = adjustShiftService.get(procinst.getBusinessKey());
|
|
|
- if (adjustShift.getPersonPopedomId().equals(personPopedom.getId()) && adjustShift.getStatus().equals("0")){
|
|
|
+ if (adjustShift.getPersonPopedomId().equals(personPopedom.getId()) && adjustShift.getStatus().equals("0")) {
|
|
|
ownerSubmit = true;
|
|
|
}
|
|
|
|
|
@@ -420,7 +475,7 @@ public class AdjustShiftApiController {
|
|
|
//请假
|
|
|
if ("2".equals(procinst.getType())) {
|
|
|
RequestForLeaveInfo requestForLeaveInfo = requestForLeaveInfoService.get(procinst.getBusinessKey());
|
|
|
- if (requestForLeaveInfo.getPersonPopedomId().equals(personPopedom.getId())&& requestForLeaveInfo.getStatus() == 0 ){
|
|
|
+ if (requestForLeaveInfo.getPersonPopedomId().equals(personPopedom.getId()) && requestForLeaveInfo.getStatus() == 0) {
|
|
|
ownerSubmit = true;
|
|
|
}
|
|
|
|
|
@@ -428,7 +483,7 @@ public class AdjustShiftApiController {
|
|
|
//出差
|
|
|
if ("3".equals(procinst.getType())) {
|
|
|
BusinessOut businessOut = businessOutService.get(procinst.getBusinessKey());
|
|
|
- if (businessOut.getPersonPopedomId().equals(personPopedom.getId()) && businessOut.getStatus().equals("0") ){
|
|
|
+ if (businessOut.getPersonPopedomId().equals(personPopedom.getId()) && businessOut.getStatus().equals("0")) {
|
|
|
ownerSubmit = true;
|
|
|
}
|
|
|
|
|
@@ -436,38 +491,33 @@ public class AdjustShiftApiController {
|
|
|
//补卡,批量补卡
|
|
|
if ("4".equals(procinst.getType()) || "5".equals(procinst.getType())) {
|
|
|
SupplementWork supplementWork = supplementWorkService.get(procinst.getBusinessKey());
|
|
|
- if (supplementWork.getPersonPopedomId().equals(personPopedom.getId())&& supplementWork.getStatus().equals("0") ){
|
|
|
+ if (supplementWork.getPersonPopedomId().equals(personPopedom.getId()) && supplementWork.getStatus().equals("0")) {
|
|
|
ownerSubmit = true;
|
|
|
}
|
|
|
}
|
|
|
//加班,批量加班
|
|
|
if ("6".equals(procinst.getType()) || "7".equals(procinst.getType())) {
|
|
|
WorkOver workOver = workOverService.get(procinst.getBusinessKey());
|
|
|
- if (workOver.getPersonPopedomId().equals(personPopedom.getId())&& workOver.getStatus().equals("0") ){
|
|
|
+ if (workOver.getPersonPopedomId().equals(personPopedom.getId()) && workOver.getStatus().equals("0")) {
|
|
|
ownerSubmit = true;
|
|
|
}
|
|
|
}
|
|
|
//携物出厂
|
|
|
if ("8".equals(procinst.getType())) {
|
|
|
CarryThingsOutFactory carryThingsOutFactory = carryThingsOutFactoryService.get(procinst.getBusinessKey());
|
|
|
- if (carryThingsOutFactory.getPersonPopedomId().equals(personPopedom.getId())&& carryThingsOutFactory.getAuditStatus().equals("0") ){
|
|
|
+ if (carryThingsOutFactory.getPersonPopedomId().equals(personPopedom.getId()) && carryThingsOutFactory.getAuditStatus().equals("0")) {
|
|
|
ownerSubmit = true;
|
|
|
}
|
|
|
}
|
|
|
//接待就餐
|
|
|
- if ("9".equals(procinst.getType())){
|
|
|
+ if ("9".equals(procinst.getType())) {
|
|
|
CustomerDiningRecord customerDiningRecord = customerDiningRecordService.get(procinst.getBusinessKey());
|
|
|
- if (customerDiningRecord.getPersonPopedomId().equals(personPopedom.getId())&& customerDiningRecord.getStatus().equals("0") ){
|
|
|
+ if (customerDiningRecord.getPersonPopedomId().equals(personPopedom.getId()) && customerDiningRecord.getStatus().equals("0")) {
|
|
|
ownerSubmit = true;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
//查询当前审核步骤
|
|
|
ProcinstActivity procinstActivity0 = procinstActivityService.findProcinstIdAndStatus(procinst.getId(), "1");
|
|
|
Boolean allowExamine = false;
|
|
@@ -549,7 +599,7 @@ public class AdjustShiftApiController {
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
map.put("examineList", examineDetailDTOList);
|
|
|
map.put("allowExamine", allowExamine);
|
|
|
- map.put("ownerSubmit",ownerSubmit);
|
|
|
+ map.put("ownerSubmit", ownerSubmit);
|
|
|
map.put("procinstActUserId", procinstActUserId);
|
|
|
messageResult.setData(map);
|
|
|
messageResult.setCode(200);
|
|
@@ -698,7 +748,7 @@ public class AdjustShiftApiController {
|
|
|
PersonInfo adjustPerson = personInfoService.get(adjustPersonPopedom.getPersonId());
|
|
|
|
|
|
//调整前的班次
|
|
|
- // String shifIds = adjustShift.getOldShiftId();
|
|
|
+ // String shifIds = adjustShift.getOldShiftId();
|
|
|
String shifIds = adjustShiftPersonList.get(0).getOldShiftId();
|
|
|
List<String> shiftIdList = Arrays.asList(shifIds.split(","));
|
|
|
String oldShiftName = null;
|
|
@@ -714,7 +764,7 @@ public class AdjustShiftApiController {
|
|
|
}
|
|
|
|
|
|
//调整后的班次
|
|
|
- // String newShiftIds = adjustShift.getNewShiftId();
|
|
|
+ // String newShiftIds = adjustShift.getNewShiftId();
|
|
|
|
|
|
String newShiftIds = adjustShiftPersonList.get(0).getNewShiftId();
|
|
|
List<String> newShiftIdList = Arrays.asList(newShiftIds.split(","));
|
|
@@ -739,7 +789,7 @@ public class AdjustShiftApiController {
|
|
|
map.put("status", adjustShift.getStatus());
|
|
|
map.put("statusName", TypeNameUtil.getExamineTypeName(adjustShift.getStatus()));
|
|
|
map.put("remark", adjustShift.getRemark());
|
|
|
- Week week = DateUtil.dayOfWeekEnum(adjustTime);
|
|
|
+ Week week = DateUtil.dayOfWeekEnum(adjustTime);
|
|
|
map.put("adjustDate", DateUtil.format(adjustTime, "yyyy-MM-dd") + " " + week.toChinese());
|
|
|
map.put("oldShift", oldShiftName);
|
|
|
map.put("newShift", newShiftName);
|
|
@@ -823,7 +873,7 @@ public class AdjustShiftApiController {
|
|
|
@ApiImplicitParam(name = "companyId", value = "对应公司或部门id", required = false, paramType = "form"),
|
|
|
@ApiImplicitParam(name = "queryDate", value = "时间", required = false, paramType = "form")
|
|
|
})
|
|
|
- public MessageResult<Map> arrangeShiftCompanyList(String companyId, String token, @RequestAttribute String subject, @DateTimeFormat(pattern = "yyyy-MM-dd") Date queryDate) {
|
|
|
+ public MessageResult<Map> arrangeShiftCompanyList(String companyId, String batchJob, String token, @RequestAttribute String subject, @DateTimeFormat(pattern = "yyyy-MM-dd") Date queryDate) {
|
|
|
|
|
|
|
|
|
MessageResult<Map> messageResult = new MessageResult<>();
|
|
@@ -832,23 +882,56 @@ public class AdjustShiftApiController {
|
|
|
PersonInfo person = personInfoService.get(Long.parseLong(subject));
|
|
|
PersonPopedom personPopedom = personPopedomService.get(person.getPopedom());
|
|
|
CompanyInfo companyInfo = companyInfoService.get(personPopedom.getCompanyId());
|
|
|
+
|
|
|
+ List<String> companyIds = new ArrayList<>();
|
|
|
+ companyIds.add(companyInfo.getId());
|
|
|
+
|
|
|
+ //关联部门的id
|
|
|
+ List<String> relationCompanyIds = new ArrayList<>();
|
|
|
+
|
|
|
List<String> companyIdList = Arrays.asList(companyInfo.getCode().split(","));
|
|
|
List<CompanyAndPersonDTO> list = new ArrayList<>();
|
|
|
+
|
|
|
+
|
|
|
+ if ("1".equals(batchJob)) {
|
|
|
+ //用户关联的部门
|
|
|
+ List<PersonCompany> personCompanyList = personCompanyService.findByPersonId(person.getId());
|
|
|
+ relationCompanyIds = personCompanyList.stream()
|
|
|
+ .map(p -> p.getCompanyId())
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ if (relationCompanyIds.contains(companyInfo.getId())) {
|
|
|
+ relationCompanyIds.remove(companyInfo.getId());
|
|
|
+ }
|
|
|
+ companyIds.addAll(relationCompanyIds);
|
|
|
+ }
|
|
|
+
|
|
|
if (StringUtils.isBlank(companyId)) {
|
|
|
|
|
|
- String code = companyInfo.getCode();
|
|
|
- List<String> idList = Arrays.asList(code.split(","));
|
|
|
- CompanyInfo companyInfo1 = companyInfoService.get(idList.get(0));
|
|
|
- CompanyAndPersonDTO companyAndPersonDTO = new CompanyAndPersonDTO();
|
|
|
- companyAndPersonDTO.setId(companyInfo1.getId());
|
|
|
- companyAndPersonDTO.setName(companyInfo1.getName());
|
|
|
- companyAndPersonDTO.setType("1");
|
|
|
- list.add(companyAndPersonDTO);
|
|
|
+
|
|
|
+ for (String id : companyIds) {
|
|
|
+ CompanyInfo companyInfo1 = companyInfoService.get(id);
|
|
|
+ String code = companyInfo1.getCode();
|
|
|
+ List<String> idList = Arrays.asList(code.split(","));
|
|
|
+ CompanyInfo companyInfo2 = companyInfoService.get(idList.get(0));
|
|
|
+ CompanyAndPersonDTO companyAndPersonDTO = new CompanyAndPersonDTO();
|
|
|
+ companyAndPersonDTO.setId(companyInfo2.getId());
|
|
|
+ companyAndPersonDTO.setName(companyInfo2.getName());
|
|
|
+ companyAndPersonDTO.setType("1");
|
|
|
+ if (!list.contains(companyAndPersonDTO)) {
|
|
|
+ list.add(companyAndPersonDTO);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
} else {
|
|
|
CompanyInfo companyInfo2 = companyInfoService.get(companyId);
|
|
|
|
|
|
//查看公司下面是否还有子部门
|
|
|
List<CompanyInfo> companyInfoList0 = companyInfoService.findByParentId(companyId);
|
|
|
+ List<String> companyInfoListId = companyInfoList0.stream()
|
|
|
+ .map(p -> p.getId())
|
|
|
+ .collect(Collectors.toList());
|
|
|
//如果有子部门那么展示部门
|
|
|
if (companyInfoList0.size() > 0) {
|
|
|
//选择展开公司的code
|
|
@@ -857,12 +940,14 @@ public class AdjustShiftApiController {
|
|
|
if (companyIdList.size() <= companyIdList2.size()) {
|
|
|
List<CompanyInfo> companyInfoList = companyInfoService.findByParentId(companyId);
|
|
|
if (companyInfoList.size() > 0) {
|
|
|
- for (CompanyInfo companyInfo1 : companyInfoList){
|
|
|
+ for (CompanyInfo companyInfo1 : companyInfoList) {
|
|
|
CompanyAndPersonDTO companyAndPersonDTO = new CompanyAndPersonDTO();
|
|
|
companyAndPersonDTO.setId(companyInfo1.getId());
|
|
|
companyAndPersonDTO.setName(companyInfo1.getName());
|
|
|
companyAndPersonDTO.setType("1");
|
|
|
- list.add(companyAndPersonDTO);
|
|
|
+ if (!list.contains(companyAndPersonDTO)) {
|
|
|
+ list.add(companyAndPersonDTO);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -874,31 +959,50 @@ public class AdjustShiftApiController {
|
|
|
companyAndPersonDTO.setId(companyInfo1.getId());
|
|
|
companyAndPersonDTO.setName(companyInfo1.getName());
|
|
|
companyAndPersonDTO.setType("1");
|
|
|
- list.add(companyAndPersonDTO);
|
|
|
+ if (!list.contains(companyAndPersonDTO)) {
|
|
|
+ list.add(companyAndPersonDTO);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ List<String> intersection = companyInfoListId.stream().filter(relationCompanyIds::contains).collect(Collectors.toList());
|
|
|
+ if (intersection.size() > 0) {
|
|
|
+ for (String id : intersection) {
|
|
|
+ CompanyInfo companyInfo1 = companyInfoService.get(id);
|
|
|
+ CompanyAndPersonDTO companyAndPersonDTO = new CompanyAndPersonDTO();
|
|
|
+ companyAndPersonDTO.setId(companyInfo1.getId());
|
|
|
+ companyAndPersonDTO.setName(companyInfo1.getName());
|
|
|
+ companyAndPersonDTO.setType("1");
|
|
|
+ if (!list.contains(companyAndPersonDTO)) {
|
|
|
+ list.add(companyAndPersonDTO);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
//没有子部门那么展示人员
|
|
|
else {
|
|
|
List<PersonInfo> personInfoList = personInfoService.findByCompanyId(companyId);
|
|
|
- if (personInfoList.size()>0){
|
|
|
- for (PersonInfo personInfo : personInfoList){
|
|
|
+ if (personInfoList.size() > 0) {
|
|
|
+ for (PersonInfo personInfo : personInfoList) {
|
|
|
CompanyAndPersonDTO companyAndPersonDTO = new CompanyAndPersonDTO();
|
|
|
companyAndPersonDTO.setId(personInfo.getId().toString());
|
|
|
companyAndPersonDTO.setName(personInfo.getName());
|
|
|
companyAndPersonDTO.setType("2");
|
|
|
companyAndPersonDTO.setDesc(personInfo.getJobNumber());
|
|
|
|
|
|
- if (queryDate != null){
|
|
|
+ if (queryDate != null) {
|
|
|
Map<String, Object> searchParams = new HashMap<>();
|
|
|
searchParams.put("personId", personInfo.getId());
|
|
|
- searchParams.put("attendanceDate",DateUtil.format(queryDate,"yyyy-MM-dd"));
|
|
|
+ searchParams.put("attendanceDate", DateUtil.format(queryDate, "yyyy-MM-dd"));
|
|
|
List<Sort> sortList = new ArrayList<>();
|
|
|
- sortList.add(new Sort("a.create_time","desc"));
|
|
|
+ sortList.add(new Sort("a.create_time", "desc"));
|
|
|
|
|
|
- List<WorkScheduleAttendance> workScheduleAttendanceList = workScheduleAttendanceService.listSearch(searchParams,sortList);
|
|
|
- List<Map<String,Object>> mapList = new ArrayList<>();
|
|
|
- if (workScheduleAttendanceList.size()>0){
|
|
|
- for (WorkScheduleAttendance workScheduleAttendance : workScheduleAttendanceList){
|
|
|
+ List<WorkScheduleAttendance> workScheduleAttendanceList = workScheduleAttendanceService.listSearch(searchParams, sortList);
|
|
|
+ List<Map<String, Object>> mapList = new ArrayList<>();
|
|
|
+ if (workScheduleAttendanceList.size() > 0) {
|
|
|
+ for (WorkScheduleAttendance workScheduleAttendance : workScheduleAttendanceList) {
|
|
|
Map<String, Object> data = new HashMap<>();
|
|
|
String time = DateUtil.format(workScheduleAttendance.getRecordTime(), "HH:mm");
|
|
|
String remark = null;
|
|
@@ -1011,112 +1115,110 @@ public class AdjustShiftApiController {
|
|
|
List<String> companyIdList = Arrays.asList(companyInfo.getCode().split(","));
|
|
|
List<CompanyAndPersonDTO> list = new ArrayList<>();
|
|
|
|
|
|
- CompanyInfo companyInfo2 = companyInfoService.get(companyId);
|
|
|
+ CompanyInfo companyInfo2 = companyInfoService.get(companyId);
|
|
|
|
|
|
- //查看公司下面是否还有子部门
|
|
|
- List<CompanyInfo> companyInfoList0 = companyInfoService.findByParentId(companyId);
|
|
|
+ //查看公司下面是否还有子部门
|
|
|
+ List<CompanyInfo> companyInfoList0 = companyInfoService.findByParentId(companyId);
|
|
|
|
|
|
- if (companyInfoList0.size() > 0) {
|
|
|
- //选择展开公司的code
|
|
|
- List<String> companyIdList2 = Arrays.asList(companyInfo2.getCode().split(","));
|
|
|
- //当前角色所在部门的code集合小于所选公司code集合那么,只展示当前角色所在公司或部门
|
|
|
- if (companyIdList.size() <= companyIdList2.size()) {
|
|
|
- List<PersonInfo> personInfoList = personInfoService.findByCompanyId(companyId);
|
|
|
- if (personInfoList.size()>0){
|
|
|
- for (PersonInfo personInfo : personInfoList){
|
|
|
- CompanyAndPersonDTO companyAndPersonDTO = new CompanyAndPersonDTO();
|
|
|
- companyAndPersonDTO.setId(personInfo.getId().toString());
|
|
|
- companyAndPersonDTO.setName(personInfo.getName());
|
|
|
- companyAndPersonDTO.setType("2");
|
|
|
- companyAndPersonDTO.setDesc(personInfo.getJobNumber());
|
|
|
-
|
|
|
- if (queryDate != null){
|
|
|
- Map<String, Object> searchParams = new HashMap<>();
|
|
|
- searchParams.put("personId", personInfo.getId());
|
|
|
- searchParams.put("attendanceDate",DateUtil.format(queryDate,"yyyy-MM-dd"));
|
|
|
- List<Sort> sortList = new ArrayList<>();
|
|
|
- sortList.add(new Sort("a.create_time","desc"));
|
|
|
-
|
|
|
- List<WorkScheduleAttendance> workScheduleAttendanceList = workScheduleAttendanceService.listSearch(searchParams,sortList);
|
|
|
- List<Map<String,Object>> mapList = new ArrayList<>();
|
|
|
- if (workScheduleAttendanceList.size()>0){
|
|
|
- for (WorkScheduleAttendance workScheduleAttendance : workScheduleAttendanceList){
|
|
|
- Map<String, Object> data = new HashMap<>();
|
|
|
- String time = DateUtil.format(workScheduleAttendance.getRecordTime(), "HH:mm");
|
|
|
- String remark = null;
|
|
|
- String status = null;
|
|
|
- String id = workScheduleAttendance.getId();
|
|
|
- String result = null;
|
|
|
- String workStatus = workScheduleAttendance.getWorkStatus();
|
|
|
-
|
|
|
- //工作状态:工作
|
|
|
- if (!"4".equals(workScheduleAttendance.getWorkStatus())) {
|
|
|
- //缺卡
|
|
|
- if ("0".equals(workScheduleAttendance.getResult())) {
|
|
|
- remark = "缺卡";
|
|
|
- status = "0";
|
|
|
- result = "0";
|
|
|
- }
|
|
|
- //有考勤,要区分是机器打卡还是填报打卡
|
|
|
- if (!"0".equals(workScheduleAttendance.getResult())) {
|
|
|
- //机器打卡
|
|
|
- if (StringUtils.isBlank(workScheduleAttendance.getSupplementWorkPersonId())) {
|
|
|
- remark = "正常";
|
|
|
- status = "1";
|
|
|
- }
|
|
|
- //填报打卡
|
|
|
- else {
|
|
|
- remark = "正常";
|
|
|
- status = "3";
|
|
|
- }
|
|
|
- //考勤正常
|
|
|
- if ("1".equals(workScheduleAttendance.getResult())) {
|
|
|
- result = "1";
|
|
|
- }
|
|
|
- //迟到
|
|
|
- if ("2".equals(workScheduleAttendance.getResult())) {
|
|
|
- remark = "迟到";
|
|
|
- result = "2";
|
|
|
- }
|
|
|
- //早退
|
|
|
- if ("3".equals(workScheduleAttendance.getResult())) {
|
|
|
- remark = "早退";
|
|
|
- result = "3";
|
|
|
- }
|
|
|
+ if (companyInfoList0.size() > 0) {
|
|
|
+ //选择展开公司的code
|
|
|
+ List<String> companyIdList2 = Arrays.asList(companyInfo2.getCode().split(","));
|
|
|
+ //当前角色所在部门的code集合小于所选公司code集合那么,只展示当前角色所在公司或部门
|
|
|
+ if (companyIdList.size() <= companyIdList2.size()) {
|
|
|
+ List<PersonInfo> personInfoList = personInfoService.findByCompanyId(companyId);
|
|
|
+ if (personInfoList.size() > 0) {
|
|
|
+ for (PersonInfo personInfo : personInfoList) {
|
|
|
+ CompanyAndPersonDTO companyAndPersonDTO = new CompanyAndPersonDTO();
|
|
|
+ companyAndPersonDTO.setId(personInfo.getId().toString());
|
|
|
+ companyAndPersonDTO.setName(personInfo.getName());
|
|
|
+ companyAndPersonDTO.setType("2");
|
|
|
+ companyAndPersonDTO.setDesc(personInfo.getJobNumber());
|
|
|
|
|
|
+ if (queryDate != null) {
|
|
|
+ Map<String, Object> searchParams = new HashMap<>();
|
|
|
+ searchParams.put("personId", personInfo.getId());
|
|
|
+ searchParams.put("attendanceDate", DateUtil.format(queryDate, "yyyy-MM-dd"));
|
|
|
+ List<Sort> sortList = new ArrayList<>();
|
|
|
+ sortList.add(new Sort("a.create_time", "desc"));
|
|
|
|
|
|
- }
|
|
|
- }
|
|
|
+ List<WorkScheduleAttendance> workScheduleAttendanceList = workScheduleAttendanceService.listSearch(searchParams, sortList);
|
|
|
+ List<Map<String, Object>> mapList = new ArrayList<>();
|
|
|
+ if (workScheduleAttendanceList.size() > 0) {
|
|
|
+ for (WorkScheduleAttendance workScheduleAttendance : workScheduleAttendanceList) {
|
|
|
+ Map<String, Object> data = new HashMap<>();
|
|
|
+ String time = DateUtil.format(workScheduleAttendance.getRecordTime(), "HH:mm");
|
|
|
+ String remark = null;
|
|
|
+ String status = null;
|
|
|
+ String id = workScheduleAttendance.getId();
|
|
|
+ String result = null;
|
|
|
+ String workStatus = workScheduleAttendance.getWorkStatus();
|
|
|
|
|
|
- //工作状态:请假
|
|
|
- if ("4".equals(workScheduleAttendance.getWorkStatus())) {
|
|
|
- remark = "请假";
|
|
|
- status = "2";
|
|
|
- result = "5";
|
|
|
+ //工作状态:工作
|
|
|
+ if (!"4".equals(workScheduleAttendance.getWorkStatus())) {
|
|
|
+ //缺卡
|
|
|
+ if ("0".equals(workScheduleAttendance.getResult())) {
|
|
|
+ remark = "缺卡";
|
|
|
+ status = "0";
|
|
|
+ result = "0";
|
|
|
}
|
|
|
+ //有考勤,要区分是机器打卡还是填报打卡
|
|
|
+ if (!"0".equals(workScheduleAttendance.getResult())) {
|
|
|
+ //机器打卡
|
|
|
+ if (StringUtils.isBlank(workScheduleAttendance.getSupplementWorkPersonId())) {
|
|
|
+ remark = "正常";
|
|
|
+ status = "1";
|
|
|
+ }
|
|
|
+ //填报打卡
|
|
|
+ else {
|
|
|
+ remark = "正常";
|
|
|
+ status = "3";
|
|
|
+ }
|
|
|
+ //考勤正常
|
|
|
+ if ("1".equals(workScheduleAttendance.getResult())) {
|
|
|
+ result = "1";
|
|
|
+ }
|
|
|
+ //迟到
|
|
|
+ if ("2".equals(workScheduleAttendance.getResult())) {
|
|
|
+ remark = "迟到";
|
|
|
+ result = "2";
|
|
|
+ }
|
|
|
+ //早退
|
|
|
+ if ("3".equals(workScheduleAttendance.getResult())) {
|
|
|
+ remark = "早退";
|
|
|
+ result = "3";
|
|
|
+ }
|
|
|
|
|
|
- data.put("time", time);
|
|
|
- data.put("remark", remark);
|
|
|
- data.put("status", status);
|
|
|
- data.put("workStatus", workStatus);
|
|
|
- data.put("result", result);
|
|
|
- data.put("id", id);
|
|
|
|
|
|
- mapList.add(data);
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- companyAndPersonDTO.setList(mapList);
|
|
|
- }
|
|
|
|
|
|
+ //工作状态:请假
|
|
|
+ if ("4".equals(workScheduleAttendance.getWorkStatus())) {
|
|
|
+ remark = "请假";
|
|
|
+ status = "2";
|
|
|
+ result = "5";
|
|
|
+ }
|
|
|
|
|
|
+ data.put("time", time);
|
|
|
+ data.put("remark", remark);
|
|
|
+ data.put("status", status);
|
|
|
+ data.put("workStatus", workStatus);
|
|
|
+ data.put("result", result);
|
|
|
+ data.put("id", id);
|
|
|
|
|
|
- list.add(companyAndPersonDTO);
|
|
|
+ mapList.add(data);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ companyAndPersonDTO.setList(mapList);
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
+
|
|
|
+ list.add(companyAndPersonDTO);
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
@@ -1146,7 +1248,7 @@ public class AdjustShiftApiController {
|
|
|
@ApiImplicitParam(name = "remark", value = "备注", required = true, paramType = "form")
|
|
|
|
|
|
})
|
|
|
- public MessageResult<Map> arrangeShiftSubmit(String date,String personIds, String shiftIds, String remark,String token, @RequestAttribute String subject) {
|
|
|
+ public MessageResult<Map> arrangeShiftSubmit(String date, String personIds, String shiftIds, String remark, String token, @RequestAttribute String subject) {
|
|
|
|
|
|
|
|
|
MessageResult<Map> messageResult = new MessageResult<>();
|
|
@@ -1155,7 +1257,7 @@ public class AdjustShiftApiController {
|
|
|
PersonInfo person = personInfoService.get(Long.parseLong(subject));
|
|
|
PersonPopedom personPopedom = personPopedomService.get(person.getPopedom());
|
|
|
|
|
|
- String id = adjustShiftService.arrangeShiftSubmit(personPopedom, personIds,date, shiftIds, remark);
|
|
|
+ String id = adjustShiftService.arrangeShiftSubmit(personPopedom, personIds, date, shiftIds, remark);
|
|
|
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
map.put("id", id);
|
|
@@ -1214,31 +1316,27 @@ public class AdjustShiftApiController {
|
|
|
|
|
|
}
|
|
|
|
|
|
- if (adjustShiftPersonList.size()>0){
|
|
|
- for (AdjustShiftPerson adjustShiftPerson : adjustShiftPersonList){
|
|
|
+ if (adjustShiftPersonList.size() > 0) {
|
|
|
+ for (AdjustShiftPerson adjustShiftPerson : adjustShiftPersonList) {
|
|
|
PersonPopedom personPopedom1 = personPopedomService.get(adjustShiftPerson.getPersonPopedomId());
|
|
|
PersonInfo personInfo = personInfoService.get(personPopedom1.getPersonId());
|
|
|
- if (StringUtils.isBlank(arrangeName)){
|
|
|
+ if (StringUtils.isBlank(arrangeName)) {
|
|
|
arrangeName = personInfo.getName();
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
arrangeName = arrangeName + "," + personInfo.getName();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
Date adjustTime = DateUtil.parse(adjustShift.getAdjustDate(), "yyyy-MM-dd");
|
|
|
|
|
|
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
map.put("name", adjustPerson.getName());
|
|
|
- map.put("arrangeName",arrangeName);
|
|
|
- map.put("type",adjustShift.getType());
|
|
|
- map.put("typeName",TypeNameUtil.getTypeName(adjustShift.getType()));
|
|
|
+ map.put("arrangeName", arrangeName);
|
|
|
+ map.put("type", adjustShift.getType());
|
|
|
+ map.put("typeName", TypeNameUtil.getTypeName(adjustShift.getType()));
|
|
|
map.put("status", adjustShift.getStatus());
|
|
|
map.put("statusName", TypeNameUtil.getExamineTypeName(adjustShift.getStatus()));
|
|
|
map.put("remark", adjustShift.getRemark());
|
|
@@ -1275,23 +1373,23 @@ public class AdjustShiftApiController {
|
|
|
List<ArrangeShiftListDTO> list = new ArrayList<>();
|
|
|
Map<String, Object> searchParams = new HashMap<>();
|
|
|
searchParams.put("personPopedomId", personPopedom.getId());
|
|
|
- searchParams.put("type","2");
|
|
|
+ searchParams.put("type", "2");
|
|
|
List<Sort> sortList = new ArrayList<>();
|
|
|
sortList.add(new Sort("create_time", "desc"));
|
|
|
Page<AdjustShift> page = adjustShiftService.pageSearch(searchParams, pageIndex, pageSize, true, sortList);
|
|
|
|
|
|
List<AdjustShift> adjustShiftList = page.getResult();
|
|
|
- if (adjustShiftList.size()>0){
|
|
|
- for (AdjustShift adjustShift : adjustShiftList){
|
|
|
+ if (adjustShiftList.size() > 0) {
|
|
|
+ for (AdjustShift adjustShift : adjustShiftList) {
|
|
|
List<AdjustShiftPerson> adjustShiftPersonList = adjustShiftPersonService.findByAdjustShiftId(adjustShift.getId());
|
|
|
AdjustShiftPerson adjustShiftPerson = adjustShiftPersonList.get(0);
|
|
|
PersonPopedom personPopedom1 = personPopedomService.get(adjustShiftPerson.getPersonPopedomId());
|
|
|
PersonInfo personInfo = personInfoService.get(personPopedom1.getPersonId());
|
|
|
ArrangeShiftListDTO arrangeShiftListDTO = new ArrangeShiftListDTO();
|
|
|
arrangeShiftListDTO.setId(adjustShift.getId());
|
|
|
- arrangeShiftListDTO.setName(personInfo.getName()+"等"+adjustShiftPersonList.size()+"人");
|
|
|
+ arrangeShiftListDTO.setName(personInfo.getName() + "等" + adjustShiftPersonList.size() + "人");
|
|
|
arrangeShiftListDTO.setAdjustDate(adjustShift.getAdjustDate());
|
|
|
- arrangeShiftListDTO.setSubmitDate(DateUtil.format(adjustShift.getSubmitTime(),"yyyy-MM-dd HH:mm:ss"));
|
|
|
+ arrangeShiftListDTO.setSubmitDate(DateUtil.format(adjustShift.getSubmitTime(), "yyyy-MM-dd HH:mm:ss"));
|
|
|
arrangeShiftListDTO.setStatus(adjustShift.getStatus());
|
|
|
arrangeShiftListDTO.setStatusName(TypeNameUtil.getExamineTypeName(adjustShift.getStatus()));
|
|
|
list.add(arrangeShiftListDTO);
|
|
@@ -1324,7 +1422,7 @@ public class AdjustShiftApiController {
|
|
|
|
|
|
@ApiOperation(value = "撤销申请(未审核完成)")
|
|
|
@PostMapping(value = "revoke")
|
|
|
- public MessageResult<Map> revoke(String token, @RequestAttribute String subject,String id) {
|
|
|
+ public MessageResult<Map> revoke(String token, @RequestAttribute String subject, String id) {
|
|
|
|
|
|
|
|
|
MessageResult<Map> messageResult = new MessageResult<>();
|
|
@@ -1333,7 +1431,7 @@ public class AdjustShiftApiController {
|
|
|
PersonInfo person = personInfoService.get(Long.parseLong(subject));
|
|
|
PersonPopedom personPopedom = personPopedomService.get(person.getPopedom());
|
|
|
|
|
|
- procinstService.revoke(personPopedom,id);
|
|
|
+ procinstService.revoke(personPopedom, id);
|
|
|
|
|
|
messageResult.setCode(200);
|
|
|
messageResult.setResult(true);
|