JtBusinessServiceImpl.java 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548
  1. package com.goafanti.business.service.impl;
  2. import java.util.ArrayList;
  3. import java.util.Date;
  4. import java.util.HashMap;
  5. import java.util.List;
  6. import java.util.Map;
  7. import java.util.UUID;
  8. import org.apache.poi.poifs.property.Child;
  9. import org.springframework.beans.BeanUtils;
  10. import org.springframework.beans.factory.annotation.Autowired;
  11. import org.springframework.beans.factory.annotation.Value;
  12. import org.springframework.stereotype.Service;
  13. import com.goafanti.business.bo.JtBusinessCategoryBo;
  14. import com.goafanti.business.bo.JtBusinessCategoryTree;
  15. import com.goafanti.business.bo.JtBusinessProjectResult;
  16. import com.goafanti.business.bo.makeMoneyCategoryListBo;
  17. import com.goafanti.business.service.JtBusinessService;
  18. import com.goafanti.comment.bo.CommentDetailResult;
  19. import com.goafanti.common.bo.MyCollection;
  20. import com.goafanti.common.dao.JtBusinessCategoryMapper;
  21. import com.goafanti.common.dao.JtBusinessProjectMapper;
  22. import com.goafanti.common.dao.JtCollectSearchMapper;
  23. import com.goafanti.common.dao.JtCommodityCommentMapper;
  24. import com.goafanti.common.dao.JtTagMapper;
  25. import com.goafanti.common.enums.BusinessCategoryModule;
  26. import com.goafanti.common.enums.ProjectAuditStatus;
  27. import com.goafanti.common.enums.UserAuthentication;
  28. import com.goafanti.common.enums.collectType;
  29. import com.goafanti.common.model.JtBusinessCategory;
  30. import com.goafanti.common.model.JtBusinessCategoryExample;
  31. import com.goafanti.common.model.JtBusinessProject;
  32. import com.goafanti.common.model.JtCollectSearch;
  33. import com.goafanti.common.model.JtTag;
  34. import com.goafanti.common.utils.StringUtils;
  35. import com.goafanti.core.mybatis.BaseMybatisDao;
  36. import com.goafanti.core.mybatis.page.Pagination;
  37. import com.goafanti.core.shiro.token.TokenManager;
  38. import com.goafanti.order.enums.AuditState;
  39. @Service
  40. public class JtBusinessServiceImpl extends BaseMybatisDao<JtBusinessProjectMapper> implements JtBusinessService{
  41. @Autowired
  42. JtBusinessCategoryMapper jtBusinessCategoryMapper;
  43. @Autowired
  44. JtBusinessProjectMapper jtBusinessProjectMapper;
  45. @Autowired
  46. private JtTagMapper jtTagMapper;
  47. @Autowired
  48. private JtCommodityCommentMapper jtCommodityCommentMapper;
  49. @Value(value="${collect_flag}")
  50. private Boolean collectFlag ;
  51. @Autowired
  52. private JtCollectSearchMapper jtCollectSearchMapper;
  53. @Override
  54. public JtBusinessCategory getBusinessCategoryByLayerAndName(Integer layer, String name) {
  55. // TODO Auto-generated method stub
  56. return jtBusinessCategoryMapper.getBusinessCategoryByLayerAndName(layer, name);
  57. }
  58. @Override
  59. public List<JtBusinessCategory> getBusinessCategoryBySuperId(String id,Integer size) {
  60. // TODO Auto-generated method stub
  61. return jtBusinessCategoryMapper.getBusinessCategoryBySuperId(id,size);
  62. }
  63. @Override
  64. public List<JtBusinessProject> getBusinessProjectByCategoryId(String id,Integer size,Integer isHot) {
  65. // TODO Auto-generated method stub
  66. return jtBusinessProjectMapper.getBusinessProjectByCategoryId(id,size,isHot);
  67. }
  68. @Override
  69. public JtBusinessProjectResult getBusinessProjectDetail(String id) {
  70. String uid=TokenManager.getUserId();
  71. JtBusinessProjectResult j=jtBusinessProjectMapper.selectByPrimaryKeyWithModule(id,uid);
  72. j.setCommentDetailResult(jtCommodityCommentMapper.selectByProjectId(id));
  73. j.setTags(jtTagMapper.selectProjectTag(id));
  74. if (StringUtils.isBlank(j.getAdvertisement()))j.setAdvertisement("暂无描述");
  75. return j;
  76. }
  77. @Override
  78. public JtBusinessCategoryTree getCategoryTree(String id) {
  79. // TODO Auto-generated method stub
  80. return jtBusinessCategoryMapper.getCategoryTree(id);
  81. }
  82. public List<JtBusinessCategoryBo>getCategoryBoList(Integer module){
  83. return jtBusinessCategoryMapper.getCategoryBoList(module);
  84. }
  85. /*
  86. * 登录用户0 项目列表页1 privateProject
  87. * ownerId优先级高于privateProject
  88. *
  89. * ordetType---0 发布时间 1价格 2成交量
  90. * orderSort ----0大->小 1小->大
  91. *
  92. *
  93. * */
  94. @SuppressWarnings("unchecked")
  95. @Override
  96. public Pagination<JtBusinessProjectResult> getProjects(String tag,String topId, String secondId, String name, Integer pageSize,
  97. Integer pageNo,Integer privateProject,Integer auditStatus,Integer module,Integer isHot,Integer orderType,Integer orderSort,String ownerId) {
  98. if(orderType==null)orderType=0;
  99. if(orderSort==null)orderSort=0;
  100. if (pageNo == null || pageNo < 0) {
  101. pageNo = 1;
  102. }
  103. if (pageSize == null || pageSize < 0 ) {
  104. pageSize = 10;
  105. }
  106. Map<String, Object> params=disposeParams(topId, secondId, name);
  107. if(auditStatus!=null ) {
  108. params.put("auditStatus", auditStatus);
  109. }
  110. if(privateProject!=null && privateProject ==0)
  111. params.put("ownerId", TokenManager.getUserId());
  112. if(StringUtils.isNotBlank(ownerId)) {
  113. params.put("ownerId", ownerId);
  114. }
  115. if(module!=null)params.put("module", module);
  116. if(isHot!=null)params.put("isHot", isHot);
  117. if(orderType!=null)params.put("orderType", orderType);
  118. if(orderSort!=null)params.put("orderSort", orderSort);
  119. if(StringUtils.isNotBlank(tag))params.put("tag", tag);
  120. Pagination<JtBusinessProjectResult> pagination=(Pagination<JtBusinessProjectResult>)findPage("findJtBusinessProjectByPage","findJtBusinessCountByPage",params,pageNo,pageSize);
  121. List<JtBusinessProjectResult> list =(List<JtBusinessProjectResult>) pagination.getList();
  122. for (JtBusinessProjectResult j : list) {
  123. if (StringUtils.isBlank(j.getAdvertisement()))j.setAdvertisement("暂无描述");
  124. }
  125. return pagination;
  126. }
  127. private Map<String, Object> disposeParams(String topId, String secondId, String name) {
  128. Map<String, Object> params = new HashMap<>();
  129. if (StringUtils.isNotBlank(topId)) {
  130. params.put("topId", topId);
  131. }
  132. if (StringUtils.isNotBlank(secondId)) {
  133. params.put("secondId", secondId);
  134. }
  135. if (StringUtils.isNotBlank(name)) {
  136. params.put("name", name);
  137. }
  138. return params;
  139. }
  140. @Override
  141. public int insertCategory(JtBusinessCategory jtBusinessCategory) {
  142. // TODO Auto-generated method stub
  143. // jtBusinessCategoryMapper.autoIncreaseSort(jtBusinessCategory.getLayer(),jtBusinessCategory.getSort());
  144. if(jtBusinessCategory.getSuperId()!=null && jtBusinessCategory.getLayer().intValue()==1 && jtBusinessCategory.getSuperId().length()>0)return -2;
  145. //查看是否重名
  146. int n = jtBusinessCategoryMapper.getCountBySome(jtBusinessCategory);
  147. if(n>0)return -3;
  148. //String number="BC";
  149. String number=BusinessCategoryModule.getStatus(jtBusinessCategory.getModule()).toString();
  150. if(jtBusinessCategory.getLayer().intValue()==2) {
  151. //2层,先加第一层
  152. //找到当前品类父级品类
  153. JtBusinessCategory sp=jtBusinessCategoryMapper.selectByPrimaryKey(jtBusinessCategory.getSuperId());
  154. if(sp==null || sp.getLayer()!=1) {
  155. //找到的父级品类层数不是1 或者未找到
  156. return -2;
  157. }
  158. //加前层
  159. //父级品类层数为1的情况下 第一层编号为父级sort序号
  160. int size1=sp.getSort();
  161. if(size1>99)return -1;
  162. if(size1<10)number+="0";
  163. number+=size1;
  164. }
  165. //加层
  166. int size2;
  167. //通过父级id获取当前层列表
  168. List<JtBusinessCategory>businessCategories =jtBusinessCategoryMapper.getBusinessCategoryBySuperId(jtBusinessCategory.getSuperId(), null);
  169. //列表为0,当前层编号size2设置为1,大于0 设置为当前最大sort+1
  170. if(businessCategories.size()>0)
  171. size2=businessCategories.get(businessCategories.size()-1).getSort()+1;
  172. else size2=1;
  173. //每层最多99个
  174. if(size2>99)return -1;
  175. //增加0
  176. if(size2<10)number+="0";
  177. //完成编号
  178. number+=size2;
  179. jtBusinessCategory.setNumber(number);
  180. //设置sort序号
  181. jtBusinessCategory.setSort(size2);
  182. jtBusinessCategory.setCreateTime(new Date());
  183. jtBusinessCategory.setId(UUID.randomUUID().toString());
  184. return jtBusinessCategoryMapper.insertSelective(jtBusinessCategory);
  185. }
  186. @Override
  187. public int deleteCategoryById(String id) {
  188. // TODO Auto-generated method stub
  189. //查找品类
  190. JtBusinessCategory sp=jtBusinessCategoryMapper.selectByPrimaryKey(id);
  191. //查找子品类 存在子品类不允许删除
  192. List<JtBusinessCategory> chidren=jtBusinessCategoryMapper.getBusinessCategoryBySuperId(sp.getId(), null);
  193. if(chidren.size()>0) {
  194. return -1;
  195. }
  196. List<JtBusinessProject> childrenProject=jtBusinessProjectMapper.getBusinessProjectByCategoryId(id, 100,null);
  197. if(childrenProject!= null && childrenProject.size()>0) {
  198. return -1;
  199. }
  200. return jtBusinessCategoryMapper.deleteByPrimaryKey(id);
  201. }
  202. @Override
  203. public JtBusinessCategory getCategoryById(String id) {
  204. // TODO Auto-generated method stub
  205. return jtBusinessCategoryMapper.selectByPrimaryKey(id);
  206. }
  207. @Override
  208. public int updateCategory(JtBusinessCategory jtBusinessCategory) {
  209. // 层级不会变
  210. // TODO Auto-generated method stub
  211. //修改不影响结构的数据
  212. JtBusinessCategory category = new JtBusinessCategory();
  213. category.setId(jtBusinessCategory.getId());
  214. category.setImgUrl(jtBusinessCategory.getImgUrl());
  215. category.setName(jtBusinessCategory.getName());
  216. category.setSummary(jtBusinessCategory.getSummary());
  217. category.setPcIndex(jtBusinessCategory.getPcIndex());
  218. category.setAppIndex(jtBusinessCategory.getAppIndex());
  219. category.setHomeIndex(jtBusinessCategory.getHomeIndex());
  220. jtBusinessCategoryMapper.updateByPrimaryKeySelective(category);
  221. //是否修改了模块类别
  222. boolean moduleChange = null != jtBusinessCategory.getModule() ? !jtBusinessCategory.getModule().equals(jtBusinessCategory.getNextModule()) : false;
  223. //是否有上级id,并且改变了上级id
  224. boolean existSuperId = StringUtils.isNotBlank(jtBusinessCategory.getSuperId()) ? !jtBusinessCategory.getSuperId().equals(jtBusinessCategory.getOldSuperId()) : false;
  225. //获得更改前的自己的number
  226. String oldNumber = jtBusinessCategoryMapper.selectByPrimaryKey(jtBusinessCategory.getId()).getNumber();
  227. String number = null;
  228. //一级更换模块
  229. if(moduleChange && !existSuperId){
  230. jtBusinessCategory.setLayer(1);
  231. //根据模块获得字母前缀
  232. String prefix = BusinessCategoryModule.getStatus(jtBusinessCategory.getNextModule()).toString();
  233. jtBusinessCategory.setNumber(prefix + "__");
  234. number = prefix;
  235. category.setModule(jtBusinessCategory.getNextModule());
  236. jtBusinessCategory.setModule(jtBusinessCategory.getNextModule());
  237. }
  238. //存在上级说明是二级修改到不同模块的某品类中
  239. if(existSuperId){
  240. JtBusinessCategory b = jtBusinessCategoryMapper.selectByPrimaryKey(jtBusinessCategory.getSuperId());
  241. category.setModule(b.getModule());
  242. jtBusinessCategory.setLayer(2);
  243. jtBusinessCategory.setModule(b.getModule());
  244. number = b.getNumber();
  245. //获得前缀
  246. String prefix = BusinessCategoryModule.getStatus(b.getModule()).toString();
  247. number = prefix + number.substring(prefix.length()) ;
  248. jtBusinessCategory.setNumber(number + "__");
  249. category.setSuperId(jtBusinessCategory.getSuperId());//上级id也要修改
  250. }
  251. if((!moduleChange && !existSuperId) && !existSuperId){
  252. return 1;
  253. }
  254. //获得当前更改后模块的最大值
  255. String newNumber = jtBusinessCategoryMapper.getCurrentMaxNumber(jtBusinessCategory);
  256. Integer n = null != newNumber ? Integer.valueOf(newNumber.substring(newNumber.length() - 2)) : 0;
  257. if(n < 99){
  258. //将最大值加一
  259. n += 1;
  260. newNumber = number + (n<10? "0"+ n : n);
  261. } else {
  262. newNumber = jtBusinessCategoryMapper.getCurrentMaxNumber(jtBusinessCategory);
  263. n = Integer.valueOf(newNumber.substring(newNumber.length() - 2));
  264. if(n == 1 || n == 01){
  265. return -1;
  266. }
  267. //将最小值减一
  268. n -= 1;
  269. newNumber = number + (n<10? "0"+ n : n);
  270. }
  271. //修改自己和自己下级的前缀
  272. jtBusinessCategory.setLayer(newNumber.length() + 1);//截取前缀的长度位置
  273. jtBusinessCategory.setNumber(oldNumber + "%");
  274. jtBusinessCategory.setName(newNumber );
  275. //将模块前面字母替换
  276. jtBusinessCategoryMapper.updateNumberPrefix(jtBusinessCategory);
  277. //得到sort
  278. category.setSort(n);
  279. //修改自己的number
  280. category.setNumber(newNumber);
  281. //修改自己的模块
  282. jtBusinessCategoryMapper.updateByPrimaryKeySelective(category);
  283. return 1;//jtBusinessCategoryMapper.updateByPrimaryKeySelective(jtBusinessCategory);
  284. }
  285. private Map<String, Object> disposeCategoryParams(String name,Integer layer ) {
  286. Map<String, Object> params = new HashMap<>();
  287. if (layer!=null) {
  288. params.put("layer", layer);
  289. }
  290. if (StringUtils.isNotBlank(name)) {
  291. params.put("name", name);
  292. }
  293. return params;
  294. }
  295. @Override
  296. public int insertProject(JtBusinessProject jtBusinessProject) {
  297. // TODO Auto-generated method stub
  298. jtBusinessProject.setCreateTime(new Date());
  299. jtBusinessProject.setId(UUID.randomUUID().toString());
  300. jtBusinessProject.setOwnerId(TokenManager.getUserId());
  301. jtBusinessProject.setAuditStatus(ProjectAuditStatus.CREATE.getCode());
  302. List<JtBusinessProject>projects=jtBusinessProjectMapper.findProjectOrderByNumber();
  303. int cSize = 1;
  304. if(projects!=null && projects.size()>0)
  305. {
  306. String number=projects.get(projects.size()-1).getNumber();
  307. if(number!=null && number.length()==6)
  308. {
  309. String nbString=number.substring(2);
  310. try {
  311. cSize=Integer.parseInt(nbString)+1;
  312. cSize=Math.max(cSize, projects.size()+1);
  313. }catch (Exception e) {
  314. // TODO: handle exception
  315. return -1;
  316. }
  317. }
  318. else cSize=1;
  319. }
  320. else cSize=1;
  321. String nbString="BP";
  322. String sizeString="000"+cSize;
  323. sizeString=sizeString.substring(sizeString.length()-4);
  324. nbString+=sizeString;
  325. jtBusinessProject.setNumber(nbString);
  326. jtBusinessProjectMapper.insertSelective(jtBusinessProject);
  327. return 1;
  328. }
  329. @Override
  330. public int deleteProjectById(String id) {
  331. if(collectFlag)jtCollectSearchMapper.deleteByrowId(id);
  332. return jtBusinessProjectMapper.deleteByPrimaryKey(id);
  333. }
  334. @Override
  335. public int updateProject(JtBusinessProject jtBusinessProject) {
  336. jtBusinessProjectMapper.updateByPrimaryKeySelective(jtBusinessProject);
  337. if(null != jtBusinessProject.getTag()){
  338. jtTagMapper.deleteByProjectId(jtBusinessProject.getId());
  339. String str=jtBusinessProject.getTag();
  340. String[] strs = str.split(",");
  341. for (String s : strs) {
  342. jtTagMapper.insertProjectTag(UUID.randomUUID().toString(),s,jtBusinessProject.getId());
  343. }
  344. }
  345. return 1;
  346. }
  347. @Override
  348. public List<JtBusinessProject> getProjectsLimit(Integer size) {
  349. // TODO Auto-generated method stub
  350. return jtBusinessProjectMapper.findProjectOrderByNumber();
  351. }
  352. @Override
  353. public int deleteByIdAndUid(String id) {
  354. // TODO Auto-generated method stub
  355. if(TokenManager.getUserId()==null)return -1;
  356. return jtBusinessProjectMapper.deleteByIdAndUid(id,TokenManager.getUserId());
  357. }
  358. @SuppressWarnings("unchecked")
  359. @Override
  360. public Pagination<JtBusinessProject> listProjectIInterestedIn(Integer pageNo,Integer pageSize) {
  361. // TODO Auto-generated method stub
  362. if (pageNo == null || pageNo < 0) {
  363. pageNo = 1;
  364. }
  365. if (pageSize == null || pageSize < 0 || pageSize > 10) {
  366. pageSize = 10;
  367. }
  368. Map<String,Object> params=new HashMap<String,Object>();
  369. params.put("uid", TokenManager.getUserId());
  370. //params.put("uid", "1180fa62-7c42-44be-bc41-5583814d69f4");
  371. return (Pagination<JtBusinessProject>) findPage("findInterestedProjcet", "findInterestedProjcetCount", params, pageNo, pageSize);
  372. }
  373. @SuppressWarnings("unchecked")
  374. @Override
  375. public Pagination<MyCollection> myCollectionProject(Integer pageNo, Integer pageSize) {
  376. if (pageNo == null || pageNo < 0) pageNo = 1;
  377. if (pageSize == null || pageSize < 0 || pageSize > 10) pageSize = 10;
  378. Map<String,Object> params=new HashMap<String,Object>();
  379. params.put("uid", TokenManager.getUserId());
  380. // params.put("uid", "1180fa62-7c42-44be-bc41-5583814d69f4");
  381. return (Pagination<MyCollection>) findPage("myCollectionProjectList", "myCollectionProjectCount", params, pageNo, pageSize);
  382. }
  383. @Override
  384. public List<makeMoneyCategoryListBo> makeMoneyCategoryList() {
  385. List<makeMoneyCategoryListBo> l=new ArrayList<makeMoneyCategoryListBo>();
  386. //所属模块 0科技服务 1知识产权服务 2高新技术企业服务 3军民融合 4科技咨询 5科技项目
  387. l.add(new makeMoneyCategoryListBo(2,"高新技术企业服务"));
  388. l.add(new makeMoneyCategoryListBo(3,"军民融合"));
  389. l.add(new makeMoneyCategoryListBo(4,"资质认定"));
  390. l.add(new makeMoneyCategoryListBo(5,"科技项目"));
  391. for (makeMoneyCategoryListBo m : l) {
  392. m.setList(getCategoryBoList(m.getModule()));
  393. }
  394. return l;
  395. }
  396. @SuppressWarnings("unchecked")
  397. @Override
  398. public Pagination<MyCollection> recommendedApplication(Integer type,Integer pageNo, Integer pageSize) {
  399. Map<String,Object> params=new HashMap<String,Object>();
  400. if (null!=type)params.put("type", type);
  401. return (Pagination<MyCollection>) findPage("recommendedApplicationList", "recommendedApplicationCount", params, pageNo, pageSize);
  402. }
  403. @Override
  404. public List<JtBusinessCategory> getCategoryByModule(Integer module,Integer layer,Integer size) {
  405. return jtBusinessCategoryMapper.getCategoryByModule(module, layer, size);
  406. }
  407. @Override
  408. public List<JtBusinessProject> getKJListByIds(Integer module,
  409. Integer isHost, Integer size) {
  410. return jtBusinessProjectMapper.getKJListByIds( module, isHost, size);
  411. }
  412. @Override
  413. public List<JtBusinessProject> getModuleByName(String name, Integer isHost,
  414. Integer size) {
  415. return jtBusinessProjectMapper.getModuleByName(name, isHost, size);
  416. }
  417. @Override
  418. public int updateProjectMoveUp(String id) {
  419. JtBusinessCategory j1=jtBusinessCategoryMapper.selectByPrimaryKey(id);
  420. JtBusinessCategory j2=jtBusinessCategoryMapper.selectFirstLevel(id,j1.getModule(),j1.getSuperId(),0);
  421. if(null==j2){
  422. return -1;
  423. }
  424. Integer i=j1.getSort();
  425. JtBusinessCategory jtBusinessCategory=new JtBusinessCategory();
  426. jtBusinessCategory.setId(j1.getId());
  427. jtBusinessCategory.setSort(j2.getSort());
  428. jtBusinessCategoryMapper.updateByPrimaryKeySelective(jtBusinessCategory);
  429. jtBusinessCategory.setId(j2.getId());
  430. jtBusinessCategory.setSort(i);
  431. jtBusinessCategoryMapper.updateByPrimaryKeySelective(jtBusinessCategory);
  432. return 1;
  433. }
  434. @Override
  435. public int updateProjectSetTop(String id) {
  436. JtBusinessCategory j1=jtBusinessCategoryMapper.selectByPrimaryKey(id);
  437. JtBusinessCategory j2=jtBusinessCategoryMapper.selectFirstLevel(id,j1.getModule(),j1.getSuperId(),1);
  438. if(null==j2){
  439. return -1;
  440. }
  441. Integer i=j1.getSort();
  442. JtBusinessCategory jtBusinessCategory=new JtBusinessCategory();
  443. jtBusinessCategory.setId(j1.getId());
  444. jtBusinessCategory.setSort(j2.getSort());
  445. jtBusinessCategoryMapper.updateByPrimaryKeySelective(jtBusinessCategory);
  446. jtBusinessCategory.setId(j2.getId());
  447. jtBusinessCategory.setSort(i);
  448. jtBusinessCategoryMapper.updateByPrimaryKeySelective(jtBusinessCategory);
  449. return 1;
  450. }
  451. @Override
  452. public void addJtCollectSearch(JtBusinessProject jtBusinessProject) {
  453. if(collectFlag){
  454. JtCollectSearch r=new JtCollectSearch();
  455. r.setFromTable(collectType.PROJECT.getDesc());
  456. r.setKeyword(jtBusinessProject.getKeyword());
  457. r.setTitle(jtBusinessProject.getName());
  458. r.setRowId(jtBusinessProject.getId());
  459. String sum = jtBusinessProject.getAdvertisement();
  460. if(null != sum && sum.length() > 40){
  461. sum = sum.substring(0,40) + "...";
  462. }
  463. r.setSummary(sum);
  464. jtCollectSearchMapper.insertSelective(r);
  465. }
  466. }
  467. @Override
  468. public void updateJtCollectSearch(String id) {
  469. if(collectFlag)jtCollectSearchMapper.deleteByrowId(id);
  470. }
  471. @Override
  472. public List<JtBusinessCategoryBo> getHomeIndex(Integer module, Integer isHome) {
  473. return jtBusinessCategoryMapper.getHomeIndex(module,isHome);
  474. }
  475. @Override
  476. public List<JtBusinessProject> getProjectByTag(String name, Integer size) {
  477. return jtBusinessProjectMapper.getProjectByTag(name, size);
  478. }
  479. @Override
  480. public int updateByPrimaryKeySelective(JtBusinessProject jtBusinessProject) {
  481. return jtBusinessProjectMapper.updateByPrimaryKeySelective(jtBusinessProject);
  482. }
  483. }