Ver Fonte

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	ttc-app/src/main/resources/application-dev.yml
#	ttc-backen/src/main/java/cn/ubitech/ttc/service/impl/label/LabelCommonService.java
liyisong há 4 anos atrás
pai
commit
f5203eeac1

+ 2 - 1
ttc-app/src/main/java/cn/ubitech/ttc/controller/DataToolsController.java

@@ -165,7 +165,7 @@ public class DataToolsController {
             @ApiImplicitParam(name = "requestModel", value = "通用请求接口,data中为ConnectioninfoModel")
     })
     public ResultModel insertOrUpdateConnectionInfo(@RequestBody RequestModel requestModel) {
-        System.out.println("新建或者更新走访基本信息:" + JSON.toJSONString(requestModel));
+        System.out.println("interview/conninfo 新建或者更新走访基本信息:" + JSON.toJSONString(requestModel));
         ResultModel resultModel = new ResultModel();
         try {
             ConnectioninfoModel connectioninfoModel = Util.fromJson(Util.toJson(requestModel.getData()), ConnectioninfoModel.class);
@@ -278,6 +278,7 @@ public class DataToolsController {
     public ResultModel insertOrUpdateCompanyHighleveltalents(@RequestBody RequestModel requestModel) {
         ResultModel resultModel = new ResultModel();
         List<CompanyHighleveltalentsLk> requestList = Util.fromJson2List(Util.toJson(requestModel.getData()), CompanyHighleveltalentsLk[].class);
+        System.err.println("requestListrequestListrequestListrequestList:{}" + JSON.toJSONString(requestList));
         try {
             List<CompanyHighleveltalentsLk> resultList = new ArrayList<CompanyHighleveltalentsLk>();
             if (requestList != null && requestList.size() > 0) {

+ 8 - 1
ttc-app/src/main/java/cn/ubitech/ttc/controller/LabelController.java

@@ -8,8 +8,11 @@ import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
+import sun.rmi.runtime.Log;
+
 import java.util.Map;
 import java.util.Set;
 
@@ -42,6 +45,7 @@ import java.util.Set;
 @RestController
 @RequestMapping("/label")
 @Api(description = "标签系统相关接口")
+@Slf4j
 public class LabelController {
 
     @Autowired
@@ -136,7 +140,10 @@ public class LabelController {
     public ResultModel delIntelligent(@PathVariable Long resid, @PathVariable String labelName, @PathVariable String node, @PathVariable Long labelId) {
         ResultModel resultModel = new ResultModel();
         try {
-            resultModel.setData(labelCommonService.delIntelligent(resid, labelName, node, labelId));
+            Boolean delFlag = labelCommonService.delIntelligent(resid, labelName, node, labelId);
+            log.info("delFlag:{}",delFlag);
+            resultModel.setCode(delFlag == true ? Constant.INTERFACE_STATUS_CODE_3350 : Constant.INTERFACE_STATUS_CODE_3351);
+            resultModel.setData(delFlag);
         } catch (Exception e) {
             System.out.println(e.toString());
             resultModel.setCode(Constant.INTERFACE_STATUS_CODE_3351);

+ 7 - 1
ttc-app/src/main/java/cn/ubitech/ttc/controller/ResourceController.java

@@ -18,11 +18,13 @@ import cn.ubitech.ttc.service.impl.resource.ResourceServiceImpl;
 import cn.ubitech.ttc.service.impl.resourceChoice.ResouceChoiceServiceImpl;
 import cn.ubitech.ttc.service.impl.search.SearchServiceImpl;
 import cn.ubitech.ttc.service.impl.user.UserServiceImpl;
+import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.mapper.EntityWrapper;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.io.IOUtils;
 import org.apache.commons.lang.StringUtils;
@@ -71,6 +73,7 @@ import java.util.Set;
 @RestController
 @RequestMapping("/resource")
 @Api(description = "资源库接口")
+@Slf4j
 public class ResourceController {
 
     @Autowired
@@ -115,6 +118,8 @@ public class ResourceController {
     public ResultModel getResourcelist(@PathVariable String keyword, @PathVariable Integer pagenum, @PathVariable long userid,
                                        @PathVariable String sort, @PathVariable String groupid, @PathVariable Integer moduleid,
                                        @PathVariable String category, @PathVariable Integer tracetype, @PathVariable String labelName, @PathVariable String node) {
+        log.info("keyword:{},userid:{},sort:{},groupid:{},moduleid:{},category:{},tracetype:{},labelName:{},node:{}",keyword,userid,sort,groupid,moduleid,category,tracetype,
+                          labelName,node);
         ResultModel resultModel = new ResultModel();
         try {
             if (moduleid != 0) {
@@ -188,7 +193,7 @@ public class ResourceController {
         try {
             resultModel.setData(resourceServiceImpl.getResourceDetail(resourceid, userid, node, pagecode, innertype));
             //
-            //显示该条资源的关键词
+            // 显示该条资源的关键词,detail/111129/8/3002/320117400/1000001/0
             resultModel.setOtherObj(labelRecordService.taskInfoKeywordList(resourceid, node));
 
         } catch (Exception e) {//异常
@@ -271,6 +276,7 @@ public class ResourceController {
         ResultModel resultModel = new ResultModel();
         try {
             List<ConinfoClassification> list = resourceServiceImpl.getConClaidByNode(node, keyword.trim(), userid);
+            log.info("***list:{}", JSON.toJSONString(list));
             resultModel.setData(list);
         } catch (Exception e) {//异常
             resultModel.setCode(Constant.INTERFACE_STATUS_CODE_3351);

+ 1 - 1
ttc-app/src/main/resources/application-dev.yml

@@ -13,7 +13,7 @@ spring:
     elasticsearch:
       cluster-name: ttc_test_es
       #      cluster-nodes: 192.168.0.28:9300,192.168.0.29:9300,192.168.0.30:9300
-      cluster-nodes: 192.168.1.110:9300,192.168.1.110:9301,192.168.1.110:9302
+      cluster-nodes: 192.168.1.127:9300,192.168.1.127:9301,192.168.1.127:9302
       #      typename: esttc
       #      indexname: ttcdev
       #      label_common_indexname: label_common_dev

+ 4 - 4
ttc-app/src/main/resources/application.yml

@@ -1,14 +1,14 @@
 server:
 #  port: 8080
   port: 8089
-#  tomcat:
-#    max-connections: 30000
-#  connection-timeout: 3000000
+  tomcat:
+    max-connections: 30000
+  connection-timeout: 3000000
 spring:
   profiles:
     active: dev
 #    active: test
-#    active: prod
+#    active: prodr
   cache:
     ehcache:
       config: classpath:ehcache-config.xml

+ 1 - 1
ttc-backen/src/main/java/cn/ubitech/ttc/service/impl/common/InfoPageServiceImpl.java

@@ -793,7 +793,7 @@ public class InfoPageServiceImpl {
             System.out.println("lll:" + JSON.toJSONString(l));
             InfoUnitModel unitModel = new InfoUnitModel();
             Util.fatherToChild(l, unitModel);
-            // todo ghj 此处待开发。
+            // todo ghj 此处待开发。0629
             unitModel.setContent("");
             // unitModel.setContent(l.getFathercolumnname().equals("contact") ? "test" : "");
             // System.out.println("l.getFathercolumnname():" + l.getFathercolumnname());

+ 7 - 1
ttc-backen/src/main/java/cn/ubitech/ttc/service/impl/datatools/DataEntryResourceImpl.java

@@ -12,6 +12,7 @@ import cn.ubitech.ttc.repository.ResourceRepository;
 import cn.ubitech.ttc.service.impl.common.CommonServiceImpl;
 import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.mapper.EntityWrapper;
+import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.collections4.CollectionUtils;
 import org.apache.commons.lang.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -52,6 +53,7 @@ import java.util.*;
  * @Description: 数据导入到资源库service
  */
 @Service
+@Slf4j
 public class DataEntryResourceImpl {
     @Autowired
     private ResDtLkMapper resDtLkMapper;
@@ -455,8 +457,10 @@ public class DataEntryResourceImpl {
      * @param resourcelibrary
      */
     public void insertES(Resourcelibrary resourcelibrary, String claid, String node) {
+        log.info("资源库同步至索引库insertEs...");
+        log.info("insertEs param resourcelibrary:{},claid:{},node:{}",JSON.toJSONString(resourcelibrary),claid,node);
         ElasticSearchTTCModel elasticSearchTTCModel = transferToElasticSearch(resourcelibrary, claid, node);
-        System.out.println("资源转ES库Model" + JSON.toJSONString(elasticSearchTTCModel));
+        log.info("transferToElasticSearch 资源转ES库Model", JSON.toJSONString(elasticSearchTTCModel));
         SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
         if (StringUtils.isBlank(elasticSearchTTCModel.getTimestamp())) {
             elasticSearchTTCModel.setTimestamp(simpleDateFormat.format(new Date()));
@@ -473,6 +477,7 @@ public class DataEntryResourceImpl {
             }
         }
         resourceRepository.save(elasticSearchTTCModel);
+        log.info("save after:{}",JSON.toJSONString(elasticSearchTTCModel));
     }
 
     /**
@@ -879,6 +884,7 @@ public class DataEntryResourceImpl {
         elasticSearchTTCModel.setType(getResType(resourcelibrary));
         elasticSearchTTCModel.setUnique(String.valueOf(resourcelibrary.getId()));
         elasticSearchTTCModel.setId(resourcelibrary.getSnowflakeid());
+        log.info("set content:{}",resourcelibrary.getContent());
         elasticSearchTTCModel.setContent(resourcelibrary.getContent());
         elasticSearchTTCModel.setSummary(resourcelibrary.getSummary());
         elasticSearchTTCModel.setTitle(resourcelibrary.getTitle());

+ 157 - 21
ttc-backen/src/main/java/cn/ubitech/ttc/service/impl/datatools/InterviewDataEntryServiceImpl.java

@@ -578,14 +578,18 @@ public class InterviewDataEntryServiceImpl implements IDataEntryService {
      */
     @Transactional
     public ConnectioninfoModel insertOrUpdate(ConnectioninfoModel connectioninfoModel, String node, long pagecode, String pagetitle) {
+        log.info("param connectioninfoModel:{}",connectioninfoModel.getOrgcontent());
         if (connectioninfoModel.getOrganizationInfo().getId() == null) {
+            log.info("connectioninfoModel.getOrganizationInfo().getId() == null ...");
             List<OrganizationInfo> orglist = organizationInfoMapper.getOrgListByNode(connectioninfoModel.getOrganizationInfo().getName(), node);
             if (CollectionUtils.isNotEmpty(orglist)) {
+                log.info("orglist is not empty...");
                 connectioninfoModel.getOrganizationInfo().setId(orglist.get(0).getId());
             }
         }
-        if (connectioninfoModel.getId() == null || connectioninfoModel.getId() == 0) {//新增对接信息
-
+        if (connectioninfoModel.getId() == null || connectioninfoModel.getId() == 0) {
+            //新增对接信息
+            log.info("新增对接信息...connectioninfoModel.getId() == null || connectioninfoModel.getId() == 0");
             UserModel user = connectioninfoModel.getUserModel();
             if (user.getUserid() == 0 && "330122000".equals(node) && pagecode == 1000027L) {
                 connectioninfoModel.setCreator(2198L);
@@ -827,18 +831,23 @@ public class InterviewDataEntryServiceImpl implements IDataEntryService {
             //insertContentLabel(Long.valueOf(node), connectioninfoModel.getPagecode(), connectioninfoModel.getId(), connectioninfoModel.getOrgcontent());
             //insertLabelForConn(Long.valueOf(node), connectioninfoModel.getPagecode(), connectioninfoModel.getId(), connectioninfoModel.getOrgcontent());
 
-        } else {//修改对接信息
-
+        } else {
+            // 修改对接信息
+            log.info("修改对接信息...connectioninfoModel.getId() == null || connectioninfoModel.getId() == 0 else else else...");
             connectioninfoModel.setUpdatetime(new Date());
-
+            log.info("getOrgType:{}",connectioninfoModel.getOrganizationInfo().getOrgtype());
             //新标签系统走访时修改标签
             if (connectioninfoModel.getOrganizationInfo().getOrgtype() == 10104L) {
                 //企业
-                updateIntelligentLabel(Long.valueOf(node), Integer.valueOf(String.valueOf(connectioninfoModel.getPagecode())), Integer.valueOf(String.valueOf(connectioninfoModel.getId())), String.valueOf(connectioninfoModel.getCategoryid()),
-                        connectioninfoModel.getIshigh() == null ? "0" : String.valueOf(connectioninfoModel.getOrggradecode()), connectioninfoModel.getCompanyplabelname() == null ? "0" : connectioninfoModel.getCompanyplabelname());
+                log.info("企业...");
+                updateIntelligentLabel(Long.valueOf(node), Integer.valueOf(String.valueOf(connectioninfoModel.getPagecode())),
+                        Integer.valueOf(String.valueOf(connectioninfoModel.getId())), String.valueOf(connectioninfoModel.getCategoryid()),
+                        connectioninfoModel.getIshigh() == null ? "0" : String.valueOf(connectioninfoModel.getOrggradecode()),
+                        connectioninfoModel.getCompanyplabelname() == null ? "0" : connectioninfoModel.getCompanyplabelname());
             }
             if (connectioninfoModel.getOrganizationInfo().getOrgtype() == 10105L) {
                 //高校
+                log.info("高校...");
                 updateIntelligentLabel(Long.valueOf(node), Integer.valueOf(String.valueOf(connectioninfoModel.getPagecode())), Integer.valueOf(String.valueOf(connectioninfoModel.getId())),
                         connectioninfoModel.getOrggradecode() == null ? "0" : String.valueOf(connectioninfoModel.getOrggradecode()), connectioninfoModel.getCompanyplabelname() == null ? "0" : connectioninfoModel.getCompanyplabelname());
             }
@@ -846,49 +855,99 @@ public class InterviewDataEntryServiceImpl implements IDataEntryService {
             //修改自定义标签
             updateUserDefinedLabel(Long.valueOf(node), connectioninfoModel.getPagecode(), connectioninfoModel.getId(), connectioninfoModel.getCompanyplabelname());
             //标签记录表中修改简介中行业信息
+            log.info("connectioninfoModel.getOrgcontent():{}",connectioninfoModel.getOrgcontent());
             updateContentLabel(Long.valueOf(node), connectioninfoModel.getPagecode(), connectioninfoModel.getId(), connectioninfoModel.getOrgcontent());
 
             //资源库导入的数据,需要将connid设置为resourceId
+            log.info("IS_RESOURCE_ADD_FLAG:{}",Util.IS_RESOURCE_ADD_FLAG);
             if (Util.IS_RESOURCE_ADD_FLAG == true) {
                 connectioninfoModel.setIsresourcelibrarydata(1);
             }
-            if ("新增企业信息".equals(pagetitle) || "完善企业信息".equals(pagetitle)) {
+            log.info("pagetitle:{}",pagetitle);
+            if ("新增企业信息".equals(pagetitle) || "完善企业信息".equals(pagetitle) || "编辑走访".equals(pagetitle)) {
+                log.info("新增企业信息 || 完善企业信息。");
                 connectioninfoModel.setBy1(1);
 
                 OrganizationInfo organizationInfo = connectioninfoModel.getOrganizationInfo();
+                log.info("organizationInfo:{}",JSON.toJSONString(organizationInfo));
 
+                log.info("getCreator:{}",organizationInfo.getCreator());
                 if (organizationInfo.getCreator() == null || organizationInfo.getCreator() == 0L) {
                     organizationInfo.setCreator(connectioninfoModel.getUserModel().getUserid());
                 }
                 organizationInfoMapper.updateById(organizationInfo);
+                log.info("update after organizationInfo:{}",JSON.toJSONString(organizationInfo));
                 Resourcelibrary resourcelibrary = dataEntryResource.transferToResourceLibrary(organizationInfo, node);
+                log.info("resourcelibrary id:{}",resourcelibrary.getId());
+                log.info("transferToResourceLibrary:{}",JSON.toJSONString(resourcelibrary));
                 //resourcelibraryMapper.delete(new EntityWrapper<Resourcelibrary>().eq("title", organizationInfo.getName()));
+                // todo 210629 节点管理员编辑走访信息时,此处需要单独处理,。
+                if ("编辑走访".equals(pagetitle)){
+                    log.info("编辑走访编辑走访编辑走访编辑走访。");
+                    Resourcelibrary selResourcelibrary = resourcelibraryMapper.getResourceByTitle(connectioninfoModel.getTitle(),organizationInfo.getId());
+                    log.info("selResourcelibrary content:{}",selResourcelibrary.getContent());
+                    if (null != selResourcelibrary){
+                        resourcelibrary.setId(selResourcelibrary.getId());
+                        resourcelibrary.setSnowflakeid(selResourcelibrary.getSnowflakeid());
+                    }
+                }
+                log.info("resourcelibrary content:{}",resourcelibrary.getContent());
+                log.info("change resourcelibrary id:{},snowflakid:{}",resourcelibrary.getId(),resourcelibrary.getSnowflakeid());
                 resourcelibraryMapper.updateById(resourcelibrary);
+                log.info("resourcelibrary after update content:{}",resourcelibrary.getContent());
+                // log.info("transferToResourceLibrary after update :{}",JSON.toJSONString(resourcelibrary));
                 String claid = getClaid(node, connectioninfoModel.getUserModel().getUserid());
+                log.info("claid:{}",claid);
+                log.info("to del snowflakeid:{}",resourcelibrary.getSnowflakeid());
                 searchService.delete(resourcelibrary.getSnowflakeid());
+                // log.info("insertEs resourcelibrary:{}",JSON.toJSONString(resourcelibrary));
+                log.info("insertEs claid:{},node:{}",claid,node);
+                log.info("insertES start...");
                 dataEntryResource.insertES(resourcelibrary, claid, node);
+                log.info("insertES end...");
             }
-
+            log.info("connectioninfoModel updateById start:{}",JSON.toJSONString(connectioninfoModel));
+            if (null == connectioninfoModel.getOrgcontent()) {
+                log.info("简介 null...");
+                connectioninfoModel.setOrgcontent("");
+                log.info("connectioninfoModel id1:{}",connectioninfoModel.getId());
+            }
+            if (null == connectioninfoModel.getRemark()){
+                connectioninfoModel.setRemark("");
+                log.info("connectioninfoModel remark:{}",connectioninfoModel.getRemark());
+            }
+            log.info("connectioninfoModel id2:{}",connectioninfoModel.getId());
+            log.info("connectioninfoModel orgcontent2:{}",connectioninfoModel.getOrgcontent());
             connectioninfoMapper.updateById(connectioninfoModel);
+            log.info("connectioninfoModel updateById end:{}",JSON.toJSONString(connectioninfoModel));
+            log.info("images:{}",JSON.toJSONString(connectioninfoModel.getImages()));
             if (connectioninfoModel.getImages() != null && !connectioninfoModel.getImages().equals("")) {
+                log.info("getImages is not null...start upsertSystemPicture");
                 upsertSystemPicture(connectioninfoModel.getImages(), connectioninfoModel.getTablename(), connectioninfoModel.getUserModel().getUserid(), connectioninfoModel.getId());
+                log.info("getImages is not null...end upsertSystemPicture");
             }
         }
 
-        //表格通用导入程序,修改企业基本信息时,对机构表以及资源库相关数据执行更新操作
+        // 表格通用导入程序,修改企业基本信息时,对机构表以及资源库相关数据执行更新操作
+        log.info("Util.IS_COMMON_IMPORT_PROGRAM:{}",Util.IS_COMMON_IMPORT_PROGRAM);
         if (Util.IS_COMMON_IMPORT_PROGRAM) {
+            log.info("Util.IS_COMMON_IMPORT_PROGRAM if...表格通用导入程序,修改企业基本信息时,对机构表以及资源库相关数据执行更新操作");
             updateCommonImportProgram(connectioninfoModel, node);
         }
 
         //武进联盟库添加功能
+        log.info("getTemplettype:{}",connectioninfoModel.getTemplettype());
         if (connectioninfoModel.getTemplettype() == 18) {
+            log.info("武进联盟库添加功能...");
             setTemplettype18(connectioninfoModel, node);
         }
 
         //武进导师库添加功能
         if (connectioninfoModel.getTemplettype() == 20) {
+            log.info("武进导师库添加功能...");
             setTemplettype20(connectioninfoModel, node);
         }
+        log.info("return connectioninfoModel:{}",connectioninfoModel.getOrgcontent());
 
         return connectioninfoModel;
     }
@@ -1236,12 +1295,33 @@ public class InterviewDataEntryServiceImpl implements IDataEntryService {
                 commonService.insertAuthority(companyHighleveltalentsLk);
             } else {
                 companyHighleveltalentsLkMapper.updateById(companyHighleveltalentsLk);
+                log.info("Long.valueOf(node):{}",Long.valueOf(node));
+                log.info("companyHighleveltalentsLk.getLinktype()****:{}",companyHighleveltalentsLk.getLinktype());
+                // log.info("Integer.valueOf(String.valueOf(companyHighleveltalentsLk.getLinktype())):{}",Integer.valueOf(String.valueOf(companyHighleveltalentsLk.getLinktype())));
+                log.info("Integer.valueOf(String.valueOf(companyHighleveltalentsLk.getConnid())):{}",Integer.valueOf(String.valueOf(companyHighleveltalentsLk.getConnid())));
+                log.info("String.valueOf(companyHighleveltalentsLk.getAcademicdegree()):{}",String.valueOf(companyHighleveltalentsLk.getAcademicdegree()));
+                log.info("companyHighleveltalentsLk.getDomain():{}",companyHighleveltalentsLk.getDomain());
+                log.info("companyHighleveltalentsLk.getTalentslabelname():{}",companyHighleveltalentsLk.getTalentslabelname());
                 //新标签系统走访时修改标签
-                updateIntelligentLabel(Long.valueOf(node), Integer.valueOf(String.valueOf(companyHighleveltalentsLk.getLinktype())), Integer.valueOf(String.valueOf(companyHighleveltalentsLk.getConnid())), String.valueOf(companyHighleveltalentsLk.getAcademicdegree()), companyHighleveltalentsLk.getDomain(), companyHighleveltalentsLk.getTalentslabelname());
+                updateIntelligentLabel(Long.valueOf(node), null != companyHighleveltalentsLk.getLinktype() ? Integer.valueOf(String.valueOf(companyHighleveltalentsLk.getLinktype())) : 0,
+                        Integer.valueOf(String.valueOf(companyHighleveltalentsLk.getConnid())),
+                        String.valueOf(companyHighleveltalentsLk.getAcademicdegree()),
+                        companyHighleveltalentsLk.getDomain(),
+                        companyHighleveltalentsLk.getTalentslabelname());
                 //修改自定义标签
-                updateUserDefinedLabel(Long.valueOf(node), companyHighleveltalentsLk.getLinktype(), companyHighleveltalentsLk.getConnid(), companyHighleveltalentsLk.getTalentslabelname());
+                log.info("Long.valueOf(node):{}",Long.valueOf(node));
+                log.info("companyHighleveltalentsLk.getLinktype():{}",companyHighleveltalentsLk.getLinktype());
+                log.info("companyHighleveltalentsLk.getConnid():{}",companyHighleveltalentsLk.getConnid());
+                log.info("companyHighleveltalentsLk.getTalentslabelname():{}",companyHighleveltalentsLk.getTalentslabelname());
+                updateUserDefinedLabel(Long.valueOf(node), companyHighleveltalentsLk.getLinktype(), companyHighleveltalentsLk.getConnid(),
+                        companyHighleveltalentsLk.getTalentslabelname());
                 //标签记录表中修改简介中行业信息
-                updateContentLabel(Long.valueOf(node), companyHighleveltalentsLk.getLinktype(), companyHighleveltalentsLk.getConnid(), companyHighleveltalentsLk.getAbout());
+                log.info("Long.valueOf(node):{}",Long.valueOf(node));
+                log.info("companyHighleveltalentsLk.getLinktype():{}",companyHighleveltalentsLk.getLinktype());
+                log.info("companyHighleveltalentsLk.getConnid():{}",companyHighleveltalentsLk.getConnid());
+                log.info("companyHighleveltalentsLk.getAbout():{}",companyHighleveltalentsLk.getAbout());
+                updateContentLabel(Long.valueOf(node), companyHighleveltalentsLk.getLinktype(), companyHighleveltalentsLk.getConnid(),
+                        companyHighleveltalentsLk.getAbout());
 
             }
             if (companyHighleveltalentsLk.getImages() != null && !companyHighleveltalentsLk.getImages().equals("")) {
@@ -2857,20 +2937,30 @@ public class InterviewDataEntryServiceImpl implements IDataEntryService {
      * @param id
      */
     public void upsertSystemPicture(String images, String tablename, long userid, long id) {
+        log.info("新增或更新图片...");
+        log.info("upsertSystemPicture param images:{},tablename:{},userid:{},id:{}",images,tablename,userid,id);
         Typeentry conntypeentry = commonService.getTypeEntryByTypeNameAndTcname
                 (Constant.TYPEENTRY_REMARK_TABLECODE, tablename);
+        log.info("conntypeentry:{}",JSON.toJSONString(conntypeentry));
         List<SystemPicture> piclist = Util.fromJson2List(images, SystemPicture[].class);
+        log.info("piclist:{}",JSON.toJSONString(piclist));
         piclist.forEach(p -> {
-            if (p.getIsenabled() == Constant.TWO) {//删除图片
+            log.info("getIsenabled:{}",p.getIsenabled());
+            if (p.getIsenabled() == Constant.TWO) {
+                // 删除图片
+                log.info("删除图片...");
                 p.setUpdater(userid);
                 systemPictureMapper.updateById(p);
-            } else {//新增
+            } else {
+                // 新增
+                log.info("新增图片...");
                 if (p.getId() == 0 || p.getId() == null) {
                     p.setCreator(userid);
                     p.setUpdater(userid);
                     p.setInfoid(id);
                     p.setModuleid(conntypeentry.getItemvalue());
                     systemPictureMapper.insert(p);
+                    log.info("after insert p:{}",JSON.toJSONString(p));
                 }
             }
         });
@@ -2924,11 +3014,15 @@ public class InterviewDataEntryServiceImpl implements IDataEntryService {
      * @param connectioninfoModel
      */
     public void updateCommonImportProgram(ConnectioninfoModel connectioninfoModel, String node) {
+        log.info("表格通用导入程序,修改企业基本信息时,对机构表以及资源库相关数据执行更新操作");
         //导入程序中的机构信息
         OrganizationInfo ImportProgramOrganizationInfo = connectioninfoModel.getOrganizationInfo();
+        log.info("导入程序中的机构信息ImportProgramOrganizationInfo:{}",JSON.toJSONString(ImportProgramOrganizationInfo));
         String name = ImportProgramOrganizationInfo.getName();
+        log.info("name:{}",name);
 
         List<OrganizationInfo> list = organizationInfoMapper.getOrgListByNode(name, node);
+        log.info("list:{}",JSON.toJSONString(list));
         //机构表中的机构信息
         OrganizationInfo organizationInfo = null;
 
@@ -2937,6 +3031,7 @@ public class InterviewDataEntryServiceImpl implements IDataEntryService {
             organizationInfo = list.get(0);
         }
         if (organizationInfo != null) {
+            log.info("organizationinfo is not null...");
             organizationInfo.setOrgcode(ImportProgramOrganizationInfo.getOrgcode());
             organizationInfo.setWebsite(ImportProgramOrganizationInfo.getWebsite());
             organizationInfo.setDetailaddress(ImportProgramOrganizationInfo.getDetailaddress());
@@ -2944,7 +3039,9 @@ public class InterviewDataEntryServiceImpl implements IDataEntryService {
             organizationInfo.setContact(ImportProgramOrganizationInfo.getContact());
             organizationInfo.setContactnum(ImportProgramOrganizationInfo.getContactnum());
             organizationInfo.setEmail(ImportProgramOrganizationInfo.getEmail());
+            log.info("before update organizationInfo:{}",JSON.toJSONString(organizationInfo));
             organizationInfoMapper.updateById(organizationInfo);
+            log.info("after update organizationInfo:{}",JSON.toJSONString(organizationInfo));
         }
     }
 
@@ -3050,12 +3147,20 @@ public class InterviewDataEntryServiceImpl implements IDataEntryService {
      * @param labelNameArr
      */
     public void updateIntelligentLabel(long node, int linkType, int infoId, String... labelNameArr) {
+        log.info("新标签系统走访时修改标签...");
+        log.info("updateIntelligentLabel()--->node:{},linkType:{},infoId:{},labelNameArr:{}",node,linkType,infoId,JSON.toJSONString(labelNameArr));
+        List<LabelIntelligentConnection> labelIntelligentConnections = labelIntelligentConnectionMapper.selectList(new EntityWrapper<LabelIntelligentConnection>()
+                .eq("node", node).eq("linktype", linkType).eq("infoid", infoId));
+        log.info("del labelIntelligentConnections:{}",JSON.toJSONString(labelIntelligentConnections));
         labelIntelligentConnectionMapper.delete(new EntityWrapper<LabelIntelligentConnection>().eq("node", node).eq("linktype", linkType).eq("infoid", infoId));
         if (StringUtils.isNotBlank(String.valueOf(infoId))) {
-
+            log.info("infoId is not blank...");
             Set<Resourcelibrary> resourcelibraryList = resourcelibraryMapper.getResourceLibraryByConnId(String.valueOf(infoId));
-
+            log.info("resourcelibraryList:{}",JSON.toJSONString(resourcelibraryList));
             resourcelibraryList.forEach(l -> {
+                List<LabelIntelligentConnection> connections = labelIntelligentConnectionMapper.selectList(new EntityWrapper<LabelIntelligentConnection>()
+                        .eq("node", node).eq("backup", l.getId()));
+                log.info("to del connections:{}",JSON.toJSONString(connections));
                 labelIntelligentConnectionMapper.delete(new EntityWrapper<LabelIntelligentConnection>().eq("node", node).eq("backup", l.getId()));
             });
             //insertIntelligentLabel(node, linkType, infoId, labelNameArr);
@@ -3235,6 +3340,7 @@ public class InterviewDataEntryServiceImpl implements IDataEntryService {
      * @param labelNameArr
      */
     public void insertUserDefinedLabel(long node, long linkType, long infoId, String... labelNameArr) {
+        log.info("插入自定义标签---> node:{},linkType:{},infoId:{},labelNameArr:{}",node,linkType,infoId,JSON.toJSONString(labelNameArr));
         LabelIntelligentCustomInfo label = null;
         LabelIntelligentConnection connectionLabel = null;
         for (int i = 0; i < labelNameArr.length; i++) {
@@ -3262,11 +3368,13 @@ public class InterviewDataEntryServiceImpl implements IDataEntryService {
                     connectionLabel.setLinktype(Integer.valueOf(String.valueOf(linkType)));
                     connectionLabel.setInfoid(Integer.valueOf(String.valueOf(infoId)));
                     connectionLabel.setLabelname(splitArr[j]);
+                    log.info("进入标签记录表(走访):{}",JSON.toJSONString(connectionLabel));
                     labelCommonService.setCommonOrCuntomLabelInfo(connectionLabel, connectionLabel.getLabelname(), node);
                     if (!hasSameInterviewLabelOrNull(connectionLabel.getLabelname(), node, Integer.valueOf(String.valueOf(infoId))) && !"技术需求".equals(connectionLabel.getLabelname())) {
                         labelIntelligentConnectionMapper.insert(connectionLabel);
                         //同步至索引库
                         Object o = labelCommonService.transerLabelToESModel(connectionLabel);
+                        log.info("同步至 索引库:{}",JSON.toJSONString(o));
                         if (o instanceof LabelIntelligentConnectionModel) {
                             labelIntelligentConnectionRepository.save((LabelIntelligentConnectionModel) o);
                         }
@@ -3331,11 +3439,27 @@ public class InterviewDataEntryServiceImpl implements IDataEntryService {
      * @param labelNameArr
      */
     public void updateUserDefinedLabel(long node, long linkType, long infoId, String... labelNameArr) {
-        labelIntelligentConnectionMapper.delete(new EntityWrapper<LabelIntelligentConnection>().eq("node", node).eq("linktype", linkType).eq("infoid", infoId));
+        log.info("修改自定义标签...");
+        log.info("node:{},linkType:{},infoId:{},labelNameArr:{}",node,linkType,infoId,JSON.toJSONString(labelNameArr));
+        List<LabelIntelligentConnection> labelIntelligentConnections = labelIntelligentConnectionMapper.selectList(new EntityWrapper<LabelIntelligentConnection>()
+                .eq("node", node)
+                .eq("linktype", linkType)
+                .eq("infoid", infoId));
+        log.info("to del lists:{}",JSON.toJSONString(labelIntelligentConnections));
+        labelIntelligentConnectionMapper.delete(new EntityWrapper<LabelIntelligentConnection>()
+                .eq("node", node)
+                .eq("linktype", linkType)
+                .eq("infoid", infoId));
         if (StringUtils.isNotBlank(String.valueOf(infoId))) {
-
+            log.info("infoId is not blank...");
             Set<Resourcelibrary> resourcelibraryList = resourcelibraryMapper.getResourceLibraryByConnId(String.valueOf(infoId));
+            log.info("resourcelibraryList:{}",JSON.toJSONString(resourcelibraryList));
             resourcelibraryList.forEach(l -> {
+                log.info("node:{},backup:{}",node,l.getId());
+                List<LabelIntelligentConnection> connections = labelIntelligentConnectionMapper.selectList(new EntityWrapper<LabelIntelligentConnection>()
+                        .eq("node", node)
+                        .eq("backup", l.getId()));
+                log.info("to del connections:{}",JSON.toJSONString(connections));
                 labelIntelligentConnectionMapper.delete(new EntityWrapper<LabelIntelligentConnection>().eq("node", node).eq("backup", l.getId()));
             });
             insertUserDefinedLabel(node, linkType, infoId, labelNameArr);
@@ -3351,12 +3475,13 @@ public class InterviewDataEntryServiceImpl implements IDataEntryService {
      * @param content
      */
     public void insertContentLabel(long node, long linkType, long infoId, String content) {
-
+        log.info("标签记录表中插入简介中行业信息 insertContentLabel --->node:{},linkType:{},infoId:{},content:{}",node,linkType,infoId,content);
         LabelIntelligentConnection label = null;
 
         if (StringUtils.isNotBlank(content)) {
             //查出所用行业标签信息
             List<LabelIntelligentCommonInfo> labelIntelligentCommonInfoList = labelIntelligentCommonInfoMapper.selectList(new EntityWrapper<LabelIntelligentCommonInfo>().eq("parentid", 0).eq("by1", "category").eq("node", node));
+            log.info("查出所用行业标签信息labelIntelligentCommonInfoList:{}",JSON.toJSONString(labelIntelligentCommonInfoList));
             if (labelIntelligentCommonInfoList.size() == 0) {
                 labelIntelligentCommonInfoList = labelIntelligentCommonInfoMapper.selectList(new EntityWrapper<LabelIntelligentCommonInfo>().eq("parentid", 0).eq("by1", "category").eq("node", 0));
             }
@@ -3372,6 +3497,7 @@ public class InterviewDataEntryServiceImpl implements IDataEntryService {
                         labelIntelligentConnectionMapper.insert(label);
                         //同步至索引库
                         Object o = labelCommonService.transerLabelToESModel(label);
+                        log.info("同步至索引库:{}",JSON.toJSONString(o));
                         if (o instanceof LabelIntelligentConnectionModel) {
                             labelIntelligentConnectionRepository.save((LabelIntelligentConnectionModel) o);
                         }
@@ -3429,11 +3555,21 @@ public class InterviewDataEntryServiceImpl implements IDataEntryService {
      * @param content
      */
     public void updateContentLabel(long node, long linkType, long infoId, String content) {
+        log.info("标签记录表中修改简介中行业信息--->node:{},linkType:{},infoId:{},content:{}",node,linkType,infoId,content);
+        List<LabelIntelligentConnection> labelIntelligentConnections = labelIntelligentConnectionMapper.selectList(new EntityWrapper<LabelIntelligentConnection>()
+                .eq("node", node)
+                .eq("linktype", linkType)
+                .eq("infoid", infoId));
+        log.info("to del labelIntelligentConnections:{}",JSON.toJSONString(labelIntelligentConnections));
         labelIntelligentConnectionMapper.delete(new EntityWrapper<LabelIntelligentConnection>().eq("node", node).eq("linktype", linkType).eq("infoid", infoId));
         if (StringUtils.isNotBlank(String.valueOf(infoId))) {
-
+            log.info("infoId is noe blank...");
             Set<Resourcelibrary> resourcelibraryList = resourcelibraryMapper.getResourceLibraryByConnId(String.valueOf(infoId));
+            log.info("resourcelibraryList:{}",JSON.toJSONString(resourcelibraryList));
             resourcelibraryList.forEach(l -> {
+                List<LabelIntelligentConnection> connections = labelIntelligentConnectionMapper.selectList(new EntityWrapper<LabelIntelligentConnection>()
+                        .eq("node", node).eq("backup", l.getId()));
+                log.info("connections:{}",JSON.toJSONString(connections));
                 labelIntelligentConnectionMapper.delete(new EntityWrapper<LabelIntelligentConnection>().eq("node", node).eq("backup", l.getId()));
             });
             insertContentLabel(node, linkType, infoId, content);

+ 89 - 18
ttc-backen/src/main/java/cn/ubitech/ttc/service/impl/label/LabelCommonService.java

@@ -11,15 +11,21 @@ import cn.ubitech.ttc.service.impl.datatools.InterviewDataEntryServiceImpl;
 import cn.ubitech.ttc.service.impl.resource.ResourceLibraryServiceImpl;
 import cn.ubitech.ttc.service.impl.resourceChoice.ResouceChoiceServiceImpl;
 import cn.ubitech.ttc.service.impl.search.SearchServiceImpl;
+import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.mapper.EntityWrapper;
 import com.baomidou.mybatisplus.mapper.Wrapper;
+import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.lang.StringUtils;
 import org.elasticsearch.action.update.UpdateRequest;
+import org.elasticsearch.index.query.BoolQueryBuilder;
+import org.elasticsearch.index.query.QueryBuilders;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.domain.Page;
 import org.springframework.data.elasticsearch.core.ElasticsearchTemplate;
 import org.springframework.data.elasticsearch.core.query.DeleteQuery;
+import org.springframework.data.elasticsearch.core.query.NativeSearchQueryBuilder;
+import org.springframework.data.elasticsearch.core.query.SearchQuery;
 import org.springframework.data.elasticsearch.core.query.UpdateQuery;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -36,6 +42,7 @@ import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
  * 标签系统通用需求service类
  */
 @Service
+@Slf4j
 public class LabelCommonService {
     @Autowired
     private LabelIntelligentCustomInfoRepository labelIntelligentCustomInfoRepository;
@@ -134,19 +141,13 @@ public class LabelCommonService {
             Long restype = restypelist.get(0).getType();
             List<LabelIntelligentCommonInfo> labelIntelligentCommonInfoList1 = new ArrayList<>();
             if (restype == 6) {
-                labelIntelligentCommonInfoList1 = labelIntelligentCommonInfoMapper.selectList(new EntityWrapper<LabelIntelligentCommonInfo>()
-                        .eq("node", node)
-                        .eq("name", labelName)
-                        .eq("by1", "enterprisequalification"));
+                labelIntelligentCommonInfoList1 = labelIntelligentCommonInfoMapper.selectList(new EntityWrapper<LabelIntelligentCommonInfo>().eq("node", node).eq("name", labelName).eq("by1", "enterprisequalification"));
                 if(labelIntelligentCommonInfoList1.size() == 0){
                     labelIntelligentCommonInfoList1 = labelIntelligentCommonInfoMapper.selectList(new EntityWrapper<LabelIntelligentCommonInfo>().eq("node", 0).eq("name", labelName).eq("by1", "enterprisequalification"));
                 }
             }
             if (restype == 38) {
-                labelIntelligentCommonInfoList1 = labelIntelligentCommonInfoMapper.selectList(new EntityWrapper<LabelIntelligentCommonInfo>()
-                        .eq("node", node)
-                        .eq("name", labelName)
-                        .eq("by1", "talenttype"));
+                labelIntelligentCommonInfoList1 = labelIntelligentCommonInfoMapper.selectList(new EntityWrapper<LabelIntelligentCommonInfo>().eq("node", node).eq("name", labelName).eq("by1", "talenttype"));
                 if(labelIntelligentCommonInfoList1.size() == 0){
                     labelIntelligentCommonInfoList1 = labelIntelligentCommonInfoMapper.selectList(new EntityWrapper<LabelIntelligentCommonInfo>().eq("node", 0).eq("name", labelName).eq("by1", "talenttype"));
                 }
@@ -194,9 +195,15 @@ public class LabelCommonService {
         }
 
         //标签添加功能中,如果是行业标签信息,则需要修改对应的资源库及索引库数据
-        List<LabelIntelligentCommonInfo> labelIntelligentCommonInfoList2 = labelIntelligentCommonInfoMapper.selectList(new EntityWrapper<LabelIntelligentCommonInfo>().eq("node", node).eq("name", labelName).eq("by1", "category"));
-        if(labelIntelligentCommonInfoList2.size() == 0){
-            labelIntelligentCommonInfoList2 = labelIntelligentCommonInfoMapper.selectList(new EntityWrapper<LabelIntelligentCommonInfo>().eq("node", 0).eq("name", labelName).eq("by1", "category"));
+        List<LabelIntelligentCommonInfo> labelIntelligentCommonInfoList2 = labelIntelligentCommonInfoMapper.selectList(new EntityWrapper<LabelIntelligentCommonInfo>()
+                .eq("node", node)
+                .eq("name", labelName)
+                .eq("by1", "category"));
+        if (labelIntelligentCommonInfoList2.size() == 0) {
+            labelIntelligentCommonInfoList2 = labelIntelligentCommonInfoMapper.selectList(new EntityWrapper<LabelIntelligentCommonInfo>()
+                    .eq("node", 0)
+                    .eq("name", labelName)
+                    .eq("by1", "category"));
         }
         if (CollectionUtils.isNotEmpty(labelIntelligentCommonInfoList2)) {
             String code = labelIntelligentCommonInfoList2.get(0).getCode();
@@ -530,12 +537,15 @@ public class LabelCommonService {
     // todo ckk 2021-03-19 删除标签
     @Transactional
     public boolean delIntelligent(Long resid, String labelName, String node, Long labelid) {
+        Boolean delFlag = false;
         List<LabelIntelligentConnection> connectionLabelList = labelIntelligentConnectionMapper.selectList(new EntityWrapper<LabelIntelligentConnection>()
                 .eq("labelname", labelName)
                 .eq("backup", resid)
-                .eq("node",node)
-                .eq("labelid",labelid));
+                .eq("node", node)
+                .eq("labelid", labelid));
+        log.info("backup:{},node:{},labelName:{}", resid,node,labelName);
         if (CollectionUtils.isNotEmpty(connectionLabelList)) {
+            log.info("mysql rel is not empty...");
             Long con_id = connectionLabelList.get(0).getId();
             // 查询es库对应数据id
             Page<LabelIntelligentConnectionModel> connectionModelPage = searchService.buildLabelConnection(node, resid, labelid, con_id);
@@ -545,14 +555,75 @@ public class LabelCommonService {
                 LabelIntelligentConnectionModel labelIntelligentConnectionModel = connectionModelList.get(0);
                 Long es_id = labelIntelligentConnectionModel.getId();
                 String by2 = labelIntelligentConnectionModel.getBy2();
-
-                if (con_id.toString().equals(by2) && connectionLabelList.size() == 1){
+                log.info("con_id:{}", con_id);
+                if (con_id.toString().equals(by2) && connectionLabelList.size() == 1) {
                     labelIntelligentConnectionRepository.delete(es_id);
-                    // 删除mysql Connection表数据
-                    Integer id = labelIntelligentConnectionMapper.delete(new EntityWrapper<LabelIntelligentConnection>().eq("id", con_id));
-                    return true;
+                    // 再次根据id查询,确保以删除es库数据。
+                    Boolean existFlag = labelIntelligentConnectionRepository.exists(es_id);
+                    log.info("es数据删除状态:{}", existFlag);
+                    if (existFlag == false) {
+                        log.info("es 数据已删除...");
+                        // 删除mysql Connection表数据
+                        Integer id = labelIntelligentConnectionMapper.delete(new EntityWrapper<LabelIntelligentConnection>().eq("id", con_id));
+                        log.info("del id:{}", id);
+                        delFlag = id > 0 ? true : false;
+                    }
+                    log.info("if--->res:{}",delFlag);
+                    return delFlag;
                 }
             }
+        } else {
+            log.info("mysql rel is empty...");
+            // 根据标签名字和资源id查询es库数据。
+            // 构建查询
+            NativeSearchQueryBuilder nativeSearchQueryBuilder = new NativeSearchQueryBuilder();
+            // 搜索条件
+            BoolQueryBuilder bqb = QueryBuilders.boolQuery();
+            bqb.must(QueryBuilders.termQuery("backup", resid));
+            bqb.must(QueryBuilders.termQuery("node", node));
+            // bqb.must(QueryBuilders.termQuery("labelname", labelName));
+            log.info("backup:{},node:{},labelName:{}", resid,node,labelName);
+            nativeSearchQueryBuilder.withQuery(bqb);
+
+            //生产NativeSearchQuery
+            SearchQuery sq = nativeSearchQueryBuilder.build();
+            //执行
+            Page<LabelIntelligentConnectionModel> pagelist = elasticsearchTemplate.queryForPage(sq, LabelIntelligentConnectionModel.class);
+            // elasticsearchTemplate.query(sq);
+            // org.springframework.data.domain.Page<ElasticSearchTTCModel> pagelist = elasticsearchTemplate.queryForPage(sq, ElasticSearchTTCModel.class);
+            // 查询es库对应数据id
+            List<LabelIntelligentConnectionModel> connectionModelList = pagelist.getContent();
+            if (connectionModelList.size() > 0) {
+                for (LabelIntelligentConnectionModel labelIntelligentConnectionModel : connectionModelList) {
+                    System.out.println(labelIntelligentConnectionModel.getLabelname());
+                    if (labelName.equals(labelIntelligentConnectionModel.getLabelname())) {
+                        log.info("此标签为待删除的标签,执行del,开始删除标签...");
+                        log.info("to del es id:{}" , labelIntelligentConnectionModel.getId());
+                        labelIntelligentConnectionRepository.delete(labelIntelligentConnectionModel.getId());
+                        // 确保es库数据删除。
+                        Boolean existFlag = labelIntelligentConnectionRepository.exists(labelIntelligentConnectionModel.getId());
+                        log.info("es数据删除状态:{}", existFlag);
+                        delFlag = existFlag == false ? true : false;
+                        log.info("else--->res:{}",delFlag);
+                        break;
+                    } else {
+                        log.info("此标签无需删除...");
+                    }
+                }
+
+                // connectionModelList.forEach(connectionModel -> {
+                //     System.out.println(connectionModel.getLabelname());
+                //     if (labelName.equals(connectionModel.getLabelname())){
+                //         System.err.println(connectionModel.getLabelname() + " > 此标签为待删除的标签,执行del,开始删除标签。");
+                //         labelIntelligentConnectionRepository.delete(connectionModel.getId());
+                //         System.out.println(connectionModel.getId());
+                //
+                //     }else {
+                //         System.err.println(connectionModel.getLabelname() + " > 此标签无需删除。");
+                //         System.out.println(connectionModel.getId());
+                //     }
+                // });
+            }
         }
         return false;
     }

+ 7 - 3
ttc-backen/src/main/java/cn/ubitech/ttc/service/impl/label/LabelRecordServiceImpl.java

@@ -293,7 +293,8 @@ public class LabelRecordServiceImpl {
      * @return
      */
     public Set<LabelModel> taskInfoKeywordList(long resourceid, String node) {
-
+        System.err.println("resourceid:" + resourceid);
+        System.err.println(node);
         //用于存放labelid和labelname的列表
         Set<LabelModel> set = new HashSet<>();
         LabelModel labelmodel = null;
@@ -301,17 +302,20 @@ public class LabelRecordServiceImpl {
         Map<String, String> labelMap = new HashMap<>();
 
         Page<LabelIntelligentConnectionModel> connectionModelPage = searchService.buildLabelConnection(node, resourceid);
+        System.err.println(connectionModelPage.getSize());
         List<LabelIntelligentConnectionModel> connectionModelList = connectionModelPage.getContent();
-
+        System.err.println("connectionModelList:{}" + JSON.toJSONString(connectionModelList));
         connectionModelList.forEach(connectionModel -> {
             resourceLibraryService.proLabelConnectionMap(connectionModel, labelMap);
         });
-
+        System.err.println("labelMap:" + JSON.toJSONString(labelMap));
         //遍历存放从es标签库中查询出来的标签数据的map,转换成LabelModel并将具有不同labelName的对象才添加到集合中
         labelMap.forEach((k, v) -> {
             LabelModel labelModel = new LabelModel();
             labelModel.setLabelKey(k);
             labelModel.setLabelName(v);
+            System.err.println(k);
+            System.err.println(v);
             labelUtilService.addUniqueLabel(set, labelModel);
         });
         /*Set<LabelModel> set = new HashSet<>();

+ 132 - 0
ttc-backen/src/main/java/cn/ubitech/ttc/service/impl/resource/ElasticSearchServiceImpl.java

@@ -3,6 +3,7 @@ package cn.ubitech.ttc.service.impl.resource;
 import cn.ubitech.ttc.entity.ResourceChoice;
 import cn.ubitech.ttc.model.common.Constant;
 import cn.ubitech.ttc.model.common.SearchFilterModel;
+import com.alibaba.fastjson.JSON;
 import org.apache.commons.lang.StringUtils;
 import org.elasticsearch.index.query.*;
 import org.elasticsearch.search.sort.*;
@@ -125,7 +126,10 @@ public class ElasticSearchServiceImpl {
         if (Constant.CATEGORY_MODULE_0 == filterModel.getFilterModuleId()
                 && filterModel.getFilterKeyword() != "") {//通用查询关键字title,其中title权重提高2倍
             MultiMatchQueryBuilder builder = new MultiMatchQueryBuilder(filterModel.getFilterKeyword(), "title^2");
+            // MultiMatchQueryBuilder builder = new MultiMatchQueryBuilder(filterModel.getFilterKeyword(), "newtitle");
+            // MultiMatchQueryBuilder builder = new MultiMatchQueryBuilder(filterModel.getFilterKeyword(), "title");
             bqb.must(builder);
+            // bqb.should(builder);
             bqb.mustNot(QueryBuilders.termQuery("type", 100)); //咨询类信息排除
             if (filterModel.getFiltergroupid() == null || filterModel.getFiltergroupid().equals("")) {
                 bqb.mustNot(QueryBuilders.termQuery("groupid", "100"));
@@ -142,7 +146,10 @@ public class ElasticSearchServiceImpl {
             }
             if (!filterModel.getFilterKeyword().equals("")) {
                 MultiMatchQueryBuilder builder = new MultiMatchQueryBuilder(filterModel.getFilterKeyword(), "title^2");
+                // MultiMatchQueryBuilder builder = new MultiMatchQueryBuilder(filterModel.getFilterKeyword(), "newtitle");
+                // MultiMatchQueryBuilder builder = new MultiMatchQueryBuilder(filterModel.getFilterKeyword(), "title^2","newtitle");
                 bqb.must(builder);
+                // bqb.should(builder);
             }
         }
         if (filterModel.getFiltertracetype() == Constant.TRACE_TYPE_2619) {
@@ -156,9 +163,134 @@ public class ElasticSearchServiceImpl {
             QueryBuilder queryBuilder = new QueryStringQueryBuilder("\"" + old + "\"").field("address").defaultOperator(QueryStringQueryBuilder.Operator.AND);
             bqb.must(queryBuilder);
         }
+        // MultiMatchQueryBuilder builderSecond = new MultiMatchQueryBuilder(filterModel.getFilterKeyword(), "newtitle");
+        // bqb.should(builderSecond);
         return bqb;
     }
 
+    /**
+     * 关键词查询条件2:输入全称时,可搜索出结果,此处用了模糊查询。
+     * todo bug ghj check。
+     *
+     * @param filterModel 筛选条件
+     * @return qb
+     * @author chen.cong
+     * @version 1.0, 2017年6月26日
+     */
+    public QueryBuilder getQueryBuiderSecond(SearchFilterModel filterModel, Set<ResourceChoice> choiceSet) {
+        //查询精度,关键词符合20%即可查询出来
+        String minimumShouldMatch = "20%";
+        //初始化查询条件
+        BoolQueryBuilder bqb = QueryBuilders.boolQuery();
+        //用户id不为0时,即精确查询用户
+        if (filterModel.getFilterUserId() != 0L) {
+            bqb.must(QueryBuilders.termQuery("creator", filterModel.getFilterUserId()));
+        }
+        if (choiceSet.size() != 0) {
+            Map<String, List<ResourceChoice>> choiceMap = choiceSet.stream().collect(Collectors.groupingBy(ResourceChoice::getType));
+
+            //判断choiceMap的数据类型是否是多个(且包含多个list)
+            boolean mapIsMoreFlag = judgeChoiceMapIsMore(choiceMap);
+
+            if (!mapIsMoreFlag) {
+                choiceMap.forEach((k, v) -> {
+                    v.forEach(l -> {
+                    /*String parameter = "";
+                    String method = l.getFiltermodelproperty();
+                    method = "get" + String.valueOf(method.charAt(0)).toUpperCase() + method.substring(1);
+                    try {
+                        Class<?> clazz = Class.forName("cn.ubitech.ttc.model.common.SearchFilterModel");
+                        Method m = clazz.getMethod(method);
+                        parameter = String.valueOf(m.invoke(filterModel));
+                    } catch (Exception e) {
+                        throw new RuntimeException("资源库筛选时es反射异常!");
+                    }*/
+                        if (v.size() == 1) {
+                            //与查询
+                            bqb.must(QueryBuilders.termQuery(l.getPropertytoes(), l.getValue().toLowerCase()));
+                        } else {
+                            //或查询
+                            bqb.should(QueryBuilders.termQuery(l.getPropertytoes(), l.getValue().toLowerCase()));
+                        }
+                    });
+                });
+                bqb.minimumShouldMatch("1");
+                bqb.minimumNumberShouldMatch(1);
+            } else {
+                Set<String> keySet = choiceMap.keySet();
+                String[] keyArr = keySet.toArray(new String[]{});
+                for (int i = 0; i < keyArr.length; i++) {
+                    List<ResourceChoice> choiceList = choiceMap.get(keyArr[i]);
+                    for (int j = 0; j < choiceList.size(); j++) {
+                        if (i != 0 && j == 0) {
+                            //if (i != 0 && false) {
+                            bqb.must(QueryBuilders.termQuery(choiceList.get(j).getPropertytoes(), choiceList.get(j).getValue().toLowerCase()));
+                        } else {
+                            bqb.should(QueryBuilders.termQuery(choiceList.get(j).getPropertytoes(), choiceList.get(j).getValue().toLowerCase()));
+                        }
+                    }
+                }
+                bqb.minimumShouldMatch("1");
+                bqb.minimumNumberShouldMatch(1);
+            }
+        }
+        //不包含逗号,证明是需求库需求类型筛选,sort为0是指全查
+        /*if (!filterModel.getSortKeys().contains(",") && !filterModel.getSortKeys().equals("0")) {
+            bqb.must(QueryBuilders.termQuery("techtype", filterModel.getSortKeys()));
+        }
+        if (!"".equals(filterModel.getFilterCategory1Name().trim())) { // 行业
+            bqb.must(QueryBuilders
+                    .wildcardQuery("primTag", filterModel.getFilterCategory1Name().toLowerCase() + "*"));
+        }
+        if (filterModel.getFilterishigh() != null && filterModel.getFilterishigh() != 0) {
+            bqb.must(QueryBuilders.matchPhraseQuery("status", filterModel.getFilterishigh()));
+        }*/
+        bqb.mustNot(QueryBuilders.termQuery("id", 0));
+        //索引库删除的数据将isenable置为"0",发生查询时不显示该项数据
+        bqb.mustNot(QueryBuilders.termQuery("isenable", 0));
+        if (Constant.CATEGORY_MODULE_0 == filterModel.getFilterModuleId()
+                && filterModel.getFilterKeyword() != "") {//通用查询关键字title,其中title权重提高2倍
+            WildcardQueryBuilder queryBuilder = QueryBuilders.wildcardQuery("newtitle", "*" + filterModel.getFilterKeyword() + "*");
+            bqb.minimumShouldMatch(minimumShouldMatch);
+            bqb.must(queryBuilder);
+            bqb.mustNot(QueryBuilders.termQuery("type", 100)); //咨询类信息排除
+            if (filterModel.getFiltergroupid() == null || filterModel.getFiltergroupid().equals("")) {
+                bqb.mustNot(QueryBuilders.termQuery("groupid", "100"));
+            }
+        } else if (Constant.CATEGORY_MODULE_0 != filterModel.getFilterModuleId()) {//模块查询关键字title,其中title权重提高2倍
+            if (!StringUtils.isBlank(filterModel.getUnique())) {
+                String unique[] = filterModel.getUnique().split(",");
+                for (String s : unique) {
+                    bqb.should(QueryBuilders.matchQuery("unique", s));
+                }
+            } else {
+                bqb.must(QueryBuilders.matchQuery("groupid", filterModel.getFiltergroupid()));
+                bqb.must(QueryBuilders.termQuery("type", filterModel.getFilterModuleId()));
+            }
+            if (!filterModel.getFilterKeyword().equals("")) {
+                WildcardQueryBuilder queryBuilder = QueryBuilders.wildcardQuery("newtitle", "*" + filterModel.getFilterKeyword() + "*");
+                bqb.minimumShouldMatch(minimumShouldMatch);
+                bqb.must(queryBuilder);
+            }
+        }
+        if (filterModel.getFiltertracetype() == Constant.TRACE_TYPE_2619) {
+            bqb.must(QueryBuilders.matchQuery("by5", filterModel.getFilterUserId()));
+        }
+        if (filterModel.getFilterUserId() != Constant.ZERO) {
+//          bqb.must(QueryBuilders.termQuery("clickthrough", filterModel.getFilterUserId()));
+        }
+        if (null != filterModel.getFilterAddress() && !"".equals(filterModel.getFilterAddress().trim())) {
+            String old = filterModel.getFilterAddress().substring(0, 2);
+            QueryBuilder queryBuilder = new QueryStringQueryBuilder("\"" + old + "\"").field("address").defaultOperator(QueryStringQueryBuilder.Operator.AND);
+            bqb.must(queryBuilder);
+        }
+        // MultiMatchQueryBuilder builderSecond = new MultiMatchQueryBuilder(filterModel.getFilterKeyword(), "newtitle");
+        // bqb.should(builderSecond);
+        return bqb;
+    }
+
+
+
     /**
      * 排序
      *

+ 3 - 1
ttc-backen/src/main/java/cn/ubitech/ttc/service/impl/resource/ResourceLibraryServiceImpl.java

@@ -155,9 +155,11 @@ public class ResourceLibraryServiceImpl {
     public void proLabelConnectionMap(LabelIntelligentConnectionModel model, Map<String, String> labelMap) {
         //行业标签,特殊处理
         if ("category".equals(model.getBy1())) {
+            System.err.println("categorycategorycategorycategorycategory");
             //map装配行业信息
             packageConnectionIndustryLabelByES(model, labelMap);
         } else {
+            System.err.println("else else else else");
             labelMap.put(String.valueOf(model.getLabelid()), model.getLabelname());
         }
     }
@@ -189,7 +191,7 @@ public class ResourceLibraryServiceImpl {
         }
         SearchFilterModel filterModel = new SearchFilterModel();
         filterModel.setFilterKeyword(keyword.trim().equals("undefined") ? "" : keyword.trim());
-        System.out.println("查询的关键字" + keyword);
+        System.out.println("查询的关键字:" + keyword);
         filterModel.setSortKeys(sort.trim());       //排序  name+value的形式
         filterModel.setFiltergroupid(groupid);      //资源库文件夹id,没有传值则默认为0
         filterModel.setFilterModuleId(moduleid);    // 模块id

+ 9 - 3
ttc-backen/src/main/java/cn/ubitech/ttc/service/impl/resource/ResourceServiceImpl.java

@@ -21,6 +21,7 @@ import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.mapper.EntityWrapper;
 import lombok.AllArgsConstructor;
 import lombok.Data;
+import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.lang.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -59,6 +60,7 @@ import java.util.stream.Collectors;
  * @Modifyed By:
  * @Description:
  */
+@Slf4j
 @Service
 public class ResourceServiceImpl implements IResourceService {
     @Autowired
@@ -254,7 +256,9 @@ public class ResourceServiceImpl implements IResourceService {
         Util.setIntroInfo(infoPageModel);
 
         //资源库添加功能,需要将infoSectionModel里面的itemvalue值改为30003(因为调的是走访入录模板)
-        List<Connectioninfo> connectioninfoList = connectioninfoMapper.selectList(new EntityWrapper<Connectioninfo>().eq("title", resource.getTitle()).eq("isresourcelibrarydata", 1));
+        List<Connectioninfo> connectioninfoList = connectioninfoMapper.selectList(new EntityWrapper<Connectioninfo>()
+                .eq("title", resource.getTitle())
+                .eq("isresourcelibrarydata", 1));
         if (CollectionUtils.isNotEmpty(connectioninfoList)) {
             infoPageModel.getInfoSectionList().get(0).setItemvalue(30003);
         }
@@ -347,7 +351,7 @@ public class ResourceServiceImpl implements IResourceService {
         try {
             unitlist.forEach(unit -> {
                 if (unit.getTitle().contains("简介")) {
-                    //简介信息
+                    // 简介信息
                     String content = unit.getContent();
                     List<String> list = getLabel(resourceid, node, content);
                     futherList.add(list);
@@ -397,7 +401,8 @@ public class ResourceServiceImpl implements IResourceService {
                 break;
             }
         }*/
-        List<LabelIntelligentConnection> connectionList = labelIntelligentConnectionMapper.selectList(new EntityWrapper<LabelIntelligentConnection>().eq("node", node).eq("backup", resourceid).eq("by2", Util.SHOW_BLUE_LABEL));
+        List<LabelIntelligentConnection> connectionList = labelIntelligentConnectionMapper.selectList(new EntityWrapper<LabelIntelligentConnection>()
+                .eq("node", node).eq("backup", resourceid).eq("by2", Util.SHOW_BLUE_LABEL));
         //判断当前简介中是否存在通用便签
         boolean hasCommonLabelFlag = false;
         if (CollectionUtils.isEmpty(connectionList)) {
@@ -563,6 +568,7 @@ public class ResourceServiceImpl implements IResourceService {
      * @return
      */
     public List<ConinfoClassification> getConClaidByNode(String node, String keyword, long userid) {
+        log.info("node:{},keyword:{},userid:{}",node,keyword,userid);
         List<ConinfoClassification> list = new ArrayList<>();
         NodeClassificationLk nodeClassificationLk = new NodeClassificationLk();
         nodeClassificationLk.setNode(node);

+ 6 - 1
ttc-backen/src/main/java/cn/ubitech/ttc/service/impl/resourceChoice/ResouceChoiceServiceImpl.java

@@ -16,6 +16,7 @@ import cn.ubitech.ttc.service.impl.search.SearchServiceImpl;
 import cn.ubitech.ttc.service.impl.user.SysUsersInfoServiceImpl;
 import com.baomidou.mybatisplus.mapper.EntityWrapper;
 import lombok.AllArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.collections4.CollectionUtils;
 import org.apache.commons.lang.StringUtils;
 import org.elasticsearch.action.admin.indices.refresh.RefreshRequest;
@@ -66,6 +67,7 @@ import java.util.stream.Collectors;
  * @Description:
  */
 @Service
+@Slf4j
 public class ResouceChoiceServiceImpl {
 
     //资源置顶对象
@@ -112,10 +114,13 @@ public class ResouceChoiceServiceImpl {
      * @return
      */
     public List<ResourceChoiceModel> getResourceChoiceList(String node, Integer restype) {
+        log.info("获取资源筛选条件列表 ---> node:{},restyoe:{}",node,restype);
         //合并结果集
         List<ResourceChoiceModel> sumList = new ArrayList<>();
 
-        List<ResourceChoice> resourceChoiceList = resourceChoiceMapper.selectList(new EntityWrapper<ResourceChoice>().eq("node", node).eq("restype", restype).orderBy("id"));
+        List<ResourceChoice> resourceChoiceList = resourceChoiceMapper.selectList(new EntityWrapper<ResourceChoice>()
+                .eq("node", node)
+                .eq("restype", restype).orderBy("id"));
         Map<String, List<ResourceChoice>> resourceChoiceMap = resourceChoiceList.stream().collect(Collectors.groupingBy(ResourceChoice::getType));
 
         resourceChoiceMap.forEach((k, v) -> {

+ 56 - 5
ttc-backen/src/main/java/cn/ubitech/ttc/service/impl/search/SearchServiceImpl.java

@@ -14,13 +14,11 @@ import cn.ubitech.ttc.model.label.*;
 import cn.ubitech.ttc.model.user.UserModel;
 import cn.ubitech.ttc.service.impl.resource.ElasticSearchServiceImpl;
 import cn.ubitech.ttc.service.impl.user.UserServiceImpl;
+import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.plugins.Page;
 import org.elasticsearch.action.delete.DeleteResponse;
 import org.elasticsearch.client.Client;
-import org.elasticsearch.index.query.BoolQueryBuilder;
-import org.elasticsearch.index.query.MatchQueryBuilder;
-import org.elasticsearch.index.query.QueryBuilder;
-import org.elasticsearch.index.query.QueryBuilders;
+import org.elasticsearch.index.query.*;
 import org.elasticsearch.search.sort.FieldSortBuilder;
 import org.elasticsearch.search.sort.SortBuilder;
 import org.elasticsearch.search.sort.SortBuilders;
@@ -238,6 +236,7 @@ public class SearchServiceImpl {
         NativeSearchQueryBuilder nativeSearchQueryBuilder = new NativeSearchQueryBuilder();
         //搜索条件
         QueryBuilder qb = esServiceImpl.getQueryBuider(filterModel, choiceSet);
+        System.out.println("qbqbqb:" + JSON.toJSONString(qb));
         nativeSearchQueryBuilder.withQuery(qb);
         //分页
         PageRequest page = new PageRequest(pagenum, pageSize);
@@ -259,6 +258,46 @@ public class SearchServiceImpl {
         SearchQuery sq = nativeSearchQueryBuilder.build();
         //执行
         org.springframework.data.domain.Page<ElasticSearchTTCModel> pagelist = elasticsearchTemplate.queryForPage(sq, ElasticSearchTTCModel.class);
+        // todo bug ghj check。
+        System.out.println(pagelist.getSize());
+        List<ElasticSearchTTCModel> list = pagelist.getContent();
+        // if (!list.contains(filterModel.getFilterKeyword()) && filterModel.getFilterKeyword().contains("有限公司")){
+        if (!list.contains(filterModel.getFilterKeyword()) && !"".equals(filterModel.getFilterKeyword())){
+            System.out.println("不包含keyword...");
+            // QueryBuilder 适用于单个字段查询(matchPhraseQuery是没有用分词起,matchQuery会使用分词器,将我们输入的值进行分割,如:“java动态”会分割成:“java”,“动态”)
+            // QueryBuilder qb1 = QueryBuilders.matchPhraseQuery("newtitle", filterModel.getFilterKeyword());
+            // BoolQueryBuilder bqb1 = QueryBuilders.boolQuery().must(qb1);
+            // 模糊查询
+            // WildcardQueryBuilder queryBuilder = QueryBuilders.wildcardQuery("newtitle", "*" + filterModel.getFilterKeyword() + "*");
+            // 搜索条件。
+            // BoolQueryBuilder bqb = QueryBuilders.boolQuery();
+            // MultiMatchQueryBuilder builder = new MultiMatchQueryBuilder(filterModel.getFilterKeyword(), "title^2");
+            // MultiMatchQueryBuilder builder = new MultiMatchQueryBuilder(filterModel.getFilterKeyword(), "newtitle");
+            // MultiMatchQueryBuilder builder = new MultiMatchQueryBuilder(filterModel.getFilterKeyword(), "title");
+            // String minimumShouldMatch = "20%";
+            // bqb.minimumShouldMatch(minimumShouldMatch);
+            // bqb.must(queryBuilder);
+
+            // 构建搜索条件。
+            QueryBuilder bqb = esServiceImpl.getQueryBuiderSecond(filterModel, choiceSet);
+            NativeSearchQueryBuilder nativeSearchQueryBuilderSecond = new NativeSearchQueryBuilder();
+            nativeSearchQueryBuilderSecond.withQuery(bqb);
+            //分页
+            nativeSearchQueryBuilderSecond.withPageable(page);
+            //排序
+            //桐庐政策公告库不进行排序
+            nativeSearchQueryBuilderSecond.withSort(managerFieldSort).withSort(sort).withSort(idFieldSort);
+
+            //高亮设置
+            nativeSearchQueryBuilderSecond.withHighlightFields(esServiceImpl.setHighligthField("title"));
+            SearchQuery sqTwo = nativeSearchQueryBuilderSecond.build();
+            org.springframework.data.domain.Page<ElasticSearchTTCModel> pagelistSecond = elasticsearchTemplate.queryForPage(sqTwo, ElasticSearchTTCModel.class);
+            System.out.println("pagelistSecond:" + pagelistSecond.getContent().size());
+            if (0 == pagelistSecond.getContent().size()){
+                pagelistSecond = pagelist;
+            }
+            pagelist = pagelistSecond;
+        }
         return pagelist;
     }
 
@@ -287,19 +326,25 @@ public class SearchServiceImpl {
     // }
 
     public org.springframework.data.domain.Page<LabelIntelligentConnectionModel> buildLabelConnection(String node, Long resourceId) {
+
+        System.err.println("resourceid:" + resourceId);
+        System.err.println(node);
         //构建查询
         NativeSearchQueryBuilder nativeSearchQueryBuilder = new NativeSearchQueryBuilder();
         //搜索条件
         BoolQueryBuilder bqb = QueryBuilders.boolQuery();
         bqb.must(QueryBuilders.termQuery("backup", resourceId));
         bqb.must(QueryBuilders.termQuery("node", node));
-
         nativeSearchQueryBuilder.withQuery(bqb);
 
         //生产NativeSearchQuery
         SearchQuery sq = nativeSearchQueryBuilder.build();
         //执行
         org.springframework.data.domain.Page<LabelIntelligentConnectionModel> pagelist = elasticsearchTemplate.queryForPage(sq, LabelIntelligentConnectionModel.class);
+
+        System.err.println("bqb:" + JSON.toJSONString(bqb));
+
+        System.err.println("pagelist:" + pagelist.getSize());
         return pagelist;
     }
 
@@ -323,4 +368,10 @@ public class SearchServiceImpl {
         org.springframework.data.domain.Page<LabelIntelligentConnectionModel> pagelist = elasticsearchTemplate.queryForPage(sq, LabelIntelligentConnectionModel.class);
         return pagelist;
     }
+
+    // public static void main(String[] args) {
+    //     BoolQueryBuilder bqb = QueryBuilders.boolQuery();
+    //     bqb.must(QueryBuilders.termQuery("backup", resourceId));
+    //
+    // }
 }