|
@@ -46,7 +46,7 @@ public class LabourApiController {
|
|
|
@PostMapping("getLabourList")
|
|
|
@ApiOperation(value = "劳务对接列表")
|
|
|
@ApiImplicitParams({
|
|
|
- @ApiImplicitParam(name = "typeB", value = "类型(1:我要用工,2:我要工人)", required = false, paramType = "query"),
|
|
|
+ @ApiImplicitParam(name = "typeB", value = "类型(1:我要用工,2:我有工人)", required = false, paramType = "query"),
|
|
|
})
|
|
|
public MessageResult<Map> getLabourList(
|
|
|
String approvalStatus,String approveTimeRange,String token,String typeB,
|
|
@@ -57,64 +57,85 @@ public class LabourApiController {
|
|
|
|
|
|
MessageResult<Map> msgResult = new MessageResult<>();
|
|
|
|
|
|
- Map<String,Object> searchParams = new HashMap<>();
|
|
|
+ try {
|
|
|
|
|
|
- List<Sort> sortList = new ArrayList<>();
|
|
|
- sortList.add(new Sort("create_time","desc"));
|
|
|
+ User user = userService.get(subject);
|
|
|
|
|
|
- if (StringUtils.isNotEmpty(approvalStatus)) {
|
|
|
- searchParams.put("approvalStatus",approvalStatus);
|
|
|
- }
|
|
|
+ if(user==null){
|
|
|
+ throw new Exception("用户未登录,请先登录!");
|
|
|
+ }
|
|
|
+
|
|
|
+ Map<String,Object> searchParams = new HashMap<>();
|
|
|
+
|
|
|
+ List<Sort> sortList = new ArrayList<>();
|
|
|
+ sortList.add(new Sort("create_time","desc"));
|
|
|
+
|
|
|
+ if(!userService.hasRole(user.getId(),"SYSADMIN")&&!userService.hasRole(user.getId(),"ADMIN")){
|
|
|
+ searchParams.put("userId", user.getId());
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isNotEmpty(approvalStatus)) {
|
|
|
+ searchParams.put("approvalStatus",approvalStatus);
|
|
|
+ }
|
|
|
|
|
|
- searchParams.put("typeB",typeB);
|
|
|
-
|
|
|
- if (StringUtils.isNotEmpty(approveTimeRange)) {
|
|
|
- String[] timeRangeArray = approveTimeRange.split(",");
|
|
|
- String beginTime = "";
|
|
|
- String endTime = "";
|
|
|
- beginTime+=" 00:00:00";
|
|
|
- if (timeRangeArray.length == 1) {
|
|
|
- beginTime = timeRangeArray[0];
|
|
|
- } else if (timeRangeArray.length == 2) {
|
|
|
- beginTime = timeRangeArray[0];
|
|
|
- endTime = timeRangeArray[1];
|
|
|
+ if (StringUtils.isNotEmpty(approveTimeRange)) {
|
|
|
+ String[] timeRangeArray = approveTimeRange.split(",");
|
|
|
+ String beginTime = "";
|
|
|
+ String endTime = "";
|
|
|
beginTime+=" 00:00:00";
|
|
|
- endTime+=" 23:59:59";
|
|
|
+ if (timeRangeArray.length == 1) {
|
|
|
+ beginTime = timeRangeArray[0];
|
|
|
+ } else if (timeRangeArray.length == 2) {
|
|
|
+ beginTime = timeRangeArray[0];
|
|
|
+ endTime = timeRangeArray[1];
|
|
|
+ beginTime+=" 00:00:00";
|
|
|
+ endTime+=" 23:59:59";
|
|
|
+ }
|
|
|
+
|
|
|
+ searchParams.put("beginTime", beginTime);
|
|
|
+ searchParams.put("endTime", endTime);
|
|
|
}
|
|
|
|
|
|
- searchParams.put("beginTime", beginTime);
|
|
|
- searchParams.put("endTime", endTime);
|
|
|
- }
|
|
|
+ if (StringUtils.isNotEmpty(typeB)) {
|
|
|
+ searchParams.put("typeB",typeB);
|
|
|
+ }
|
|
|
|
|
|
+ Page<LabourServices> page = labourServicesService.pageSearch(searchParams,pageIndex,pageSize,true,sortList);
|
|
|
|
|
|
- Page<LabourServices> page = labourServicesService.pageSearch(searchParams,pageIndex,pageSize,true,sortList);
|
|
|
+ for (LabourServices labourServices:page) {
|
|
|
|
|
|
- for (LabourServices labourServices:page) {
|
|
|
+ String typeN = dataDictionaryService.findNameByCatalogNameAndValue("劳务对接类型",labourServices.getType());
|
|
|
|
|
|
- String typeN = dataDictionaryService.findNameByCatalogNameAndValue("劳务对接类型",labourServices.getType());
|
|
|
+ labourServices.setTypeN(typeN);
|
|
|
|
|
|
- labourServices.setTypeN(typeN);
|
|
|
+ String approvalStatusN = dataDictionaryService.findNameByCatalogNameAndValue("劳务对接审批状态",labourServices.getApprovalStatus());
|
|
|
|
|
|
- String approvalStatusN = dataDictionaryService.findNameByCatalogNameAndValue("劳务对接审批状态",labourServices.getApprovalStatus());
|
|
|
+ labourServices.setApprovalStatusN(approvalStatusN);
|
|
|
|
|
|
- labourServices.setApprovalStatusN(approvalStatusN);
|
|
|
+ User curUser = userService.get(labourServices.getApprovePersonId());
|
|
|
|
|
|
- User user = userService.get(labourServices.getApprovePersonId());
|
|
|
+ if(curUser!=null) {
|
|
|
+ labourServices.setApprovePersonName(curUser.getRealName());
|
|
|
+ }
|
|
|
|
|
|
- if(user!=null) {
|
|
|
- labourServices.setApprovePersonName(user.getRealName());
|
|
|
- }
|
|
|
+ Company company = companyService.get(user.getCompanyId());
|
|
|
|
|
|
- Company company = companyService.get(user.getCompanyId());
|
|
|
+ if(company!=null) {
|
|
|
+ labourServices.setCompanyName(company.getName());
|
|
|
+ }
|
|
|
|
|
|
- if(company!=null) {
|
|
|
- labourServices.setCompanyName(company.getName());
|
|
|
}
|
|
|
|
|
|
+ msgResult.setResult(true);
|
|
|
+ msgResult.setData(PojoUtils.pageWrapper(page));
|
|
|
+
|
|
|
}
|
|
|
+ catch(Exception ex){
|
|
|
+ logger.error(ex.getMessage(),ex);
|
|
|
|
|
|
- msgResult.setResult(true);
|
|
|
- msgResult.setData(PojoUtils.pageWrapper(page));
|
|
|
+ msgResult.setResult(false);
|
|
|
+ msgResult.setMessage(ex.getMessage());
|
|
|
+ }
|
|
|
|
|
|
return msgResult;
|
|
|
}
|
|
@@ -123,17 +144,25 @@ public class LabourApiController {
|
|
|
@ApiOperation(value = "劳务对接详情")
|
|
|
public MessageResult<Map> getLabourDetails(
|
|
|
@PathVariable("id") String id,
|
|
|
- String token) {
|
|
|
+ String token,
|
|
|
+ @RequestAttribute String subject) {
|
|
|
MessageResult<Map> msgResult = new MessageResult<>();
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
|
|
|
try {
|
|
|
LabourServices labourServices = labourServicesService.get(id);
|
|
|
- User user = userService.get(labourServices.getApprovePersonId());
|
|
|
+ User user = userService.get(labourServices.getCreateBy());
|
|
|
Company company = companyService.get(user.getCompanyId());
|
|
|
|
|
|
+ switch (labourServices.getType()){
|
|
|
+ case "1": labourServices.setTypeN("我要用工人");break;
|
|
|
+ case "2": labourServices.setTypeN("我有工人");break;
|
|
|
+ }
|
|
|
+
|
|
|
map.put("labourServices",labourServices);
|
|
|
- map.put("company",company);
|
|
|
+ map.put("logo",company.getLogo());
|
|
|
+ map.put("name",company.getName());
|
|
|
+
|
|
|
|
|
|
if (labourServices != null) {
|
|
|
msgResult.setResult(true);
|