|
|
@@ -1,70 +1,181 @@
|
|
|
package com.jpsoft.employment.modules.base.service.impl;
|
|
|
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
-import java.util.UUID;
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
+import java.util.*;
|
|
|
import javax.annotation.Resource;
|
|
|
+
|
|
|
+import com.jpsoft.employment.modules.base.dao.*;
|
|
|
+import com.jpsoft.employment.modules.base.dto.WorkOrderAllDataDTO;
|
|
|
+import com.jpsoft.employment.modules.base.entity.*;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
-import com.jpsoft.employment.modules.base.dao.WorkOrderDAO;
|
|
|
-import com.jpsoft.employment.modules.base.entity.WorkOrder;
|
|
|
import com.jpsoft.employment.modules.base.service.WorkOrderService;
|
|
|
import com.github.pagehelper.Page;
|
|
|
import com.jpsoft.employment.modules.common.dto.Sort;
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
|
|
|
@Transactional
|
|
|
-@Component(value="workOrderService")
|
|
|
+@Component(value = "workOrderService")
|
|
|
public class WorkOrderServiceImpl implements WorkOrderService {
|
|
|
- @Resource(name="workOrderDAO")
|
|
|
- private WorkOrderDAO workOrderDAO;
|
|
|
-
|
|
|
- @Override
|
|
|
- public WorkOrder get(String id) {
|
|
|
- // TODO Auto-generated method stub
|
|
|
- return workOrderDAO.get(id);
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public int insert(WorkOrder model) {
|
|
|
- // TODO Auto-generated method stub
|
|
|
- //model.setId(UUID.randomUUID().toString());
|
|
|
-
|
|
|
- return workOrderDAO.insert(model);
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public int update(WorkOrder model) {
|
|
|
- // TODO Auto-generated method stub
|
|
|
- return workOrderDAO.update(model);
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public int delete(String id) {
|
|
|
- // TODO Auto-generated method stub
|
|
|
- return workOrderDAO.delete(id);
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public boolean exist(String id) {
|
|
|
- // TODO Auto-generated method stub
|
|
|
- int count = workOrderDAO.exist(id);
|
|
|
-
|
|
|
- return count > 0 ? true : false;
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public List<WorkOrder> list() {
|
|
|
- // TODO Auto-generated method stub
|
|
|
- return workOrderDAO.list();
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public Page<WorkOrder> pageSearch(Map<String, Object> searchParams, int pageNumber, int pageSize,boolean count,List<Sort> sortList) {
|
|
|
- Page<WorkOrder> page = PageHelper.startPage(pageNumber,pageSize,count).doSelectPage(()->{
|
|
|
- workOrderDAO.search(searchParams,sortList);
|
|
|
+ @Resource(name = "workOrderDAO")
|
|
|
+ private WorkOrderDAO workOrderDAO;
|
|
|
+
|
|
|
+ @Resource(name = "installationRequirementDAO")
|
|
|
+ private InstallationRequirementDAO installationRequirementDAO;
|
|
|
+
|
|
|
+ @Resource(name = "receiveRequireDAO")
|
|
|
+ private ReceiveRequireDAO receiveRequireDAO;
|
|
|
+
|
|
|
+ @Resource(name = "technicianInfoDAO")
|
|
|
+ private TechnicianInfoDAO technicianInfoDAO;
|
|
|
+
|
|
|
+ @Resource(name = "commentInfoDAO")
|
|
|
+ private CommentInfoDAO commentInfoDAO;
|
|
|
+
|
|
|
+ @Resource(name = "customerInfoDAO")
|
|
|
+ private CustomerInfoDAO customerInfoDAO;
|
|
|
+
|
|
|
+ @Resource(name = "constructionProgressDAO")
|
|
|
+ private ConstructionProgressDAO constructionProgressDAO;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public WorkOrder get(String id) {
|
|
|
+ // TODO Auto-generated method stub
|
|
|
+ return workOrderDAO.get(id);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public int insert(WorkOrder model) {
|
|
|
+ // TODO Auto-generated method stub
|
|
|
+ //model.setId(UUID.randomUUID().toString());
|
|
|
+
|
|
|
+ return workOrderDAO.insert(model);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public int update(WorkOrder model) {
|
|
|
+ // TODO Auto-generated method stub
|
|
|
+ return workOrderDAO.update(model);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public int delete(String id) {
|
|
|
+ // TODO Auto-generated method stub
|
|
|
+ return workOrderDAO.delete(id);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public boolean exist(String id) {
|
|
|
+ // TODO Auto-generated method stub
|
|
|
+ int count = workOrderDAO.exist(id);
|
|
|
+
|
|
|
+ return count > 0 ? true : false;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<WorkOrder> list() {
|
|
|
+ // TODO Auto-generated method stub
|
|
|
+ return workOrderDAO.list();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public WorkOrderAllDataDTO getDtoList(WorkOrder workOrder) {
|
|
|
+
|
|
|
+ String id = workOrder.getId();
|
|
|
+
|
|
|
+ SimpleDateFormat sdf=new SimpleDateFormat("yyyy/MM/dd");
|
|
|
+
|
|
|
+ WorkOrderAllDataDTO dto = new WorkOrderAllDataDTO();
|
|
|
+
|
|
|
+ InstallationRequirement installationRequirement = installationRequirementDAO.findByWorkOrderId(workOrder.getId());
|
|
|
+ dto.setInstallationRequirement(installationRequirement);
|
|
|
+
|
|
|
+ ReceiveRequire receiveRequire = receiveRequireDAO.findByWorkOrderId(id);
|
|
|
+ dto.setReceiveRequire(receiveRequire);
|
|
|
+
|
|
|
+ dto.setCustomerName(workOrder.getCustomerName());
|
|
|
+ dto.setCustomerPhone(workOrder.getCustomerPhone());
|
|
|
+
|
|
|
+ List<String> imageList = new ArrayList<>();
|
|
|
+
|
|
|
+ if (StringUtils.isNotEmpty(workOrder.getImage())) {
|
|
|
+ String[] imageArr = workOrder.getImage().split(",");
|
|
|
+ imageList = Arrays.asList(imageArr);
|
|
|
+ }
|
|
|
+
|
|
|
+ dto.setImageList(imageList);
|
|
|
+
|
|
|
+ dto.setWorkOrder(workOrder);
|
|
|
+
|
|
|
+ TechnicianInfo technicianInfo = technicianInfoDAO.get(workOrder.getTechnicianId());
|
|
|
+
|
|
|
+ if (technicianInfo != null) {
|
|
|
+ dto.setTechnicianInfo(technicianInfo);
|
|
|
+ }
|
|
|
+
|
|
|
+ List<CommentInfo> commentInfoList = commentInfoDAO.findByWorkOrderId(id);
|
|
|
+
|
|
|
+ for (CommentInfo commentInfo : commentInfoList) {
|
|
|
+ //获取评论人
|
|
|
+ CustomerInfo customerInfo = customerInfoDAO.get(commentInfo.getCompanyId());
|
|
|
+ if (customerInfo != null) {
|
|
|
+ commentInfo.setCompanyName(customerInfo.getRealName());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ dto.setCommentInfoList(commentInfoList);
|
|
|
+
|
|
|
+ List<ConstructionProgress> ConstructionProgressList = constructionProgressDAO.findByWorkOrderId(id);
|
|
|
+
|
|
|
+ for (ConstructionProgress constructionProgress : ConstructionProgressList) {
|
|
|
+ List<String> imageListPro = new ArrayList<>();
|
|
|
+ if (StringUtils.isNotEmpty(constructionProgress.getImage())) {
|
|
|
+ String[] imageArr = constructionProgress.getImage().split(",");
|
|
|
+ imageListPro = Arrays.asList(imageArr);
|
|
|
+ }
|
|
|
+
|
|
|
+ constructionProgress.setImageList(imageListPro);
|
|
|
+
|
|
|
+ if ("1".equals(constructionProgress.getSubmitType())) {
|
|
|
+ CustomerInfo customerInfo = customerInfoDAO.get(constructionProgress.getSubmitBy());
|
|
|
+ if (customerInfo != null) {
|
|
|
+ constructionProgress.setSubmitByN(customerInfo.getRealName());
|
|
|
+ }
|
|
|
+ } else if ("2".equals(constructionProgress.getSubmitType())) {
|
|
|
+ TechnicianInfo technicianInfo1 = technicianInfoDAO.get(constructionProgress.getSubmitBy());
|
|
|
+ if (technicianInfo1 != null) {
|
|
|
+ constructionProgress.setSubmitByN(technicianInfo1.getRealName());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ constructionProgress.setSubmitDate(sdf.format(constructionProgress.getSubmitTime()));
|
|
|
+ }
|
|
|
+
|
|
|
+ dto.setConstructionProgressList(ConstructionProgressList);
|
|
|
+
|
|
|
+ return dto;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Page<WorkOrder> pageSearch(Map<String, Object> searchParams, int pageNumber, int pageSize, boolean count, List<Sort> sortList) {
|
|
|
+ Page<WorkOrder> page = PageHelper.startPage(pageNumber, pageSize, count).doSelectPage(() -> {
|
|
|
+ workOrderDAO.search(searchParams, sortList);
|
|
|
+ });
|
|
|
+
|
|
|
+ return page;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Page<WorkOrder> pageSearchMobile(Map<String, Object> searchParams, int pageNumber, int pageSize, boolean count, List<Sort> sortList) {
|
|
|
+ Page<WorkOrder> page = PageHelper.startPage(pageNumber, pageSize, count).doSelectPage(() -> {
|
|
|
+ workOrderDAO.searchMobile(searchParams, sortList);
|
|
|
});
|
|
|
-
|
|
|
+
|
|
|
return page;
|
|
|
- }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|