|
@@ -6,6 +6,8 @@ import com.jpsoft.employment.modules.base.service.*;
|
|
|
import com.jpsoft.employment.modules.common.dto.MessageResult;
|
|
import com.jpsoft.employment.modules.common.dto.MessageResult;
|
|
|
import com.jpsoft.employment.modules.common.dto.Sort;
|
|
import com.jpsoft.employment.modules.common.dto.Sort;
|
|
|
import com.jpsoft.employment.modules.common.utils.PojoUtils;
|
|
import com.jpsoft.employment.modules.common.utils.PojoUtils;
|
|
|
|
|
+import com.jpsoft.employment.modules.sys.entity.DataDictionary;
|
|
|
|
|
+import com.jpsoft.employment.modules.sys.service.DataDictionaryService;
|
|
|
import io.swagger.annotations.ApiImplicitParam;
|
|
import io.swagger.annotations.ApiImplicitParam;
|
|
|
import io.swagger.annotations.ApiImplicitParams;
|
|
import io.swagger.annotations.ApiImplicitParams;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
@@ -13,6 +15,7 @@ import org.apache.commons.lang3.StringUtils;
|
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMethod;
|
|
import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
@@ -34,6 +37,8 @@ import java.util.Map;
|
|
|
public class WorkOrderApiController {
|
|
public class WorkOrderApiController {
|
|
|
private Logger logger = LoggerFactory.getLogger(getClass());
|
|
private Logger logger = LoggerFactory.getLogger(getClass());
|
|
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private TechnicianInfoService technicianInfoService;
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private WorkOrderService workOrderService;
|
|
private WorkOrderService workOrderService;
|
|
|
@Autowired
|
|
@Autowired
|
|
@@ -44,35 +49,122 @@ public class WorkOrderApiController {
|
|
|
private ConstructionProgressService constructionProgressService;
|
|
private ConstructionProgressService constructionProgressService;
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private CommentInfoService commentInfoService;
|
|
private CommentInfoService commentInfoService;
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private DataDictionaryService dataDictionaryService;
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private CustomerInfoService customerInfoService;
|
|
|
|
|
+
|
|
|
|
|
+ @ApiOperation(value="会员等级验证")
|
|
|
|
|
+ @RequestMapping(value = "checkVIP",method = RequestMethod.POST)
|
|
|
|
|
+ @ApiImplicitParams({
|
|
|
|
|
+ @ApiImplicitParam(name = "orderId", paramType = "query", required = true, value = "订单编号")
|
|
|
|
|
+ })
|
|
|
|
|
+ public MessageResult<Boolean> checkVIP(String orderId, HttpServletRequest request){
|
|
|
|
|
+ String subject = (String)request.getAttribute("subject");
|
|
|
|
|
+ MessageResult<Boolean> msgResult = new MessageResult<>();
|
|
|
|
|
+
|
|
|
|
|
+ if (!subject.isEmpty()) {
|
|
|
|
|
+ TechnicianInfo technicianInfo = technicianInfoService.get(subject);
|
|
|
|
|
+// WorkOrder workOrder = workOrderService.get(orderId);
|
|
|
|
|
+ ReceiveRequire receiveRequire = receiveRequireService.findByWorkOrderId(orderId);
|
|
|
|
|
+
|
|
|
|
|
+ if(receiveRequire.getLevel() > technicianInfo.getLevel()) {
|
|
|
|
|
+ msgResult.setResult(true);
|
|
|
|
|
+ msgResult.setData(false);
|
|
|
|
|
+ }
|
|
|
|
|
+ else {
|
|
|
|
|
+ msgResult.setResult(true);
|
|
|
|
|
+ msgResult.setData(true);
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ msgResult.setResult(false);
|
|
|
|
|
+ msgResult.setMessage("用户未登录");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return msgResult;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @ApiOperation(value="接单")
|
|
|
|
|
+ @RequestMapping(value = "acceptOrder",method = RequestMethod.POST)
|
|
|
|
|
+ @ApiImplicitParams({
|
|
|
|
|
+ @ApiImplicitParam(name = "orderId", paramType = "query", required = true, value = "订单编号")
|
|
|
|
|
+ })
|
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
|
|
+ public MessageResult<WorkOrder> acceptOrder(String orderId, HttpServletRequest request){
|
|
|
|
|
+ String subject = (String)request.getAttribute("subject");
|
|
|
|
|
+ MessageResult<WorkOrder> msgResult = new MessageResult<>();
|
|
|
|
|
+
|
|
|
|
|
+ if (!subject.isEmpty()) {
|
|
|
|
|
+ WorkOrder workOrder = workOrderService.get(orderId);
|
|
|
|
|
+ workOrder.setTechnicianId(subject);
|
|
|
|
|
+ workOrder.setStatus("2");
|
|
|
|
|
+ workOrder.setUpdateBy(subject);
|
|
|
|
|
+ workOrder.setUpdateTime(new Date());
|
|
|
|
|
+ workOrderService.update(workOrder);
|
|
|
|
|
+
|
|
|
|
|
+ ConstructionProgress constructionProgress = new ConstructionProgress();
|
|
|
|
|
+ constructionProgress.setId(UUID.randomUUID().toString());
|
|
|
|
|
+ constructionProgress.setTitle("师傅确认接单");
|
|
|
|
|
+ constructionProgress.setSubmitBy(subject);
|
|
|
|
|
+ constructionProgress.setSubmitType("2");
|
|
|
|
|
+ constructionProgress.setSubmitTime(new Date());
|
|
|
|
|
+ constructionProgress.setWorkOrderId(orderId);
|
|
|
|
|
+ Integer index = constructionProgressService.getIndex(orderId + 1);
|
|
|
|
|
+ if(index == null) {
|
|
|
|
|
+ index = 1;
|
|
|
|
|
+ }
|
|
|
|
|
+ constructionProgress.setIndex(index);
|
|
|
|
|
+ constructionProgress.setDelFlag(false);
|
|
|
|
|
+ constructionProgress.setCreateBy(subject);
|
|
|
|
|
+ constructionProgress.setCreateTime(new Date());
|
|
|
|
|
+ constructionProgressService.insert(constructionProgress);
|
|
|
|
|
+
|
|
|
|
|
+ msgResult.setResult(true);
|
|
|
|
|
+ msgResult.setData(workOrder);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ msgResult.setResult(false);
|
|
|
|
|
+ msgResult.setMessage("用户未登录");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return msgResult;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
@ApiOperation(value="列表")
|
|
@ApiOperation(value="列表")
|
|
|
@RequestMapping(value = "list",method = RequestMethod.POST)
|
|
@RequestMapping(value = "list",method = RequestMethod.POST)
|
|
|
@ApiImplicitParams({
|
|
@ApiImplicitParams({
|
|
|
- @ApiImplicitParam(name = "status", paramType = "query", required = true, value = "状态"),
|
|
|
|
|
|
|
+ @ApiImplicitParam(name = "status", paramType = "query", required = false, value = "状态"),
|
|
|
@ApiImplicitParam(name = "key", paramType = "query", required = false, value = "关键字"),
|
|
@ApiImplicitParam(name = "key", paramType = "query", required = false, value = "关键字"),
|
|
|
|
|
+ @ApiImplicitParam(name = "date", paramType = "query", required = false, value = "日期(yyyy-MM-dd)"),
|
|
|
})
|
|
})
|
|
|
public MessageResult<Map> list(
|
|
public MessageResult<Map> list(
|
|
|
- String status, String key,
|
|
|
|
|
|
|
+ String status, String key, String technicianId, String date,
|
|
|
@RequestParam(value="pageIndex",defaultValue="1") int pageIndex,
|
|
@RequestParam(value="pageIndex",defaultValue="1") int pageIndex,
|
|
|
- @RequestParam(value="pageSize",defaultValue="20") int pageSize,
|
|
|
|
|
- HttpServletRequest request){
|
|
|
|
|
- String subject = (String)request.getAttribute("subject");
|
|
|
|
|
-
|
|
|
|
|
|
|
+ @RequestParam(value="pageSize",defaultValue="20") int pageSize){
|
|
|
MessageResult<Map> msgResult = new MessageResult<>();
|
|
MessageResult<Map> msgResult = new MessageResult<>();
|
|
|
|
|
|
|
|
Map<String,Object> searchParams = new HashMap<>();
|
|
Map<String,Object> searchParams = new HashMap<>();
|
|
|
|
|
|
|
|
List<Sort> sortList = new ArrayList<>();
|
|
List<Sort> sortList = new ArrayList<>();
|
|
|
- sortList.add(new Sort("id_","asc"));
|
|
|
|
|
|
|
+ sortList.add(new Sort("create_time","desc"));
|
|
|
|
|
|
|
|
if (StringUtils.isNotEmpty(status)) {
|
|
if (StringUtils.isNotEmpty(status)) {
|
|
|
searchParams.put("status",status);
|
|
searchParams.put("status",status);
|
|
|
}
|
|
}
|
|
|
|
|
+ if (StringUtils.isNotEmpty(technicianId)) {
|
|
|
|
|
+ searchParams.put("technicianId",technicianId);
|
|
|
|
|
+ }
|
|
|
if (StringUtils.isNotEmpty(key)) {
|
|
if (StringUtils.isNotEmpty(key)) {
|
|
|
searchParams.put("key","%"+key+"%");
|
|
searchParams.put("key","%"+key+"%");
|
|
|
}
|
|
}
|
|
|
|
|
+ if (StringUtils.isNotEmpty(date)) {
|
|
|
|
|
+ searchParams.put("date",date+"%");
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
Page<WorkOrder> page = workOrderService.pageSearch(searchParams,pageIndex,pageSize,true,sortList);
|
|
Page<WorkOrder> page = workOrderService.pageSearch(searchParams,pageIndex,pageSize,true,sortList);
|
|
|
|
|
+ for(WorkOrder workOrder : page.getResult()) {
|
|
|
|
|
+ String statusName = dataDictionaryService.findNameByCatalogNameAndValue("工单状态",workOrder.getStatus());
|
|
|
|
|
+ workOrder.setStatusName(statusName);
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
msgResult.setResult(true);
|
|
msgResult.setResult(true);
|
|
|
msgResult.setData(PojoUtils.pageWrapper(page));
|
|
msgResult.setData(PojoUtils.pageWrapper(page));
|
|
@@ -88,12 +180,35 @@ public class WorkOrderApiController {
|
|
|
|
|
|
|
|
try {
|
|
try {
|
|
|
WorkOrder workOrder = workOrderService.get(id);
|
|
WorkOrder workOrder = workOrderService.get(id);
|
|
|
|
|
+ workOrder.setStatusName(dataDictionaryService.findNameByCatalogNameAndValue("工单状态",workOrder.getStatus()));
|
|
|
|
|
+
|
|
|
InstallationRequirement installationRequirement = installationRequirementService.findByWorkOrderId(id);
|
|
InstallationRequirement installationRequirement = installationRequirementService.findByWorkOrderId(id);
|
|
|
|
|
+ installationRequirement.setConstructionLocationName(dataDictionaryService.findNameByCatalogNameAndValue("施工位置",installationRequirement.getConstructionLocation()));
|
|
|
|
|
+ installationRequirement.setEnvironmentName(dataDictionaryService.findNameByCatalogNameAndValue("施工环境",installationRequirement.getEnvironment()));
|
|
|
|
|
+ installationRequirement.setMaterialName(dataDictionaryService.findNameByCatalogNameAndValue("水箱材质",installationRequirement.getMaterial()));
|
|
|
|
|
+ installationRequirement.setDifficultyName(dataDictionaryService.findNameByCatalogNameAndValue("施工难度",installationRequirement.getDifficulty()));
|
|
|
|
|
+
|
|
|
ReceiveRequire receiveRequire = receiveRequireService.findByWorkOrderId(id);
|
|
ReceiveRequire receiveRequire = receiveRequireService.findByWorkOrderId(id);
|
|
|
|
|
+
|
|
|
List<ConstructionProgress> constructionProgressList = constructionProgressService.findByWorkOrderId(id);
|
|
List<ConstructionProgress> constructionProgressList = constructionProgressService.findByWorkOrderId(id);
|
|
|
|
|
+ for(ConstructionProgress constructionProgress : constructionProgressList) {
|
|
|
|
|
+ switch (constructionProgress.getSubmitType()) {
|
|
|
|
|
+ case "1":
|
|
|
|
|
+ CustomerInfo customerInfo = customerInfoService.get(constructionProgress.getSubmitBy());
|
|
|
|
|
+ constructionProgress.setTitle("客户(" + customerInfo.getRealName() + ")" + constructionProgress.getTitle());
|
|
|
|
|
+ break;
|
|
|
|
|
+ case "2":
|
|
|
|
|
+ TechnicianInfo technicianInfo = technicianInfoService.get(constructionProgress.getSubmitBy());
|
|
|
|
|
+ constructionProgress.setTitle("师傅(" + technicianInfo.getRealName() + ")" + constructionProgress.getTitle());
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
List<CommentInfo> commentInfoList = commentInfoService.findByWorkOrderId(id);
|
|
List<CommentInfo> commentInfoList = commentInfoService.findByWorkOrderId(id);
|
|
|
|
|
+ TechnicianInfo technicianInfo = technicianInfoService.get(workOrder.getTechnicianId());
|
|
|
|
|
|
|
|
if (workOrder != null) {
|
|
if (workOrder != null) {
|
|
|
|
|
+ map.put("technician",technicianInfo);
|
|
|
map.put("info",workOrder);
|
|
map.put("info",workOrder);
|
|
|
map.put("detail",installationRequirement);
|
|
map.put("detail",installationRequirement);
|
|
|
map.put("require",receiveRequire);
|
|
map.put("require",receiveRequire);
|
|
@@ -185,7 +300,7 @@ public class WorkOrderApiController {
|
|
|
MessageResult<Map> msgResult = new MessageResult<>();
|
|
MessageResult<Map> msgResult = new MessageResult<>();
|
|
|
|
|
|
|
|
WorkOrder workOrder = workOrderService.get(orderId);
|
|
WorkOrder workOrder = workOrderService.get(orderId);
|
|
|
- workOrder.setStatus("3");
|
|
|
|
|
|
|
+ workOrder.setStatus("4");
|
|
|
workOrder.setUpdateBy(subject);
|
|
workOrder.setUpdateBy(subject);
|
|
|
workOrder.setUpdateTime(new Date());
|
|
workOrder.setUpdateTime(new Date());
|
|
|
workOrderService.update(workOrder);
|
|
workOrderService.update(workOrder);
|
|
@@ -201,17 +316,28 @@ public class WorkOrderApiController {
|
|
|
@ApiImplicitParams({
|
|
@ApiImplicitParams({
|
|
|
@ApiImplicitParam(name = "orderId", paramType = "query", required = true, value = "订单编号"),
|
|
@ApiImplicitParam(name = "orderId", paramType = "query", required = true, value = "订单编号"),
|
|
|
@ApiImplicitParam(name = "title", paramType = "query", required = true, value = "进度节点"),
|
|
@ApiImplicitParam(name = "title", paramType = "query", required = true, value = "进度节点"),
|
|
|
|
|
+ @ApiImplicitParam(name = "content", paramType = "query", required = true, value = "描述"),
|
|
|
@ApiImplicitParam(name = "images", paramType = "query", required = true, value = "图片路径(','分隔)"),
|
|
@ApiImplicitParam(name = "images", paramType = "query", required = true, value = "图片路径(','分隔)"),
|
|
|
|
|
+ @ApiImplicitParam(name = "isStart", paramType = "query", required = true, value = "是否入场"),
|
|
|
})
|
|
})
|
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
public MessageResult<Map> uploadProgress(
|
|
public MessageResult<Map> uploadProgress(
|
|
|
- String orderId, String title, String images,
|
|
|
|
|
|
|
+ String orderId, String title, String content, String images, Boolean isStart,
|
|
|
HttpServletRequest request){
|
|
HttpServletRequest request){
|
|
|
String subject = (String)request.getAttribute("subject");
|
|
String subject = (String)request.getAttribute("subject");
|
|
|
MessageResult<Map> msgResult = new MessageResult<>();
|
|
MessageResult<Map> msgResult = new MessageResult<>();
|
|
|
|
|
|
|
|
|
|
+ if(isStart) {
|
|
|
|
|
+ WorkOrder workOrder = workOrderService.get(orderId);
|
|
|
|
|
+ workOrder.setStatus("3");
|
|
|
|
|
+ workOrder.setUpdateBy(subject);
|
|
|
|
|
+ workOrder.setUpdateTime(new Date());
|
|
|
|
|
+ workOrderService.update(workOrder);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
ConstructionProgress constructionProgress = new ConstructionProgress();
|
|
ConstructionProgress constructionProgress = new ConstructionProgress();
|
|
|
constructionProgress.setId(UUID.randomUUID().toString());
|
|
constructionProgress.setId(UUID.randomUUID().toString());
|
|
|
- constructionProgress.setTitle(title);
|
|
|
|
|
|
|
+ constructionProgress.setTitle(title + content);
|
|
|
constructionProgress.setImage(images);
|
|
constructionProgress.setImage(images);
|
|
|
constructionProgress.setSubmitBy(subject);
|
|
constructionProgress.setSubmitBy(subject);
|
|
|
constructionProgress.setSubmitType("2");
|
|
constructionProgress.setSubmitType("2");
|