| package doumeemes.service.ext.impl; | 
|   | 
| import com.github.pagehelper.PageHelper; | 
| import com.github.pagehelper.PageInfo; | 
| import doumeemes.core.model.LoginUserInfo; | 
| import doumeemes.core.model.PageData; | 
| import doumeemes.core.model.PageWrap; | 
| import doumeemes.dao.business.model.Appliances; | 
| import doumeemes.dao.business.model.WorkorderCheck; | 
| import doumeemes.dao.ext.CategoryUnionExtMapper; | 
| import doumeemes.dao.ext.dto.QueryCategoryUnionExtDTO; | 
| import doumeemes.dao.ext.vo.CategoryUnionExtListVO; | 
| import doumeemes.service.business.impl.AppliancesServiceImpl; | 
| import doumeemes.service.business.impl.WorkorderCheckServiceImpl; | 
| import doumeemes.service.ext.CategoryUnionExtService; | 
| import org.apache.commons.lang3.StringUtils; | 
| import org.apache.shiro.SecurityUtils; | 
| import org.springframework.beans.factory.annotation.Autowired; | 
| import org.springframework.stereotype.Service; | 
|   | 
| import java.util.ArrayList; | 
| import java.util.List; | 
|   | 
| /** | 
|  * 分类组合信息Service实现 | 
|  * | 
|  * @author 江蹄蹄 | 
|  * @date 2022/04/27 16:15 | 
|  */ | 
| @Service | 
| public class CategoryUnionExtServiceImpl implements CategoryUnionExtService { | 
|   | 
|     @Autowired | 
|     private CategoryUnionExtMapper categoryUnionExtMapper; | 
|   | 
|     @Autowired | 
|     private AppliancesServiceImpl appliancesServiceimpl; | 
|     @Autowired | 
|     private WorkorderCheckServiceImpl workorderCheckServiceimpl; | 
|   | 
|   | 
|     @Override | 
|     public PageData<CategoryUnionExtListVO> findPage(PageWrap<QueryCategoryUnionExtDTO> pageWrap) { | 
|         PageHelper.startPage(pageWrap.getPage(), pageWrap.getCapacity()); | 
|         List<CategoryUnionExtListVO> result = categoryUnionExtMapper.selectList(pageWrap.getModel()); | 
|         if (result.size() > 0) { | 
|             for (int i = 0; i < result.size(); i++) { | 
|                 CategoryUnionExtListVO ca = result.get(i); | 
|                 String bname = ca.getBmodel() != null ? ca.getBmodel().getName() : ""; | 
|                 String mname = ca.getMmodel() != null ? "-" + ca.getMmodel().getName() : ""; | 
|                 String cname = ca.getCmodel() != null ? "-" + ca.getCmodel().getName() : ""; | 
|                 ca.setCombinationName(bname + mname + cname); | 
|                 String catetype = ca.getBmodel() != null ? ca.getBmodel().getCateType() : ""; | 
|                 ca.setUnionCateType(catetype); | 
|             } | 
|         } | 
|         return PageData.from(new PageInfo<>(result)); | 
|     } | 
|   | 
|     @Override | 
|     public List<CategoryUnionExtListVO> getCategoryUnionListByOrg(QueryCategoryUnionExtDTO qcu) { | 
|         List<CategoryUnionExtListVO> result = categoryUnionExtMapper.selectList(qcu); | 
|         if (result.size() > 0) { | 
|             for (int i = 0; i < result.size(); i++) { | 
|                 CategoryUnionExtListVO ca = result.get(i); | 
|                 String bname = ca.getBmodel() != null ? ca.getBmodel().getName() : ""; | 
|                 String mname = ca.getMmodel() != null ? "-" + ca.getMmodel().getName() : ""; | 
|                 String cname = ca.getCmodel() != null ? "-" + ca.getCmodel().getName() : ""; | 
|                 ca.setCombinationName(bname + mname + cname); | 
|                 String catetype = ca.getBmodel() != null ? ca.getBmodel().getCateType() : ""; | 
|                 ca.setUnionCateType(catetype); | 
|             } | 
|         } | 
|         return result; | 
|     } | 
|   | 
|   | 
|     @Override | 
|     public List<CategoryUnionExtListVO> checkAllList(QueryCategoryUnionExtDTO pageWrap) { | 
|         List<CategoryUnionExtListVO> result = categoryUnionExtMapper.selectList(pageWrap); | 
|         if (result.size() > 0) { | 
|             for (int i = 0; i < result.size(); i++) { | 
|                 CategoryUnionExtListVO ca = result.get(i); | 
|                 String bname = ca.getBmodel() != null ? ca.getBmodel().getName() : ""; | 
|                 String mname = ca.getMmodel() != null ? "-" + ca.getMmodel().getName() : ""; | 
|                 String cname = ca.getCmodel() != null ? "-" + ca.getCmodel().getName() : ""; | 
|                 ca.setCombinationName(bname + mname + cname); | 
|                 String catetype = ca.getBmodel() != null ? ca.getBmodel().getCateType() : ""; | 
|                 ca.setUnionCateType(catetype); | 
|             } | 
|         } | 
|         return result; | 
|     } | 
|   | 
|   | 
|     @Override | 
|     public List<CategoryUnionExtListVO> checkFGFXList(String applianceid) { | 
|         LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); | 
|         if (StringUtils.isNotEmpty(applianceid)) { | 
|             String[] ids = applianceid.split(","); | 
|             List<CategoryUnionExtListVO> alllist = new ArrayList<>(); | 
|             for (String id : ids) { | 
|                 Appliances appliances = appliancesServiceimpl.findById(Integer.valueOf(id)); | 
|                 WorkorderCheck workorderCheck = new WorkorderCheck(); | 
|                 workorderCheck.setWorkorderId(appliances.getWorkorderId()); | 
|                 workorderCheck.setRootDepartId(user.getRootDepartment().getId()); | 
|   | 
|                 List<WorkorderCheck> workorderCheckslist = workorderCheckServiceimpl.findList(workorderCheck); | 
|                 if (workorderCheckslist.size() > 0) { | 
|                     for (int j = 0; j < workorderCheckslist.size(); j++) { | 
|                         WorkorderCheck wc = workorderCheckslist.get(j); | 
|   | 
|                         if (StringUtils.isNotEmpty(wc.getCheckInfo())) { | 
|                             QueryCategoryUnionExtDTO pageWrap = new QueryCategoryUnionExtDTO(); | 
|                             pageWrap.setId(Integer.valueOf(wc.getCheckInfo().trim())); | 
|                             List<CategoryUnionExtListVO> result = categoryUnionExtMapper.selectList(pageWrap); | 
|                             if (result.size() > 0) { | 
|                                 for (int i = 0; i < result.size(); i++) { | 
|                                     CategoryUnionExtListVO ca = result.get(i); | 
|                                     String bname = ca.getBmodel() != null ? ca.getBmodel().getName() : ""; | 
|                                     String mname = ca.getMmodel() != null ? "-" + ca.getMmodel().getName() : ""; | 
|                                     String cname = ca.getCmodel() != null ? "-" + ca.getCmodel().getName() : ""; | 
|                                     ca.setCombinationName(bname + mname + cname); | 
|                                     String catetype = ca.getBmodel() != null ? ca.getBmodel().getCateType() : ""; | 
|                                     ca.setUnionCateType(catetype); | 
|                                 } | 
|                                 alllist.addAll(result); | 
|                             } | 
|   | 
|                         } | 
|   | 
|                     } | 
|   | 
|                 } | 
|   | 
|             } | 
|             return alllist; | 
|         } | 
|         return null; | 
|     } | 
| } |