¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.vci.test; |
| | | |
| | | import com.vci.starter.web.annotation.controller.VciUnCheckRight; |
| | | import com.vci.starter.web.pagemodel.BaseResult; |
| | | import com.vci.starter.web.pagemodel.Tree; |
| | | import com.vci.web.service.WebBoServiceI; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @Description æµè¯æ§å¶å¨ |
| | | * @Author dangsn |
| | | * @Date 2024/11/14 10:08 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/dataTestController") |
| | | public class DataTestController { |
| | | |
| | | @Resource |
| | | private WebBoServiceI boServiceI; |
| | | |
| | | /** |
| | | * è·å产å |
| | | * @return |
| | | */ |
| | | @VciUnCheckRight |
| | | @GetMapping("/getProduct") |
| | | public BaseResult getProduct(){ |
| | | String sql = "select * from platformbtm_workcontext where workcontexttype = 'product'"; |
| | | List<Map> productList = boServiceI.queryByOnlySqlForMap(sql); |
| | | BaseResult baseResult = new BaseResult(); |
| | | baseResult.setSuccess(true); |
| | | baseResult.setCode(200); |
| | | baseResult.setData(productList); |
| | | return baseResult; |
| | | } |
| | | |
| | | /** |
| | | * è·åebomä¿¡æ¯ |
| | | * @param parentOid ä¸çº§ä¿¡æ¯ |
| | | * @return |
| | | */ |
| | | @VciUnCheckRight |
| | | @GetMapping("/getEbomInfo") |
| | | public BaseResult getEbomInfo(String productNo, String productOid, String parentOid){ |
| | | if(StringUtils.isBlank(productNo)){ |
| | | return BaseResult.fail("产åç¼å·ä¸ºç©ºï¼"); |
| | | } |
| | | if(StringUtils.isBlank(productOid)){ |
| | | return BaseResult.fail("产å主é®ä¸ºç©ºï¼"); |
| | | } |
| | | BaseResult baseResult = new BaseResult(); |
| | | List<Map> ebomList; |
| | | if(StringUtils.isBlank(parentOid)){ |
| | | String sql = "select * from platformbtm_part t where t.ownproduct = '"+productOid+"' and t.code = '"+productNo+"'"; |
| | | ebomList = boServiceI.queryByOnlySqlForMap(sql); |
| | | |
| | | }else{ |
| | | String sql = "select p.*,e.oid as eoid from platformbtm_part p left join platformlt_ebom e on p.oid = e.t_oid \n" + |
| | | "where e.f_oid = '"+parentOid+"' and e.workcontextoid = '"+productOid+"' \n" + |
| | | "and p.islastr = '1' and p.islastv = '1' order by p.code asc"; |
| | | ebomList = boServiceI.queryByOnlySqlForMap(sql); |
| | | } |
| | | List<Tree> treeList = new ArrayList<>(); |
| | | if(!CollectionUtils.isEmpty(ebomList)){ |
| | | for(Map ebom : ebomList){ |
| | | String oid = ebom.get("OID").toString(); |
| | | String id = ebom.get("CODE").toString(); |
| | | String name = ebom.get("NAME").toString(); |
| | | String revisionvalue = ebom.get("REVISIONVALUE").toString(); |
| | | String versionrule = ebom.get("VERSIONRULE").toString(); |
| | | String versionvalue = ebom.get("VERSIONVALUE").toString(); |
| | | String parttype = ebom.get("PARTTYPE").toString(); |
| | | String lcStatus = ebom.get("LCSTATUS").toString(); |
| | | String parttypetext = ""; |
| | | String lcStatusText = ""; |
| | | if(parttype.equals("20")){ |
| | | parttypetext = "产å"; |
| | | } |
| | | if(parttype.equals("6")){ |
| | | parttypetext = "è£
é
ä»¶"; |
| | | } |
| | | if(parttype.equals("7")){ |
| | | parttypetext = "é¶ä»¶"; |
| | | } |
| | | if(parttype.equals("8")){ |
| | | parttypetext = "æ åä»¶"; |
| | | } |
| | | if(lcStatus.equals("Editing")){ |
| | | lcStatusText = "ç¼è¾ä¸"; |
| | | } |
| | | if(lcStatus.equals("Published")){ |
| | | lcStatusText = "å·²åå¸"; |
| | | } |
| | | Tree tree = new Tree(); |
| | | tree.setLeaf(false); |
| | | tree.setExpanded(false); |
| | | tree.setOid(oid); |
| | | tree.setId(id); |
| | | tree.setText(id+" "+name+"["+parttypetext+"]["+revisionvalue+versionrule+versionvalue+"]ã"+lcStatusText+"ã"); |
| | | if(StringUtils.isNotBlank(parentOid)){ |
| | | tree.setParentId(parentOid); |
| | | } |
| | | if(ebom.containsKey("EOID")){ |
| | | Map<String, String> atrrMap = new HashMap<>(); |
| | | atrrMap.put("eoid", ebom.get("EOID").toString()); |
| | | tree.setAttributes(atrrMap); |
| | | } |
| | | treeList.add(tree); |
| | | } |
| | | } |
| | | baseResult.setData(treeList); |
| | | baseResult.setSuccess(true); |
| | | baseResult.setCode(200); |
| | | return baseResult; |
| | | } |
| | | } |