|
|
@@ -0,0 +1,130 @@
|
|
|
+package com.jpsoft.employment.modules.mobile.controller;
|
|
|
+
|
|
|
+import com.github.pagehelper.Page;
|
|
|
+import com.jpsoft.employment.modules.base.entity.LabourServices;
|
|
|
+import com.jpsoft.employment.modules.base.service.LabourServicesService;
|
|
|
+import com.jpsoft.employment.modules.common.dto.MessageResult;
|
|
|
+import com.jpsoft.employment.modules.common.dto.Sort;
|
|
|
+import com.jpsoft.employment.modules.common.utils.PojoUtils;
|
|
|
+import com.jpsoft.employment.modules.sys.entity.User;
|
|
|
+import com.jpsoft.employment.modules.sys.service.DataDictionaryService;
|
|
|
+import com.jpsoft.employment.modules.sys.service.UserService;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.slf4j.Logger;
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import java.util.*;
|
|
|
+
|
|
|
+@Slf4j
|
|
|
+@RestController
|
|
|
+@RequestMapping("/mobile/labourApi")
|
|
|
+@Api(description = "移动端劳务对接接口")
|
|
|
+public class LabourApiController {
|
|
|
+ private Logger logger = LoggerFactory.getLogger(getClass());
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private LabourServicesService labourServicesService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private DataDictionaryService dataDictionaryService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private UserService userService;
|
|
|
+
|
|
|
+ @PostMapping("getLabourList")
|
|
|
+ @ApiOperation(value = "劳务对接列表")
|
|
|
+ public MessageResult<Map> getLabourList(
|
|
|
+ String approvalStatus,String approveTimeRange,String token,
|
|
|
+ @RequestParam(value="pageIndex",defaultValue="1") int pageIndex,
|
|
|
+ @RequestParam(value="pageSize",defaultValue="20") int pageSize,
|
|
|
+ @RequestAttribute String subject) {
|
|
|
+ System.out.println(subject);
|
|
|
+
|
|
|
+ MessageResult<Map> msgResult = new MessageResult<>();
|
|
|
+
|
|
|
+ Map<String,Object> searchParams = new HashMap<>();
|
|
|
+
|
|
|
+ List<Sort> sortList = new ArrayList<>();
|
|
|
+ sortList.add(new Sort("create_time","desc"));
|
|
|
+
|
|
|
+ if (StringUtils.isNotEmpty(approvalStatus)) {
|
|
|
+ searchParams.put("approvalStatus",approvalStatus);
|
|
|
+ }
|
|
|
+
|
|
|
+ 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];
|
|
|
+ beginTime+=" 00:00:00";
|
|
|
+ endTime+=" 23:59:59";
|
|
|
+ }
|
|
|
+
|
|
|
+ searchParams.put("beginTime", beginTime);
|
|
|
+ searchParams.put("endTime", endTime);
|
|
|
+ }
|
|
|
+
|
|
|
+ Page<LabourServices> page = labourServicesService.pageSearch(searchParams,pageIndex,pageSize,true,sortList);
|
|
|
+
|
|
|
+ for (LabourServices labourServices:page) {
|
|
|
+
|
|
|
+ String typeN = dataDictionaryService.findNameByCatalogNameAndValue("劳务对接类型",labourServices.getType());
|
|
|
+
|
|
|
+ labourServices.setTypeN(typeN);
|
|
|
+
|
|
|
+ String approvalStatusN = dataDictionaryService.findNameByCatalogNameAndValue("劳务对接审批状态",labourServices.getApprovalStatus());
|
|
|
+
|
|
|
+ labourServices.setApprovalStatusN(approvalStatusN);
|
|
|
+
|
|
|
+ User user = userService.get(labourServices.getApprovePersonId());
|
|
|
+
|
|
|
+ if(user!=null) {
|
|
|
+ labourServices.setApprovePersonName(user.getRealName());
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ msgResult.setResult(true);
|
|
|
+ msgResult.setData(PojoUtils.pageWrapper(page));
|
|
|
+
|
|
|
+ return msgResult;
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("getLabourDetails/{id}")
|
|
|
+ @ApiOperation(value = "劳务对接详情")
|
|
|
+ public MessageResult<LabourServices> getLabourDetails(
|
|
|
+ @PathVariable("id") String id,
|
|
|
+ String token) {
|
|
|
+ MessageResult<LabourServices> msgResult = new MessageResult<>();
|
|
|
+
|
|
|
+ try {
|
|
|
+ LabourServices labourServices = labourServicesService.get(id);
|
|
|
+
|
|
|
+ if (labourServices != null) {
|
|
|
+ msgResult.setResult(true);
|
|
|
+ msgResult.setData(labourServices);
|
|
|
+ } else {
|
|
|
+ msgResult.setResult(false);
|
|
|
+ msgResult.setMessage("数据库不存在该记录!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch(Exception ex){
|
|
|
+ logger.error(ex.getMessage(),ex);
|
|
|
+
|
|
|
+ msgResult.setResult(false);
|
|
|
+ msgResult.setMessage(ex.getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+ return msgResult;
|
|
|
+ }
|
|
|
+}
|