Commit aa94ae197e4053cbacdb1a3c01394067d27dd68b
1 parent
a8542304
ini
Showing
100 changed files
with
979 additions
and
992 deletions
Too many changes to show.
To preserve performance only 100 of 116 files are displayed.
titan-api/pom.xml
... | ... | @@ -434,7 +434,7 @@ |
434 | 434 | <dependency> |
435 | 435 | <groupId>com.yqyw.user</groupId> |
436 | 436 | <artifactId>diligrp-user-client</artifactId> |
437 | - <version>0.0.4-SNAPSHOT</version> | |
437 | + <version>0.0.5-SNAPSHOT</version> | |
438 | 438 | <exclusions> |
439 | 439 | <exclusion> |
440 | 440 | <artifactId>diligrp-website-util</artifactId> |
... | ... | @@ -498,12 +498,12 @@ |
498 | 498 | <!-- 数据库 --> |
499 | 499 | <dili_titan.jdbc.driver>com.mysql.jdbc.Driver</dili_titan.jdbc.driver> |
500 | 500 | <!-- 主库配置 --> |
501 | - <dili_titan.master.jdbc.url>jdbc:MySql://10.28.10.188:3306/agriez_titan?useUnicode=true&characterEncoding=utf8</dili_titan.master.jdbc.url> | |
501 | + <dili_titan.master.jdbc.url>jdbc:MySql://10.28.11.162:3306/titan?useUnicode=true&characterEncoding=utf8</dili_titan.master.jdbc.url> | |
502 | 502 | <dili_titan.master.jdbc.username>root</dili_titan.master.jdbc.username> |
503 | 503 | <dili_titan.master.jdbc.password>123456</dili_titan.master.jdbc.password> |
504 | 504 | <!-- 从库配置 --> |
505 | - <dili_titan.slave.jdbc.url>jdbc:MySql://10.28.10.188:3306/agriez_titan?useUnicode=true&characterEncoding=utf8</dili_titan.slave.jdbc.url> | |
506 | - <dili_titan.slave.jdbc.username>du</dili_titan.slave.jdbc.username> | |
505 | + <dili_titan.slave.jdbc.url>jdbc:MySql://10.28.11.162:3306/titan?useUnicode=true&characterEncoding=utf8</dili_titan.slave.jdbc.url> | |
506 | + <dili_titan.slave.jdbc.username>root</dili_titan.slave.jdbc.username> | |
507 | 507 | <dili_titan.slave.jdbc.password>123456</dili_titan.slave.jdbc.password> |
508 | 508 | <!-- crm接口地址 --> |
509 | 509 | <dili_titan.crm.url>supplier.1n4j.com</dili_titan.crm.url> |
... | ... | @@ -514,9 +514,9 @@ |
514 | 514 | <!--shop接口地址,需要测试自己修改 --> |
515 | 515 | <dili_titan.shop.url>http://shop.1n4j.com</dili_titan.shop.url> |
516 | 516 | <!-- redis接口地址 --> |
517 | - <dili_titan.redis.url>10.28.10.208</dili_titan.redis.url> | |
517 | + <dili_titan.redis.url>10.28.11.205</dili_titan.redis.url> | |
518 | 518 | <!--权限管理的redis配置--> |
519 | - <manage.redis.url>10.28.10.208</manage.redis.url> | |
519 | + <manage.redis.url>10.28.11.205</manage.redis.url> | |
520 | 520 | <manage.redis.port>6379</manage.redis.port> |
521 | 521 | <!-- MQ 地址--> |
522 | 522 | <conf.mq.namesrvAddr>10.28.10.209:9876;10.28.10.149:9876</conf.mq.namesrvAddr> |
... | ... | @@ -536,219 +536,6 @@ |
536 | 536 | <titan.aqy.appSecret>f48d2b799f9661acdb6041e4ac7c142f</titan.aqy.appSecret> |
537 | 537 | </properties> |
538 | 538 | </profile> |
539 | - <profile> | |
540 | - <!-- 测试环境 --> | |
541 | - <id>test</id> | |
542 | - <activation> | |
543 | - <activeByDefault>false</activeByDefault> | |
544 | - </activation> | |
545 | - <properties> | |
546 | - <package.env>test</package.env> | |
547 | - <!--jdbc type --> | |
548 | - <dili_titan.jdbc.datasource.type>dbcp</dili_titan.jdbc.datasource.type> | |
549 | - <!-- 数据库 --> | |
550 | - <dili_titan.jdbc.driver>com.mysql.jdbc.Driver</dili_titan.jdbc.driver> | |
551 | - <!-- 主库配置 --> | |
552 | - <dili_titan.master.jdbc.url>jdbc:MySql://10.28.6.156:3306/agriez_titan?useUnicode=true&characterEncoding=utf8</dili_titan.master.jdbc.url> | |
553 | - <dili_titan.master.jdbc.username>root</dili_titan.master.jdbc.username> | |
554 | - <dili_titan.master.jdbc.password>123456</dili_titan.master.jdbc.password> | |
555 | - <!-- 从库配置 --> | |
556 | - <dili_titan.slave.jdbc.url>jdbc:MySql://10.28.6.155:3306/agriez_titan?useUnicode=true&characterEncoding=utf8</dili_titan.slave.jdbc.url> | |
557 | - <dili_titan.slave.jdbc.username>agriez_titan_reader</dili_titan.slave.jdbc.username> | |
558 | - <dili_titan.slave.jdbc.password>123456</dili_titan.slave.jdbc.password> | |
559 | - <!-- crm接口地址 --> | |
560 | - <dili_titan.crm.url>supplier.1n4j.com</dili_titan.crm.url> | |
561 | - <!-- user接口地址,需要测试自己修改 --> | |
562 | - <dili_titan.user.url>user.1n4j.com</dili_titan.user.url> | |
563 | - <!--关键字接口地址--> | |
564 | - <dili_titan.keywords.url>keyword.filter.1n4j.com</dili_titan.keywords.url> | |
565 | - <!--shop接口地址,需要测试自己修改 --> | |
566 | - <dili_titan.shop.url>http://shop.1n4j.com</dili_titan.shop.url> | |
567 | - <!-- redis接口地址 --> | |
568 | - <dili_titan.redis.url>10.28.10.207</dili_titan.redis.url> | |
569 | - <!--权限管理的redis配置--> | |
570 | - <manage.redis.url>10.28.10.207</manage.redis.url> | |
571 | - <manage.redis.port>6379</manage.redis.port> | |
572 | - <!-- MQ 地址--> | |
573 | - <conf.mq.namesrvAddr>10.28.10.230:9876</conf.mq.namesrvAddr> | |
574 | - <conf.mq.producerGroup>titanPNR</conf.mq.producerGroup> | |
575 | - <!-- website接口地址 --> | |
576 | - <dili_titan.website.url>manweb.1n4j.com</dili_titan.website.url> | |
577 | - <!-- 日志 --> | |
578 | - <dili_titan.log.level>INFO</dili_titan.log.level> | |
579 | - <dili_titan.log.path>/home/tomcat/export</dili_titan.log.path> | |
580 | - <dili_titan.log.root.appender>CONSOLE</dili_titan.log.root.appender> | |
581 | - <!--打包编码 --> | |
582 | - <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | |
583 | - <!-- 图片服务器前缀 --> | |
584 | - <project.imageserver.prefix>http://img0.1n4j.com</project.imageserver.prefix> | |
585 | - <!--爱奇艺视频 --> | |
586 | - <titan.aqy.appkey>e64a09bece964bb484e5decc30c0b950</titan.aqy.appkey> | |
587 | - <titan.aqy.appSecret>f48d2b799f9661acdb6041e4ac7c142f</titan.aqy.appSecret> | |
588 | - </properties> | |
589 | - </profile> | |
590 | - | |
591 | - <profile> | |
592 | - <!--预发布环境--> | |
593 | - <id>pre-online</id> | |
594 | - <!-- 默认 --> | |
595 | - <activation> | |
596 | - <activeByDefault>false</activeByDefault> | |
597 | - </activation> | |
598 | - <properties> | |
599 | - <package.env>pre-online</package.env> | |
600 | - | |
601 | - <!--jdbc type --> | |
602 | - <dili_titan.jdbc.datasource.type>dbcp</dili_titan.jdbc.datasource.type> | |
603 | - <!-- 数据库 --> | |
604 | - <dili_titan.jdbc.driver>com.mysql.jdbc.Driver</dili_titan.jdbc.driver> | |
605 | - <!-- 主库配置 --> | |
606 | - <dili_titan.master.jdbc.url>jdbc:MySql://titan.db.1n4j.com:3306/agriez_titan?useUnicode=true&characterEncoding=utf8</dili_titan.master.jdbc.url> | |
607 | - <dili_titan.master.jdbc.username>root</dili_titan.master.jdbc.username> | |
608 | - <dili_titan.master.jdbc.password>123456</dili_titan.master.jdbc.password> | |
609 | - <!-- 从库配置 --> | |
610 | - <dili_titan.slave.jdbc.url>jdbc:MySql://titan.db.1n4j.com:3306/agriez_titan?useUnicode=true&characterEncoding=utf8</dili_titan.slave.jdbc.url> | |
611 | - <dili_titan.slave.jdbc.username>root</dili_titan.slave.jdbc.username> | |
612 | - <dili_titan.slave.jdbc.password>123456</dili_titan.slave.jdbc.password> | |
613 | - <!-- crm接口地址 --> | |
614 | - <dili_titan.crm.url>supplier.1n4j.com</dili_titan.crm.url> | |
615 | - <!-- user接口地址 --> | |
616 | - <dili_titan.user.url>user.1n4j.com</dili_titan.user.url> | |
617 | - <!--关键字接口地址--> | |
618 | - <dili_titan.keywords.url>keyword.filter.1n4j.com</dili_titan.keywords.url> | |
619 | - <!--shop接口地址,需要测试自己修改 --> | |
620 | - <dili_titan.shop.url>http://shop.1n4j.com</dili_titan.shop.url> | |
621 | - <!-- redis接口地址 --> | |
622 | - <dili_titan.redis.url>redis.1n4j.com</dili_titan.redis.url> | |
623 | - <!--权限管理的redis配置--> | |
624 | - <manage.redis.url>redis.1n4j.com</manage.redis.url> | |
625 | - <manage.redis.port>6379</manage.redis.port> | |
626 | - <!-- MQ 地址--> | |
627 | - <conf.mq.namesrvAddr>10.28.6.51:9876</conf.mq.namesrvAddr> | |
628 | - <conf.mq.producerGroup>titanPNR</conf.mq.producerGroup> | |
629 | - <!-- website接口地址 --> | |
630 | - <dili_titan.website.url>manweb.1n4j.com</dili_titan.website.url> | |
631 | - <!-- 日志 --> | |
632 | - <dili_titan.log.level>INFO</dili_titan.log.level> | |
633 | - <dili_titan.log.path>/diliapp/servers/logs</dili_titan.log.path> | |
634 | - <dili_titan.log.root.appender>FILE_ALL</dili_titan.log.root.appender> | |
635 | - <!--打包编码 --> | |
636 | - <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | |
637 | - <!-- 图片服务器前缀 --> | |
638 | - <project.imageserver.prefix>http://img0.1n4j.com</project.imageserver.prefix> | |
639 | - <!--爱奇艺视频 --> | |
640 | - <titan.aqy.appkey>f689d13d9dce48039cae27e6e03940c6</titan.aqy.appkey> | |
641 | - <titan.aqy.appSecret>8633dfebb9f4443d0f1244262bca94f6</titan.aqy.appSecret> | |
642 | - </properties> | |
643 | - </profile> | |
644 | - | |
645 | - <profile> | |
646 | - <!--上线环境--> | |
647 | - <id>online</id> | |
648 | - <!-- 默认 --> | |
649 | - <activation> | |
650 | - <activeByDefault>false</activeByDefault> | |
651 | - </activation> | |
652 | - <properties> | |
653 | - <package.env>online</package.env> | |
654 | - <!--jdbc type --> | |
655 | - <dili_titan.jdbc.datasource.type>dbcp</dili_titan.jdbc.datasource.type> | |
656 | - <!-- 数据库 --> | |
657 | - <dili_titan.jdbc.driver>com.mysql.jdbc.Driver</dili_titan.jdbc.driver> | |
658 | - <!-- 主库配置 --> | |
659 | - <dili_titan.master.jdbc.url>jdbc:MySql://titan.db.1n4j.com:3306/agriez_titan?useUnicode=true&characterEncoding=utf8</dili_titan.master.jdbc.url> | |
660 | - <dili_titan.master.jdbc.username>appAccPayor</dili_titan.master.jdbc.username> | |
661 | - <dili_titan.master.jdbc.password>iTDYVBtI6MX4NQ3Er2Oh</dili_titan.master.jdbc.password> | |
662 | - <!-- 从库配置 --> | |
663 | - <dili_titan.slave.jdbc.url>jdbc:MySql://192.168.60.61:3306/agriez_titan?useUnicode=true&characterEncoding=utf8</dili_titan.slave.jdbc.url> | |
664 | - <dili_titan.slave.jdbc.username>appAccPayor</dili_titan.slave.jdbc.username> | |
665 | - <dili_titan.slave.jdbc.password>iTDYVBtI6MX4NQ3Er2Oh</dili_titan.slave.jdbc.password> | |
666 | - <!-- crm接口地址 --> | |
667 | - <dili_titan.crm.url>supplier.1n4j.com</dili_titan.crm.url> | |
668 | - <!-- user接口地址 --> | |
669 | - <dili_titan.user.url>user.1n4j.com</dili_titan.user.url> | |
670 | - <!--关键字接口地址--> | |
671 | - <dili_titan.keywords.url>keyword.filter.1n4j.com</dili_titan.keywords.url> | |
672 | - <!--shop接口地址,需要测试自己修改 --> | |
673 | - <dili_titan.shop.url>http://shop.1n4j.com</dili_titan.shop.url> | |
674 | - <!-- redis接口地址 --> | |
675 | - <dili_titan.redis.url>redis.1n4j.com</dili_titan.redis.url> | |
676 | - <!--权限管理的redis配置--> | |
677 | - <manage.redis.url>redis.1n4j.com</manage.redis.url> | |
678 | - <manage.redis.port>6379</manage.redis.port> | |
679 | - <!-- MQ 地址--> | |
680 | - <conf.mq.namesrvAddr>192.168.60.62:9876;192.168.60.63:9876</conf.mq.namesrvAddr> | |
681 | - <conf.mq.producerGroup>titanPNR</conf.mq.producerGroup> | |
682 | - <!-- website接口地址 --> | |
683 | - <dili_titan.website.url>manweb.1n4j.com</dili_titan.website.url> | |
684 | - <!-- 日志 --> | |
685 | - <dili_titan.log.level>INFO</dili_titan.log.level> | |
686 | - <dili_titan.log.path>/diliapp/servers/logs</dili_titan.log.path> | |
687 | - <dili_titan.log.root.appender>FILE_ALL</dili_titan.log.root.appender> | |
688 | - <!--打包编码 --> | |
689 | - <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | |
690 | - <!-- 图片服务器前缀 --> | |
691 | - <project.imageserver.prefix>http://img0.1n4j.com</project.imageserver.prefix> | |
692 | - <!--爱奇艺视频 --> | |
693 | - <titan.aqy.appkey>f689d13d9dce48039cae27e6e03940c6</titan.aqy.appkey> | |
694 | - <titan.aqy.appSecret>8633dfebb9f4443d0f1244262bca94f6</titan.aqy.appSecret> | |
695 | - </properties> | |
696 | - </profile> | |
697 | - | |
698 | - <profile> | |
699 | - <!-- 测试环境 --> | |
700 | - <id>pnr-clone</id> | |
701 | - <activation> | |
702 | - <activeByDefault>false</activeByDefault> | |
703 | - </activation> | |
704 | - <properties> | |
705 | - <!--jdbc type --> | |
706 | - <dili_titan.jdbc.datasource.type>dbcp | |
707 | - </dili_titan.jdbc.datasource.type> | |
708 | - <!-- 数据库 --> | |
709 | - <dili_titan.jdbc.driver>com.mysql.jdbc.Driver</dili_titan.jdbc.driver> | |
710 | - <!-- 主库配置 --> | |
711 | - <dili_titan.master.jdbc.url>jdbc:MySql://10.28.5.236:3306/titan?useUnicode=true&characterEncoding=utf8</dili_titan.master.jdbc.url> | |
712 | - <dili_titan.master.jdbc.username>root</dili_titan.master.jdbc.username> | |
713 | - <dili_titan.master.jdbc.password>123456</dili_titan.master.jdbc.password> | |
714 | - <!-- 从库配置 --> | |
715 | - <dili_titan.slave.jdbc.url>jdbc:MySql://10.28.5.235:3306/titan?useUnicode=true&characterEncoding=utf8</dili_titan.slave.jdbc.url> | |
716 | - <dili_titan.slave.jdbc.username>titan_reader</dili_titan.slave.jdbc.username> | |
717 | - <dili_titan.slave.jdbc.password>123456</dili_titan.slave.jdbc.password> | |
718 | - <!-- crm接口地址 --> | |
719 | - <dili_titan.crm.url>supplier.1n4j.com</dili_titan.crm.url> | |
720 | - <!-- user接口地址,需要测试自己修改 --> | |
721 | - <dili_titan.user.url>user.1n4j.com</dili_titan.user.url> | |
722 | - <!--关键字接口地址--> | |
723 | - <dili_titan.keywords.url>keyword.filter.1n4j.com</dili_titan.keywords.url> | |
724 | - <!--shop接口地址,需要测试自己修改 --> | |
725 | - <dili_titan.shop.url>http://shop.1n4j.com</dili_titan.shop.url> | |
726 | - <!-- redis接口地址 --> | |
727 | - <dili_titan.redis.url>10.28.5.200</dili_titan.redis.url> | |
728 | - <!--权限管理的redis配置--> | |
729 | - <manage.redis.url>10.28.5.200</manage.redis.url> | |
730 | - <manage.redis.port>6379</manage.redis.port> | |
731 | - <!-- MQ 地址--> | |
732 | - <conf.mq.namesrvAddr>10.28.5.202:9876;10.28.5.203:9876</conf.mq.namesrvAddr> | |
733 | - <conf.mq.producerGroup>titanPNR</conf.mq.producerGroup> | |
734 | - <!-- website接口地址 --> | |
735 | - <dili_titan.website.url>manweb.1n4j.com | |
736 | - </dili_titan.website.url> | |
737 | - <!-- 日志 --> | |
738 | - <dili_titan.log.level>INFO</dili_titan.log.level> | |
739 | - <dili_titan.log.path>/home/tomcat/export</dili_titan.log.path> | |
740 | - <dili_titan.log.root.appender>CONSOLE | |
741 | - </dili_titan.log.root.appender> | |
742 | - <!--打包编码 --> | |
743 | - <project.build.sourceEncoding>UTF-8 | |
744 | - </project.build.sourceEncoding> | |
745 | - <!-- 图片服务器前缀 --> | |
746 | - <project.imageserver.prefix>http://img0.1n4j.com</project.imageserver.prefix> | |
747 | - <!--爱奇艺视频 --> | |
748 | - <titan.aqy.appkey>f689d13d9dce48039cae27e6e03940c6</titan.aqy.appkey> | |
749 | - <titan.aqy.appSecret>8633dfebb9f4443d0f1244262bca94f6</titan.aqy.appSecret> | |
750 | - </properties> | |
751 | - </profile> | |
752 | 539 | </profiles> |
753 | 540 | |
754 | 541 | </project> | ... | ... |
titan-api/src/main/java/com/diligrp/titan/dao/base/BaseDaoImpl.java
... | ... | @@ -91,7 +91,7 @@ public abstract class BaseDaoImpl<T, KEY extends Serializable> extends MyBatisSu |
91 | 91 | return null; |
92 | 92 | } |
93 | 93 | |
94 | - public List<T> selectEntryList(KEY... key) { | |
94 | + public List<T> selectEntryList(KEY... key) { | |
95 | 95 | if (key == null || key.length <= 0) { |
96 | 96 | return null; |
97 | 97 | } | ... | ... |
titan-api/src/main/java/com/diligrp/titan/dao/category/CategoryDao.java
... | ... | @@ -30,5 +30,13 @@ public interface CategoryDao extends BaseDao<Category,Integer>{ |
30 | 30 | * @author ywd |
31 | 31 | */ |
32 | 32 | public List<CategoryAttr> getCategorySeacherAttrById(int cateId); |
33 | - | |
33 | + | |
34 | + /** | |
35 | + * 创建分类 | |
36 | + * @author xiaoyang@diligrp.com 2014年5月23日 | |
37 | + * | |
38 | + * @param category | |
39 | + * @return 分类id | |
40 | + */ | |
41 | + public Long createCategory(Category category); | |
34 | 42 | } | ... | ... |
titan-api/src/main/java/com/diligrp/titan/dao/category/impl/CategoryDaoImpl.java
... | ... | @@ -8,6 +8,7 @@ import com.diligrp.titan.dao.base.BaseDaoImpl; |
8 | 8 | import com.diligrp.titan.dao.category.CategoryDao; |
9 | 9 | import com.diligrp.titan.domain.Category; |
10 | 10 | import com.diligrp.titan.domain.CategoryAttr; |
11 | +import com.diligrp.titan.domain.common.TitanSequence; | |
11 | 12 | import org.springframework.stereotype.Repository; |
12 | 13 | |
13 | 14 | import java.util.List; |
... | ... | @@ -33,5 +34,16 @@ public class CategoryDaoImpl extends BaseDaoImpl<Category,Integer> implements Ca |
33 | 34 | public List<CategoryAttr> getCategorySeacherAttrById(int cateId) { |
34 | 35 | return this.selectList(getNameSpace("selectCateSeacherAttrById"), cateId); |
35 | 36 | } |
36 | - | |
37 | + | |
38 | + @Override | |
39 | + public Long createCategory(Category category) { | |
40 | + TitanSequence seq = this.getSequence("category", 1, Long.MAX_VALUE, 1); | |
41 | + category.setId(seq.getMinValue()); | |
42 | + int result = this.insert(getNameSpace("insertEntry"), category); | |
43 | + if(result <=0){ | |
44 | + throw new RuntimeException("添加数据失败!"); | |
45 | + } | |
46 | + return category.getId(); | |
47 | + } | |
48 | + | |
37 | 49 | } | ... | ... |
titan-api/src/main/java/com/diligrp/titan/dao/gq/impl/PresaleDaoImpl.java
... | ... | @@ -17,7 +17,7 @@ import org.springframework.stereotype.Repository; |
17 | 17 | */ |
18 | 18 | @Repository("presaleDao") |
19 | 19 | public class PresaleDaoImpl extends BaseDaoImpl<Presale,Long> implements PresaleDao { |
20 | - private final static String NAMESPACE = "com.dili.titan.dao.PresaleDao."; | |
20 | + private final static String NAMESPACE = "com.diligrp.titan.dao.PresaleDao."; | |
21 | 21 | |
22 | 22 | //返回本DAO命名空间,并添加statement |
23 | 23 | public String getNameSpace(String statement) { | ... | ... |
titan-api/src/main/java/com/diligrp/titan/dao/gq/impl/PurchaseDaoImpl.java
... | ... | @@ -17,7 +17,7 @@ import org.springframework.stereotype.Repository; |
17 | 17 | */ |
18 | 18 | @Repository("purchaseDao") |
19 | 19 | public class PurchaseDaoImpl extends BaseDaoImpl<Purchase,Long> implements PurchaseDao { |
20 | - private final static String NAMESPACE = "com.dili.titan.dao.PurchaseDao."; | |
20 | + private final static String NAMESPACE = "com.diligrp.titan.dao.PurchaseDao."; | |
21 | 21 | |
22 | 22 | //返回本DAO命名空间,并添加statement |
23 | 23 | public String getNameSpace(String statement) { | ... | ... |
titan-api/src/main/java/com/diligrp/titan/dao/gq/impl/SupplyDaoImpl.java
... | ... | @@ -17,7 +17,7 @@ import org.springframework.stereotype.Repository; |
17 | 17 | */ |
18 | 18 | @Repository("supplyDao") |
19 | 19 | public class SupplyDaoImpl extends BaseDaoImpl<Supply,Long> implements SupplyDao { |
20 | - private final static String NAMESPACE = "com.dili.titan.dao.SupplyDao."; | |
20 | + private final static String NAMESPACE = "com.diligrp.titan.dao.SupplyDao."; | |
21 | 21 | |
22 | 22 | //返回本DAO命名空间,并添加statement |
23 | 23 | public String getNameSpace(String statement) { | ... | ... |
titan-api/src/main/java/com/diligrp/titan/dao/product/impl/ProductSearchSortDaoImpl.java
... | ... | @@ -20,7 +20,7 @@ import org.springframework.stereotype.Repository; |
20 | 20 | */ |
21 | 21 | @Repository("productSearchSortDao") |
22 | 22 | public class ProductSearchSortDaoImpl extends BaseDaoImpl<ProductSearchSort,Integer> implements ProductSearchSortDao { |
23 | - private final static String NAMESPACE = "com.dili.titan.dao.ProductSearchSortDao."; | |
23 | + private final static String NAMESPACE = "com.diligrp.titan.dao.ProductSearchSortDao."; | |
24 | 24 | |
25 | 25 | //返回本DAO命名空间,并添加statement |
26 | 26 | public String getNameSpace(String statement) { | ... | ... |
titan-api/src/main/java/com/diligrp/titan/dao/product/impl/ProductVideoDaoImpl.java
... | ... | @@ -16,7 +16,7 @@ import org.springframework.stereotype.Repository; |
16 | 16 | */ |
17 | 17 | @Repository("productVideoDao") |
18 | 18 | public class ProductVideoDaoImpl extends BaseDaoImpl<ProductVideo,Long> implements ProductVideoDao { |
19 | - private final static String NAMESPACE = "com.dili.titan.dao.ProductVideoDao."; | |
19 | + private final static String NAMESPACE = "com.diligrp.titan.dao.ProductVideoDao."; | |
20 | 20 | |
21 | 21 | //返回本DAO命名空间,并添加statement |
22 | 22 | public String getNameSpace(String statement) { | ... | ... |
titan-api/src/main/java/com/diligrp/titan/domain/Category.java
... | ... | @@ -55,7 +55,35 @@ public class Category extends BaseDomain implements Comparable<Category>{ |
55 | 55 | private String icon; |
56 | 56 | private boolean hasChild; |
57 | 57 | private Integer dealType; |
58 | - //当前分类包含其父分类的集合 | |
58 | + private Integer shopId; | |
59 | + private String note; | |
60 | + private String productImg; | |
61 | + | |
62 | + public String getNote() { | |
63 | + return note; | |
64 | + } | |
65 | + | |
66 | + public void setNote(String note) { | |
67 | + this.note = note; | |
68 | + } | |
69 | + | |
70 | + public String getProductImg() { | |
71 | + return productImg; | |
72 | + } | |
73 | + | |
74 | + public void setProductImg(String productImg) { | |
75 | + this.productImg = productImg; | |
76 | + } | |
77 | + | |
78 | + public Integer getShopId() { | |
79 | + return shopId; | |
80 | + } | |
81 | + | |
82 | + public void setShopId(Integer shopId) { | |
83 | + this.shopId = shopId; | |
84 | + } | |
85 | + | |
86 | + //当前分类包含其父分类的集合 | |
59 | 87 | private List<Category> allLevelateList; |
60 | 88 | |
61 | 89 | public Category(){ | ... | ... |
titan-api/src/main/java/com/diligrp/titan/rest/domain/output/CategoryOut.java
... | ... | @@ -48,7 +48,37 @@ public class CategoryOut { |
48 | 48 | |
49 | 49 | private String icon; |
50 | 50 | |
51 | - /** | |
51 | + private String note; | |
52 | + | |
53 | + private String productImg; | |
54 | + | |
55 | + private int shopId; | |
56 | + | |
57 | + public String getNote() { | |
58 | + return note; | |
59 | + } | |
60 | + | |
61 | + public void setNote(String note) { | |
62 | + this.note = note; | |
63 | + } | |
64 | + | |
65 | + public String getProductImg() { | |
66 | + return productImg; | |
67 | + } | |
68 | + | |
69 | + public void setProductImg(String productImg) { | |
70 | + this.productImg = productImg; | |
71 | + } | |
72 | + | |
73 | + public int getShopId() { | |
74 | + return shopId; | |
75 | + } | |
76 | + | |
77 | + public void setShopId(int shopId) { | |
78 | + this.shopId = shopId; | |
79 | + } | |
80 | + | |
81 | + /** | |
52 | 82 | * 类目别名,空格分隔 |
53 | 83 | */ |
54 | 84 | private String alias; | ... | ... |
titan-api/src/main/java/com/diligrp/titan/service/category/CategoryService.java
... | ... | @@ -35,7 +35,7 @@ public interface CategoryService extends BaseService<Category,Integer> { |
35 | 35 | * @createTime 2015年3月6日 下午2:12:36 |
36 | 36 | * @author ywd |
37 | 37 | */ |
38 | - public Set<String> getChildCidByParentId(int cid); | |
38 | + public Set<String> getChildCidByParentId(int cid,int shopId); | |
39 | 39 | |
40 | 40 | /** |
41 | 41 | * this method is 根据类目ID获取类目属性 |
... | ... | @@ -65,4 +65,8 @@ public interface CategoryService extends BaseService<Category,Integer> { |
65 | 65 | * @author ywd |
66 | 66 | */ |
67 | 67 | public boolean hasChildren(int cid); |
68 | + | |
69 | + public Long addCategory(Category categoryOut); | |
70 | + | |
71 | + public Boolean updateCategory(Category category); | |
68 | 72 | } | ... | ... |
titan-api/src/main/java/com/diligrp/titan/service/category/impl/CategoryServiceImpl.java
... | ... | @@ -5,13 +5,13 @@ |
5 | 5 | package com.diligrp.titan.service.category.impl; |
6 | 6 | |
7 | 7 | import com.alibaba.fastjson.JSON; |
8 | -import com.diligrp.titan.rpc.redis.JedisClient; | |
9 | 8 | import com.diligrp.titan.dao.base.BaseDao; |
10 | 9 | import com.diligrp.titan.dao.category.CategoryDao; |
11 | 10 | import com.diligrp.titan.domain.Category; |
12 | 11 | import com.diligrp.titan.domain.CategoryAttr; |
13 | 12 | import com.diligrp.titan.domain.base.RedisKeyConstant; |
14 | 13 | import com.diligrp.titan.rest.domain.output.CategoryOut; |
14 | +import com.diligrp.titan.rpc.redis.JedisClient; | |
15 | 15 | import com.diligrp.titan.service.base.BaseServiceImpl; |
16 | 16 | import com.diligrp.titan.service.category.CategoryService; |
17 | 17 | import org.apache.commons.collections.CollectionUtils; |
... | ... | @@ -19,136 +19,209 @@ import org.apache.commons.lang3.StringUtils; |
19 | 19 | import org.springframework.stereotype.Service; |
20 | 20 | |
21 | 21 | import javax.annotation.Resource; |
22 | -import java.util.HashSet; | |
23 | -import java.util.List; | |
24 | -import java.util.Set; | |
22 | +import java.util.*; | |
25 | 23 | |
26 | 24 | /** |
27 | 25 | * CategoryService 实现类 |
26 | + * | |
28 | 27 | * @author dev-center |
29 | 28 | * @since 2014-05-10 |
30 | 29 | */ |
31 | 30 | @Service("categoryService") |
32 | -public class CategoryServiceImpl extends BaseServiceImpl<Category,Integer> implements CategoryService { | |
33 | - | |
34 | - @Resource private CategoryDao categoryDao; | |
35 | - @Resource(name = "jedisClient") | |
36 | - private JedisClient client; | |
37 | - | |
38 | - public BaseDao<Category,Integer> getDao() { | |
39 | - return categoryDao; | |
40 | - } | |
31 | +public class CategoryServiceImpl extends BaseServiceImpl<Category, Integer> implements CategoryService { | |
32 | + | |
33 | + @Resource | |
34 | + private CategoryDao categoryDao; | |
35 | + @Resource(name = "jedisClient") | |
36 | + private JedisClient client; | |
41 | 37 | |
42 | - /** | |
43 | - * this method is 根据类目ID获取类目信息 | |
44 | - * @param cid | |
45 | - * @return | |
46 | - * @createTime 2015年3月6日 下午2:12:54 | |
47 | - * @author ywd | |
48 | - */ | |
49 | - public CategoryOut getCategoryOut(int cid){ | |
50 | - String catJSon = client.hget(RedisKeyConstant.CATEGORY_KEY, String.valueOf(cid)); | |
51 | - CategoryOut cat = null; | |
52 | - if(StringUtils.isNotEmpty(catJSon)){ | |
53 | - cat = JSON.parseObject(catJSon, CategoryOut.class); | |
54 | - return cat; | |
55 | - } | |
56 | - Category cateDB = categoryDao.selectEntry(cid); | |
57 | - if(cateDB !=null){ | |
58 | - cat = JSON.parseObject(JSON.toJSONString(cateDB), CategoryOut.class); | |
59 | - client.hput(RedisKeyConstant.CATEGORY_KEY, String.valueOf(cid), JSON.toJSONString(cat), JedisClient.expireTime); | |
60 | - } | |
61 | - return cat; | |
62 | - } | |
63 | - | |
64 | - /** | |
65 | - * this method is 根据类目ID获取子节点类目ID | |
66 | - * @param cid | |
67 | - * @return | |
68 | - * @createTime 2015年3月6日 下午2:12:36 | |
69 | - * @author ywd | |
70 | - */ | |
71 | - public Set<String> getChildCidByParentId(int cid){ | |
72 | - // 获取子节点id | |
73 | - Set<String> childCids = client.smembers(RedisKeyConstant.CHILD_KEY + cid); | |
74 | - if(CollectionUtils.isEmpty(childCids)){ | |
75 | - Category cg = new Category(); | |
76 | - cg.setParent(cid); | |
77 | - cg.setStatus(1); | |
78 | - List<Category> cateList = categoryDao.selectEntryList(cg); | |
79 | - if(CollectionUtils.isEmpty(cateList)){ | |
80 | - return null; | |
81 | - } | |
82 | - childCids = new HashSet<String>(cateList.size()); | |
83 | - for(Category obj : cateList){ | |
84 | - childCids.add(obj.getId().toString()); | |
85 | - } | |
86 | - String[] a = new String[childCids.size()]; | |
87 | - client.sadd(RedisKeyConstant.CHILD_KEY + cid, JedisClient.expireTime, childCids.toArray(a)); | |
88 | - } | |
89 | - return childCids; | |
90 | - } | |
91 | - | |
38 | + public BaseDao<Category, Integer> getDao() { | |
39 | + return categoryDao; | |
40 | + } | |
41 | + | |
42 | + /** | |
43 | + * this method is 根据类目ID获取类目信息 | |
44 | + * | |
45 | + * @param cid | |
46 | + * @return | |
47 | + * @createTime 2015年3月6日 下午2:12:54 | |
48 | + * @author ywd | |
49 | + */ | |
50 | + public CategoryOut getCategoryOut(int cid) { | |
51 | + String catJSon = client.hget(RedisKeyConstant.CATEGORY_KEY, String.valueOf(cid)); | |
52 | + CategoryOut cat = null; | |
53 | + if (StringUtils.isNotEmpty(catJSon)) { | |
54 | + cat = JSON.parseObject(catJSon, CategoryOut.class); | |
55 | + return cat; | |
56 | + } | |
57 | + Category cateDB = categoryDao.selectEntry(cid); | |
58 | + if (cateDB != null) { | |
59 | + cat = JSON.parseObject(JSON.toJSONString(cateDB), CategoryOut.class); | |
60 | + client.hput(RedisKeyConstant.CATEGORY_KEY, String.valueOf(cid), JSON.toJSONString(cat), JedisClient.expireTime); | |
61 | + } | |
62 | + return cat; | |
63 | + } | |
92 | 64 | |
93 | - /** | |
94 | - * this method is 根据类目ID获取类目属性 | |
95 | - * @param cid | |
96 | - * @return | |
97 | - * @createTime 2015年3月6日 下午2:12:17 | |
98 | - * @author ywd | |
99 | - */ | |
100 | - public List<CategoryAttr> getCategoryAttrByCid(int cid){ | |
101 | - List<CategoryAttr> catAttrs = null; | |
102 | - String categoryAttrJson = client.hget(RedisKeyConstant.CATEGORY_ATTR, String.valueOf(cid)); | |
103 | - if(StringUtils.isNotEmpty(categoryAttrJson)){ | |
104 | - catAttrs = JSON.parseArray(categoryAttrJson, CategoryAttr.class); | |
105 | - return catAttrs; | |
106 | - } | |
65 | + /** | |
66 | + * this method is 根据类目ID获取子节点类目ID | |
67 | + * | |
68 | + * @param cid | |
69 | + * @return | |
70 | + * @createTime 2015年3月6日 下午2:12:36 | |
71 | + * @author ywd | |
72 | + */ | |
73 | + public Set<String> getChildCidByParentId(int cid, int shopId) { | |
74 | + // 获取子节点id | |
75 | + Set<String> childCids; | |
76 | + Category cg = new Category(); | |
77 | + cg.setParent(cid); | |
78 | + cg.setStatus(1); | |
79 | + cg.setShopId(shopId); | |
80 | + List<Category> cateList = categoryDao.selectEntryList(cg); | |
81 | + if (CollectionUtils.isEmpty(cateList)) { | |
82 | + return null; | |
83 | + } | |
84 | + childCids = new HashSet<String>(cateList.size()); | |
85 | + for (Category obj : cateList) { | |
86 | + childCids.add(obj.getId().toString()); | |
87 | + } | |
88 | + String[] a = new String[childCids.size()]; | |
89 | + return childCids; | |
90 | + } | |
91 | + | |
92 | + | |
93 | + /** | |
94 | + * this method is 根据类目ID获取类目属性 | |
95 | + * | |
96 | + * @param cid | |
97 | + * @return | |
98 | + * @createTime 2015年3月6日 下午2:12:17 | |
99 | + * @author ywd | |
100 | + */ | |
101 | + public List<CategoryAttr> getCategoryAttrByCid(int cid) { | |
102 | + List<CategoryAttr> catAttrs = null; | |
103 | + String categoryAttrJson = client.hget(RedisKeyConstant.CATEGORY_ATTR, String.valueOf(cid)); | |
104 | + if (StringUtils.isNotEmpty(categoryAttrJson)) { | |
105 | + catAttrs = JSON.parseArray(categoryAttrJson, CategoryAttr.class); | |
106 | + return catAttrs; | |
107 | + } | |
107 | 108 | catAttrs = categoryDao.getCategoryAttrById(cid); |
108 | - if(CollectionUtils.isNotEmpty(catAttrs)){ | |
109 | - client.hput(RedisKeyConstant.CATEGORY_ATTR, String.valueOf(cid), JSON.toJSONString(catAttrs), JedisClient.expireTime); | |
109 | + if (CollectionUtils.isNotEmpty(catAttrs)) { | |
110 | + client.hput(RedisKeyConstant.CATEGORY_ATTR, String.valueOf(cid), JSON.toJSONString(catAttrs), JedisClient.expireTime); | |
110 | 111 | } |
111 | 112 | return catAttrs; |
112 | - } | |
113 | + } | |
113 | 114 | |
114 | - /** | |
115 | - * this method is 根据类目ID获取可搜索属性 | |
116 | - * @param cid | |
117 | - * @return | |
118 | - * @createTime 2015年3月6日 下午3:51:55 | |
119 | - * @author ywd | |
120 | - */ | |
121 | - public List<CategoryAttr> getCatgorySearchAttrs(int cid){ | |
122 | - List<CategoryAttr> catSearchAttrs = null; | |
123 | - String search_attr =client.hget(RedisKeyConstant.CATE_SEARCH_ATTR, String.valueOf(cid)); //为可搜索属性则设置排序 | |
124 | - if(StringUtils.isNotEmpty(search_attr)){ | |
125 | - catSearchAttrs = JSON.parseArray(search_attr, CategoryAttr.class); | |
126 | - } | |
127 | - if(CollectionUtils.isNotEmpty(catSearchAttrs)){ | |
115 | + /** | |
116 | + * this method is 根据类目ID获取可搜索属性 | |
117 | + * | |
118 | + * @param cid | |
119 | + * @return | |
120 | + * @createTime 2015年3月6日 下午3:51:55 | |
121 | + * @author ywd | |
122 | + */ | |
123 | + public List<CategoryAttr> getCatgorySearchAttrs(int cid) { | |
124 | + List<CategoryAttr> catSearchAttrs = null; | |
125 | + String search_attr = client.hget(RedisKeyConstant.CATE_SEARCH_ATTR, String.valueOf(cid)); //为可搜索属性则设置排序 | |
126 | + if (StringUtils.isNotEmpty(search_attr)) { | |
127 | + catSearchAttrs = JSON.parseArray(search_attr, CategoryAttr.class); | |
128 | + } | |
129 | + if (CollectionUtils.isNotEmpty(catSearchAttrs)) { | |
128 | 130 | catSearchAttrs = categoryDao.getCategorySeacherAttrById(cid); |
129 | - client.hput(RedisKeyConstant.CATE_SEARCH_ATTR, String.valueOf(cid), JSON.toJSONString(catSearchAttrs), JedisClient.expireTime); | |
130 | - } | |
131 | - return catSearchAttrs; | |
132 | - } | |
133 | - | |
134 | - /** | |
135 | - * this method is 根据类目ID判断是否有子类目 | |
136 | - * @param cid | |
137 | - * @return | |
138 | - * @createTime 2015年3月24日 上午11:09:00 | |
139 | - * @author ywd | |
140 | - */ | |
141 | - public boolean hasChildren(int cid) { | |
142 | - boolean isExit = client.exists(RedisKeyConstant.CHILD_KEY + cid); | |
143 | - if(!isExit){ | |
144 | - Category t = new Category(); | |
145 | - t.setParent(cid); | |
146 | - Integer count = categoryDao.selectEntryListCount(t); | |
147 | - if(count != null && count >0){ | |
148 | - isExit = true; | |
149 | - } | |
150 | - } | |
151 | - return isExit; | |
152 | - } | |
153 | - | |
131 | + client.hput(RedisKeyConstant.CATE_SEARCH_ATTR, String.valueOf(cid), JSON.toJSONString(catSearchAttrs), JedisClient.expireTime); | |
132 | + } | |
133 | + return catSearchAttrs; | |
134 | + } | |
135 | + | |
136 | + /** | |
137 | + * this method is 根据类目ID判断是否有子类目 | |
138 | + * | |
139 | + * @param cid | |
140 | + * @return | |
141 | + * @createTime 2015年3月24日 上午11:09:00 | |
142 | + * @author ywd | |
143 | + */ | |
144 | + public boolean hasChildren(int cid) { | |
145 | + boolean isExit = client.exists(RedisKeyConstant.CHILD_KEY + cid); | |
146 | + if (!isExit) { | |
147 | + Category t = new Category(); | |
148 | + t.setParent(cid); | |
149 | + Integer count = categoryDao.selectEntryListCount(t); | |
150 | + if (count != null && count > 0) { | |
151 | + isExit = true; | |
152 | + } | |
153 | + } | |
154 | + return isExit; | |
155 | + } | |
156 | + | |
157 | + @Override | |
158 | + public Long addCategory(Category categoryOut) { | |
159 | + //查询是否存在相同分类名 | |
160 | + Category isExitCate = new Category(); | |
161 | + isExitCate.setName(categoryOut.getName()); | |
162 | + isExitCate.setParent(categoryOut.getParent()); | |
163 | + List<Category> exist = this.selectEntryList(isExitCate); | |
164 | + if (CollectionUtils.isNotEmpty(exist)) { | |
165 | + if (!exist.get(0).getStatus().equals(Category.STATUS_DELETED)) { | |
166 | + throw new IllegalArgumentException("该分类已经被添加,不能再次添加"); | |
167 | + } | |
168 | + isExitCate = exist.get(0); | |
169 | + isExitCate.setIcon(categoryOut.getIcon()); | |
170 | + isExitCate.setStatus(Category.STATUS_NORMAL); | |
171 | + int rt = categoryDao.updateByKey(isExitCate); | |
172 | + if(rt <= 0){ | |
173 | + throw new IllegalArgumentException("创建分类失败"); | |
174 | + } | |
175 | + return isExitCate.getId(); | |
176 | + } else { | |
177 | + categoryOut.setStatus(Category.STATUS_NORMAL); | |
178 | + categoryOut.setDealType(Category.DEALTYPE_ONLINE); | |
179 | + categoryOut.setActivate(Category.SHOW_STATUS_ACTIVE); | |
180 | + categoryOut.setOrder(this.getCategoryEndOrder(categoryOut.getParent())+1); | |
181 | + Long id = categoryDao.createCategory(categoryOut); | |
182 | + return id; | |
183 | + } | |
184 | + } | |
185 | + | |
186 | + @Override | |
187 | + public Boolean updateCategory(Category category) { | |
188 | + Category existCat = this.selectEntry(category.getId().intValue()); | |
189 | + if (existCat == null | |
190 | + || !existCat.getStatus().equals(Category.STATUS_NORMAL)) { | |
191 | + throw new RuntimeException("分类不存在或状态异常,更新失败"); | |
192 | + } | |
193 | + // 判断同一级是否有相同分类名(包含已删除分类名) | |
194 | + if (!existCat.getName().equals(category.getName())) { | |
195 | + Category cateExist = new Category(); | |
196 | + cateExist.setName(category.getName()); | |
197 | +// cateExist.setAlias(category.getAlias()); | |
198 | + cateExist.setParent(existCat.getParent()); | |
199 | + List<Category> exist = this.selectEntryList(cateExist); | |
200 | + if (CollectionUtils.isNotEmpty(exist)) { | |
201 | + if (!exist.get(0).getStatus().equals(Category.STATUS_DELETED)) { | |
202 | + throw new IllegalArgumentException("该分类已经被添加,不能再次添加!"); | |
203 | + } else { | |
204 | + throw new RuntimeException("该分类处于删除状态,请重新添加"); | |
205 | + } | |
206 | + } | |
207 | + } | |
208 | + existCat.setName(category.getName()); | |
209 | + existCat.setIcon(category.getIcon()); | |
210 | + return categoryDao.updateByKey(existCat) >0; | |
211 | + } | |
212 | + | |
213 | + private int getCategoryEndOrder(Integer parentId) { | |
214 | + Category condition = new Category(); | |
215 | + condition.setParent(parentId); | |
216 | + List<Category> list = categoryDao.selectEntryList(condition); | |
217 | + if(CollectionUtils.isEmpty(list)){ | |
218 | + return 0; | |
219 | + } | |
220 | + Collections.sort(list, new Comparator<Category>(){ | |
221 | + public int compare(Category o1, Category o2) { | |
222 | + return o1.getOrder() - o1.getOrder(); | |
223 | + } | |
224 | + }); | |
225 | + return list.get(list.size() - 1).getOrder(); | |
226 | + } | |
154 | 227 | } | ... | ... |
titan-api/src/main/java/com/diligrp/titan/web/ws/category/CategoryWebservice.java
... | ... | @@ -5,6 +5,7 @@ import com.diligrp.titan.common.exception.TitanError; |
5 | 5 | import com.diligrp.titan.common.log.LogHelper; |
6 | 6 | import com.diligrp.titan.common.log.LogTypeEnum; |
7 | 7 | import com.diligrp.titan.common.tools.Tools; |
8 | +import com.diligrp.titan.domain.Category; | |
8 | 9 | import com.diligrp.titan.rest.domain.output.AttributeOut; |
9 | 10 | import com.diligrp.titan.rest.domain.output.BaseOutput; |
10 | 11 | import com.diligrp.titan.rest.domain.output.CategoryOut; |
... | ... | @@ -28,116 +29,169 @@ import java.util.List; |
28 | 29 | * <B>Description</B> 商品类目服务的ws <br /> |
29 | 30 | * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br /> |
30 | 31 | * <B>Company</B> 地利集团 |
31 | - * @createTime 2014年6月10日 下午3:00:56 | |
32 | + * | |
32 | 33 | * @author yangjianjun |
34 | + * @createTime 2014年6月10日 下午3:00:56 | |
33 | 35 | */ |
34 | 36 | @Service |
35 | 37 | @RequestMapping(value = "/category", produces = "application/json; charset=UTF-8") |
36 | 38 | public class CategoryWebservice extends BaseWebservice { |
37 | 39 | |
38 | - @Resource(name = "categoryRestService") | |
39 | - private CategoryRestService categoryRestService; | |
40 | - /** | |
41 | - * 查询分类cid下的所有子类目<br/> | |
42 | - * 1.初始化输出的BaseOutput<List<CategoryOut>>对象<br/> | |
43 | - * 2.将HttpServletRequest对象转为CategoryOut对象,传给categoryRestService.listAll方法<br/> | |
44 | - * 3.取categoryRestService.listAll方法返回的对象,封装在BaseOutput<List<CategoryOut>>里,并返回 | |
45 | - * @return | |
46 | - * @createTime 2014年5月28日 上午1:36:37 | |
47 | - * @author celine | |
48 | - */ | |
49 | - @RequestMapping(value = "/listAll", method = { RequestMethod.POST, | |
50 | - RequestMethod.GET }) | |
51 | - public @ResponseBody | |
52 | - Object listAll(HttpServletRequest request, HttpServletResponse response) { | |
40 | + @Resource(name = "categoryRestService") | |
41 | + private CategoryRestService categoryRestService; | |
42 | + | |
43 | + @RequestMapping(value = "/insertCategory", method = RequestMethod.POST, | |
44 | + produces = "application/json; charset=UTF-8", consumes = "application/json; charset=UTF-8") | |
45 | + @ResponseBody | |
46 | + public Object insertCategory(HttpServletRequest request, HttpServletResponse response) { | |
47 | + long start = System.currentTimeMillis(); | |
48 | + BaseOutput<Long> output = new BaseOutput<Long>(); | |
49 | + try { | |
50 | + Category category = getParamObject(request, Category.class); | |
51 | + | |
52 | + | |
53 | + LogHelper.info(LogTypeEnum.PRODUCT, "调用接口insertCategory参数:{}", JSON.toJSONString(category)); | |
54 | + | |
55 | + categoryRestService.addCategory(category); | |
56 | + | |
57 | + LogHelper.info(LogTypeEnum.PRODUCT, "调用接口insertCategory成功!返回内容={},耗时:{}", | |
58 | + JSON.toJSONString(output.getData()), System.currentTimeMillis() - start); | |
59 | + return output; | |
60 | + } catch (TitanError e) { | |
61 | + LogHelper.error(LogTypeEnum.PRODUCT, e, "调用接口insertCategory异常!耗时:{}", System.currentTimeMillis() - start); | |
62 | + return output.failure(e); | |
63 | + } | |
64 | + } | |
65 | + | |
66 | + @RequestMapping(value = "/updateCategory", method = RequestMethod.POST, | |
67 | + produces = "application/json; charset=UTF-8", consumes = "application/json; charset=UTF-8") | |
68 | + @ResponseBody | |
69 | + public Object updateCategory(HttpServletRequest request){ | |
53 | 70 | long start = System.currentTimeMillis(); |
54 | - BaseOutput<List<CategoryOut>> output = new BaseOutput<List<CategoryOut>>(); | |
55 | - try { | |
56 | - CategoryOut category = getParamObject(request, CategoryOut.class); | |
57 | - LogHelper.info(LogTypeEnum.CATEGORY,"调用接口listAll参数:{}",category.toString()); | |
58 | - List<CategoryOut> cats = categoryRestService.listAll(category.getCid()); | |
59 | - output.setData(cats); | |
60 | - LogHelper.info(LogTypeEnum.CATEGORY,"调用接口listAll成功!返回内容={},耗时:{}", | |
61 | - JSON.toJSONString(cats),System.currentTimeMillis() - start); | |
62 | - return output; | |
63 | - } catch (TitanError e) { | |
71 | + BaseOutput<Long> output = new BaseOutput<Long>(); | |
72 | + try { | |
73 | + Category category = getParamObject(request, Category.class); | |
74 | + | |
75 | + | |
76 | + LogHelper.info(LogTypeEnum.PRODUCT, "调用接口updateCategory参数:{}", JSON.toJSONString(category)); | |
77 | + | |
78 | + categoryRestService.updateCategory(category); | |
79 | + | |
80 | + LogHelper.info(LogTypeEnum.PRODUCT, "调用接口updateCategory成功!返回内容={},耗时:{}", | |
81 | + JSON.toJSONString(output.getData()), System.currentTimeMillis() - start); | |
82 | + return output; | |
83 | + } catch (TitanError e) { | |
84 | + LogHelper.error(LogTypeEnum.PRODUCT, e, "调用接口updateCategory异常!耗时:{}", System.currentTimeMillis() - start); | |
85 | + return output.failure(e); | |
86 | + } | |
87 | + } | |
88 | + | |
89 | + /** | |
90 | + * 查询分类cid下的所有子类目<br/> | |
91 | + * 1.初始化输出的BaseOutput<List<CategoryOut>>对象<br/> | |
92 | + * 2.将HttpServletRequest对象转为CategoryOut对象,传给categoryRestService.listAll方法<br/> | |
93 | + * 3.取categoryRestService.listAll方法返回的对象,封装在BaseOutput<List<CategoryOut>>里,并返回 | |
94 | + * | |
95 | + * @return | |
96 | + * @createTime 2014年5月28日 上午1:36:37 | |
97 | + * @author celine | |
98 | + */ | |
99 | + @RequestMapping(value = "/listAll", method = {RequestMethod.POST, | |
100 | + RequestMethod.GET}) | |
101 | + public | |
102 | + @ResponseBody | |
103 | + Object listAll(HttpServletRequest request, HttpServletResponse response) { | |
104 | + long start = System.currentTimeMillis(); | |
105 | + BaseOutput<List<CategoryOut>> output = new BaseOutput<List<CategoryOut>>(); | |
106 | + try { | |
107 | + CategoryOut category = getParamObject(request, CategoryOut.class); | |
108 | + LogHelper.info(LogTypeEnum.CATEGORY, "调用接口listAll参数:{}", category.toString()); | |
109 | + List<CategoryOut> cats = categoryRestService.listAll(category.getCid(), category.getShopId()); | |
110 | + output.setData(cats); | |
111 | + LogHelper.info(LogTypeEnum.CATEGORY, "调用接口listAll成功!返回内容={},耗时:{}", | |
112 | + JSON.toJSONString(cats), System.currentTimeMillis() - start); | |
113 | + return output; | |
114 | + } catch (TitanError e) { | |
64 | 115 | LogHelper.error(LogTypeEnum.CATEGORY, e, "调用接口listAll异常!耗时:{}", |
65 | 116 | System.currentTimeMillis() - start); |
66 | - return output.failure(e); | |
67 | - } | |
68 | - } | |
117 | + return output.failure(e); | |
118 | + } | |
119 | + } | |
69 | 120 | |
70 | - /** | |
71 | - * 查询类目面包屑,返回结果进行正序排序 | |
72 | - * @param request | |
73 | - * @param response | |
74 | - * @return | |
75 | - * @createTime 2014年5月29日 上午11:06:34 | |
76 | - * @author celine | |
77 | - */ | |
78 | - @RequestMapping(value = "/listCrumbs", method = { RequestMethod.POST, | |
79 | - RequestMethod.GET }) | |
80 | - @ResponseBody | |
81 | - public Object listCrumbs(HttpServletRequest request, HttpServletResponse response) { | |
121 | + /** | |
122 | + * 查询类目面包屑,返回结果进行正序排序 | |
123 | + * | |
124 | + * @param request | |
125 | + * @param response | |
126 | + * @return | |
127 | + * @createTime 2014年5月29日 上午11:06:34 | |
128 | + * @author celine | |
129 | + */ | |
130 | + @RequestMapping(value = "/listCrumbs", method = {RequestMethod.POST, | |
131 | + RequestMethod.GET}) | |
132 | + @ResponseBody | |
133 | + public Object listCrumbs(HttpServletRequest request, HttpServletResponse response) { | |
82 | 134 | MonitorUtils.startMonitor(); |
83 | 135 | MonitorUtils.flowMonitor(CategoryWebservice.class, "获取面包屑listCrumbs"); |
84 | 136 | long start = System.currentTimeMillis(); |
85 | - BaseOutput<List<CategoryOut>> output = new BaseOutput<List<CategoryOut>>(); | |
86 | - try { | |
87 | - CategoryOut category = getParamObject(request, CategoryOut.class); | |
88 | - LogHelper.info(LogTypeEnum.CATEGORY,"调用接口listCrumbs参数:{}",category.toString()); | |
89 | - List<CategoryOut> cats = categoryRestService.listCrumbs(category.getCid()); | |
90 | - output.setData(cats); | |
91 | - LogHelper.info(LogTypeEnum.CATEGORY,"调用接口listCrumbs成功!返回内容={},耗时:{}", | |
92 | - JSON.toJSONString(cats),System.currentTimeMillis() - start); | |
137 | + BaseOutput<List<CategoryOut>> output = new BaseOutput<List<CategoryOut>>(); | |
138 | + try { | |
139 | + CategoryOut category = getParamObject(request, CategoryOut.class); | |
140 | + LogHelper.info(LogTypeEnum.CATEGORY, "调用接口listCrumbs参数:{}", category.toString()); | |
141 | + List<CategoryOut> cats = categoryRestService.listCrumbs(category.getCid()); | |
142 | + output.setData(cats); | |
143 | + LogHelper.info(LogTypeEnum.CATEGORY, "调用接口listCrumbs成功!返回内容={},耗时:{}", | |
144 | + JSON.toJSONString(cats), System.currentTimeMillis() - start); | |
93 | 145 | MonitorUtils.endMonitor(CategoryWebservice.class, "获取面包屑listCrumbs"); |
94 | - return output; | |
95 | - } catch (TitanError e) { | |
96 | - LogHelper.error(LogTypeEnum.CATEGORY,e,"调用接口listCrumbs异常!耗时:{}",System.currentTimeMillis() - start); | |
146 | + return output; | |
147 | + } catch (TitanError e) { | |
148 | + LogHelper.error(LogTypeEnum.CATEGORY, e, "调用接口listCrumbs异常!耗时:{}", System.currentTimeMillis() - start); | |
97 | 149 | MonitorUtils.endMonitor(CategoryWebservice.class, "获取面包屑listCrumbs"); |
98 | - MonitorUtils.errorMonitor(CategoryWebservice.class, "获取面包屑listCrumbs","异常:"+e.getMessage()); | |
99 | - return output.failure(e); | |
100 | - } | |
101 | - } | |
150 | + MonitorUtils.errorMonitor(CategoryWebservice.class, "获取面包屑listCrumbs", "异常:" + e.getMessage()); | |
151 | + return output.failure(e); | |
152 | + } | |
153 | + } | |
102 | 154 | |
103 | - /** | |
104 | - * 获取类目属性 | |
105 | - * @param request | |
106 | - * @param response | |
107 | - * @return | |
108 | - * @createTime 2014年5月29日 下午3:27:22 | |
109 | - * @author celine | |
110 | - */ | |
111 | - @RequestMapping(value = "/attributes", method = { RequestMethod.POST, | |
112 | - RequestMethod.GET }) | |
113 | - @ResponseBody | |
114 | - public Object attributes(HttpServletRequest request, HttpServletResponse response) { | |
155 | + /** | |
156 | + * 获取类目属性 | |
157 | + * | |
158 | + * @param request | |
159 | + * @param response | |
160 | + * @return | |
161 | + * @createTime 2014年5月29日 下午3:27:22 | |
162 | + * @author celine | |
163 | + */ | |
164 | + @RequestMapping(value = "/attributes", method = {RequestMethod.POST, | |
165 | + RequestMethod.GET}) | |
166 | + @ResponseBody | |
167 | + public Object attributes(HttpServletRequest request, HttpServletResponse response) { | |
115 | 168 | long start = System.currentTimeMillis(); |
116 | - BaseOutput<HashMap<String, List<AttributeOut>>> output = new BaseOutput<HashMap<String, List<AttributeOut>>>(); | |
117 | - try { | |
118 | - CategoryOut category = getParamObject(request, CategoryOut.class); | |
119 | - LogHelper.info(LogTypeEnum.CATEGORY,"调用接口attributes参数:{}",category.toString()); | |
120 | - HashMap<String, List<AttributeOut>> attributes = categoryRestService.listAttributes(category.getCid()); | |
121 | - output.setData(attributes); | |
122 | - LogHelper.info(LogTypeEnum.CATEGORY,"调用接口attributes成功!返回内容={},耗时:{}", | |
123 | - JSON.toJSONString(attributes),System.currentTimeMillis() - start); | |
124 | - return output; | |
125 | - } catch (TitanError e) { | |
126 | - LogHelper.error(LogTypeEnum.CATEGORY,e,"调用接口attributes异常!耗时:{}",System.currentTimeMillis() - start); | |
127 | - return output.failure(e); | |
128 | - } | |
129 | - } | |
169 | + BaseOutput<HashMap<String, List<AttributeOut>>> output = new BaseOutput<HashMap<String, List<AttributeOut>>>(); | |
170 | + try { | |
171 | + CategoryOut category = getParamObject(request, CategoryOut.class); | |
172 | + LogHelper.info(LogTypeEnum.CATEGORY, "调用接口attributes参数:{}", category.toString()); | |
173 | + HashMap<String, List<AttributeOut>> attributes = categoryRestService.listAttributes(category.getCid()); | |
174 | + output.setData(attributes); | |
175 | + LogHelper.info(LogTypeEnum.CATEGORY, "调用接口attributes成功!返回内容={},耗时:{}", | |
176 | + JSON.toJSONString(attributes), System.currentTimeMillis() - start); | |
177 | + return output; | |
178 | + } catch (TitanError e) { | |
179 | + LogHelper.error(LogTypeEnum.CATEGORY, e, "调用接口attributes异常!耗时:{}", System.currentTimeMillis() - start); | |
180 | + return output.failure(e); | |
181 | + } | |
182 | + } | |
130 | 183 | |
131 | 184 | /** |
132 | 185 | * 获取类目属性 |
186 | + * | |
133 | 187 | * @param request |
134 | 188 | * @param response |
135 | 189 | * @return |
136 | 190 | * @createTime 2014年5月29日 下午3:27:22 |
137 | 191 | * @author celine |
138 | 192 | */ |
139 | - @RequestMapping(value = "/getAttributes", method = { RequestMethod.POST, | |
140 | - RequestMethod.GET }) | |
193 | + @RequestMapping(value = "/getAttributes", method = {RequestMethod.POST, | |
194 | + RequestMethod.GET}) | |
141 | 195 | @ResponseBody |
142 | 196 | public Object getAttributes(HttpServletRequest request, HttpServletResponse response) { |
143 | 197 | long start = System.currentTimeMillis(); |
... | ... | @@ -145,140 +199,145 @@ public class CategoryWebservice extends BaseWebservice { |
145 | 199 | try { |
146 | 200 | HashMap<String, Object> param = getParamObject(request, new TypeReference<HashMap<String, Object>>() { |
147 | 201 | }); |
148 | - LogHelper.info(LogTypeEnum.CATEGORY,"调用接口attributes参数:{}",param.toString()); | |
149 | - Integer cid = (Integer)param.get("cid"); | |
150 | - Boolean includeDel = (Boolean)param.get("includeDel"); | |
151 | - HashMap<String, List<AttributeOut>> attributes = categoryRestService.listAttributes(cid,includeDel); | |
202 | + LogHelper.info(LogTypeEnum.CATEGORY, "调用接口attributes参数:{}", param.toString()); | |
203 | + Integer cid = (Integer) param.get("cid"); | |
204 | + Boolean includeDel = (Boolean) param.get("includeDel"); | |
205 | + HashMap<String, List<AttributeOut>> attributes = categoryRestService.listAttributes(cid, includeDel); | |
152 | 206 | output.setData(attributes); |
153 | - LogHelper.info(LogTypeEnum.CATEGORY,"调用接口attributes成功!返回内容={},耗时:{}", | |
154 | - JSON.toJSONString(attributes),System.currentTimeMillis() - start); | |
207 | + LogHelper.info(LogTypeEnum.CATEGORY, "调用接口attributes成功!返回内容={},耗时:{}", | |
208 | + JSON.toJSONString(attributes), System.currentTimeMillis() - start); | |
155 | 209 | return output; |
156 | 210 | } catch (TitanError e) { |
157 | - LogHelper.error(LogTypeEnum.CATEGORY,e,"调用接口attributes异常!耗时:{}",System.currentTimeMillis() - start); | |
211 | + LogHelper.error(LogTypeEnum.CATEGORY, e, "调用接口attributes异常!耗时:{}", System.currentTimeMillis() - start); | |
158 | 212 | return output.failure(e); |
159 | 213 | } |
160 | 214 | } |
161 | 215 | |
162 | - /** | |
163 | - * 批量获取类目信息 | |
164 | - * @param request | |
165 | - * @param response | |
166 | - * @return | |
167 | - * @createTime 2014年5月30日 上午10:03:46 | |
168 | - * @author celine | |
169 | - */ | |
170 | - @RequestMapping(value = "/listCategoriesInfo", method = { | |
216 | + /** | |
217 | + * 批量获取类目信息 | |
218 | + * | |
219 | + * @param request | |
220 | + * @param response | |
221 | + * @return | |
222 | + * @createTime 2014年5月30日 上午10:03:46 | |
223 | + * @author celine | |
224 | + */ | |
225 | + @RequestMapping(value = "/listCategoriesInfo", method = { | |
171 | 226 | RequestMethod.POST, |
172 | - RequestMethod.GET }) | |
173 | - @ResponseBody | |
174 | - public Object listCategoriesInfo(HttpServletRequest request, HttpServletResponse response) { | |
227 | + RequestMethod.GET}) | |
228 | + @ResponseBody | |
229 | + public Object listCategoriesInfo(HttpServletRequest request, HttpServletResponse response) { | |
175 | 230 | long start = System.currentTimeMillis(); |
176 | - BaseOutput<List<CategoryOut>> output = new BaseOutput<List<CategoryOut>>(); | |
177 | - try { | |
178 | - HashMap<String, ArrayList<Integer>> cids = getParamObject(request, new TypeReference<HashMap<String, ArrayList<Integer>>>() { | |
179 | - }); | |
180 | - LogHelper.info(LogTypeEnum.CATEGORY,"调用接口listCategoriesInfo参数:{}",JSON.toJSONString(cids)); | |
181 | - List<CategoryOut> categories = categoryRestService.listCategoriesInfo(cids.get("cids")); | |
182 | - output.setData(categories); | |
183 | - LogHelper.info(LogTypeEnum.CATEGORY,"调用接口listCategoriesInfo成功!返回内容={},耗时:{}", | |
184 | - JSON.toJSONString(categories),System.currentTimeMillis() - start); | |
185 | - return output; | |
186 | - } catch (TitanError e) { | |
187 | - LogHelper.error(LogTypeEnum.CATEGORY,e,"调用接口listCategoriesInfo异常!耗时:{}",System.currentTimeMillis() - start); | |
188 | - return output.failure(e); | |
189 | - } | |
190 | - } | |
231 | + BaseOutput<List<CategoryOut>> output = new BaseOutput<List<CategoryOut>>(); | |
232 | + try { | |
233 | + HashMap<String, ArrayList<Integer>> cids = getParamObject(request, new TypeReference<HashMap<String, ArrayList<Integer>>>() { | |
234 | + }); | |
235 | + LogHelper.info(LogTypeEnum.CATEGORY, "调用接口listCategoriesInfo参数:{}", JSON.toJSONString(cids)); | |
236 | + List<CategoryOut> categories = categoryRestService.listCategoriesInfo(cids.get("cids")); | |
237 | + output.setData(categories); | |
238 | + LogHelper.info(LogTypeEnum.CATEGORY, "调用接口listCategoriesInfo成功!返回内容={},耗时:{}", | |
239 | + JSON.toJSONString(categories), System.currentTimeMillis() - start); | |
240 | + return output; | |
241 | + } catch (TitanError e) { | |
242 | + LogHelper.error(LogTypeEnum.CATEGORY, e, "调用接口listCategoriesInfo异常!耗时:{}", System.currentTimeMillis() - start); | |
243 | + return output.failure(e); | |
244 | + } | |
245 | + } | |
191 | 246 | |
192 | - /** | |
193 | - * 获取类目信息 | |
194 | - * @param request | |
195 | - * @param response | |
196 | - * @return | |
197 | - * @createTime 2014年5月30日 上午10:03:59 | |
198 | - * @author celine | |
199 | - */ | |
200 | - @RequestMapping(value = "/getCategoryInfo", method = { RequestMethod.POST, | |
201 | - RequestMethod.GET }) | |
202 | - @ResponseBody | |
203 | - public Object getCategoryInfo(HttpServletRequest request, HttpServletResponse response) { | |
247 | + /** | |
248 | + * 获取类目信息 | |
249 | + * | |
250 | + * @param request | |
251 | + * @param response | |
252 | + * @return | |
253 | + * @createTime 2014年5月30日 上午10:03:59 | |
254 | + * @author celine | |
255 | + */ | |
256 | + @RequestMapping(value = "/getCategoryInfo", method = {RequestMethod.POST, | |
257 | + RequestMethod.GET}) | |
258 | + @ResponseBody | |
259 | + public Object getCategoryInfo(HttpServletRequest request, HttpServletResponse response) { | |
204 | 260 | long start = System.currentTimeMillis(); |
205 | - BaseOutput<CategoryOut> output = new BaseOutput<CategoryOut>(); | |
206 | - try { | |
207 | - CategoryOut category = getParamObject(request, CategoryOut.class); | |
208 | - LogHelper.info(LogTypeEnum.CATEGORY,"调用接口getCategoryInfo参数:{}",category.toString()); | |
209 | - category = categoryRestService.getCatrgoryInfo(category.getCid(),true); | |
210 | - output.setData(category); | |
211 | - LogHelper.info(LogTypeEnum.CATEGORY,"调用接口getCategoryInfo成功!返回内容={},耗时:{}", | |
212 | - JSON.toJSONString(category),System.currentTimeMillis() - start); | |
213 | - return output; | |
214 | - } catch (TitanError e) { | |
215 | - LogHelper.error(LogTypeEnum.CATEGORY,e,"调用接口getCategoryInfo异常!耗时:{}",System.currentTimeMillis() - start); | |
216 | - return output.failure(e); | |
217 | - } | |
218 | - } | |
219 | - | |
220 | - /** | |
221 | - * this method is 列出运营范围下的子类目 | |
222 | - * @param request | |
223 | - * @param response | |
224 | - * @return | |
225 | - * @createTime 2014年10月27日 下午6:04:41 | |
226 | - * @author yangweidong | |
227 | - */ | |
228 | - @RequestMapping(value = "/listChildren", method = { RequestMethod.POST, | |
261 | + BaseOutput<CategoryOut> output = new BaseOutput<CategoryOut>(); | |
262 | + try { | |
263 | + CategoryOut category = getParamObject(request, CategoryOut.class); | |
264 | + LogHelper.info(LogTypeEnum.CATEGORY, "调用接口getCategoryInfo参数:{}", category.toString()); | |
265 | + category = categoryRestService.getCatrgoryInfo(category.getCid(), true); | |
266 | + output.setData(category); | |
267 | + LogHelper.info(LogTypeEnum.CATEGORY, "调用接口getCategoryInfo成功!返回内容={},耗时:{}", | |
268 | + JSON.toJSONString(category), System.currentTimeMillis() - start); | |
269 | + return output; | |
270 | + } catch (TitanError e) { | |
271 | + LogHelper.error(LogTypeEnum.CATEGORY, e, "调用接口getCategoryInfo异常!耗时:{}", System.currentTimeMillis() - start); | |
272 | + return output.failure(e); | |
273 | + } | |
274 | + } | |
275 | + | |
276 | + /** | |
277 | + * this method is 列出运营范围下的子类目 | |
278 | + * | |
279 | + * @param request | |
280 | + * @param response | |
281 | + * @return | |
282 | + * @createTime 2014年10月27日 下午6:04:41 | |
283 | + * @author yangweidong | |
284 | + */ | |
285 | + @RequestMapping(value = "/listChildren", method = {RequestMethod.POST, | |
229 | 286 | RequestMethod.GET}) |
230 | - @ResponseBody | |
231 | - public Object listChildren(HttpServletRequest request, HttpServletResponse response) { | |
287 | + @ResponseBody | |
288 | + public Object listChildren(HttpServletRequest request, HttpServletResponse response) { | |
232 | 289 | long start = System.currentTimeMillis(); |
233 | - BaseOutput<List<CategoryOut>> output = new BaseOutput<List<CategoryOut>>(); | |
234 | - try { | |
235 | - HashMap<String, Integer> param = getParamObject(request, new TypeReference<HashMap<String, Integer>>() { | |
236 | - }); | |
237 | - LogHelper.info(LogTypeEnum.CATEGORY,"调用接口listChildren参数:{}",JSON.toJSONString(param)); | |
238 | - List<CategoryOut> categoryList = categoryRestService.listChildren(param.get("cid")); | |
239 | - output.setData(categoryList); | |
240 | - LogHelper.info(LogTypeEnum.CATEGORY,"调用接口listChildren成功!返回内容={},耗时:{}", | |
241 | - JSON.toJSONString(categoryList),System.currentTimeMillis() - start); | |
242 | - return output; | |
243 | - } catch (TitanError e) { | |
244 | - LogHelper.error(LogTypeEnum.CATEGORY,e,"调用接口listChildren异常!耗时:{}",System.currentTimeMillis() - start); | |
245 | - return output.failure(e); | |
246 | - } | |
247 | - } | |
248 | - /** | |
249 | - * this method is 通过分类名字模糊匹配分类 | |
250 | - * @param request | |
251 | - * @param response | |
252 | - * @return | |
253 | - * @createTime 2014年10月27日 下午6:02:54 | |
254 | - * @author yangweidong | |
255 | - */ | |
256 | - @RequestMapping(value="/searchCategoryInfo",method = RequestMethod.POST) | |
257 | - @ResponseBody | |
258 | - public Object searchCategoryInfo(HttpServletRequest request, HttpServletResponse response){ | |
290 | + BaseOutput<List<CategoryOut>> output = new BaseOutput<List<CategoryOut>>(); | |
291 | + try { | |
292 | + HashMap<String, Integer> param = getParamObject(request, new TypeReference<HashMap<String, Integer>>() { | |
293 | + }); | |
294 | + LogHelper.info(LogTypeEnum.CATEGORY, "调用接口listChildren参数:{}", JSON.toJSONString(param)); | |
295 | + List<CategoryOut> categoryList = categoryRestService.listChildren(param.get("cid"), param.get("shopId")); | |
296 | + output.setData(categoryList); | |
297 | + LogHelper.info(LogTypeEnum.CATEGORY, "调用接口listChildren成功!返回内容={},耗时:{}", | |
298 | + JSON.toJSONString(categoryList), System.currentTimeMillis() - start); | |
299 | + return output; | |
300 | + } catch (TitanError e) { | |
301 | + LogHelper.error(LogTypeEnum.CATEGORY, e, "调用接口listChildren异常!耗时:{}", System.currentTimeMillis() - start); | |
302 | + return output.failure(e); | |
303 | + } | |
304 | + } | |
305 | + | |
306 | + /** | |
307 | + * this method is 通过分类名字模糊匹配分类 | |
308 | + * | |
309 | + * @param request | |
310 | + * @param response | |
311 | + * @return | |
312 | + * @createTime 2014年10月27日 下午6:02:54 | |
313 | + * @author yangweidong | |
314 | + */ | |
315 | + @RequestMapping(value = "/searchCategoryInfo", method = RequestMethod.POST) | |
316 | + @ResponseBody | |
317 | + public Object searchCategoryInfo(HttpServletRequest request, HttpServletResponse response) { | |
259 | 318 | long start = System.currentTimeMillis(); |
260 | - BaseOutput<List<CategoryOut>> output = new BaseOutput<List<CategoryOut>>(); | |
261 | - List<CategoryOut> cate=new ArrayList<CategoryOut>(); | |
262 | - try { | |
263 | - HashMap<String, String> map = getParamObject(request, new TypeReference<HashMap<String, String>>() { | |
264 | - }); | |
265 | - String cname=map.get("cname"); | |
266 | - LogHelper.info(LogTypeEnum.CATEGORY,"调用接口searchCategoryInfo参数:{}",cname); | |
267 | - List<CategoryOut> cats = categoryRestService.listAll(0); | |
268 | - if(!Tools.checkListNotNull(cats)){ | |
269 | - for(CategoryOut categoryOut:cats){ | |
270 | - if(categoryOut.getCname().indexOf(cname,0)>=0){ | |
271 | - cate.add(categoryOut); | |
272 | - } | |
273 | - } | |
274 | - output.setData(cate); | |
275 | - } | |
276 | - } catch (TitanError e) { | |
277 | - LogHelper.error(LogTypeEnum.CATEGORY,e,"调用接口searchCategoryInfo异常!耗时:{}",System.currentTimeMillis() - start); | |
278 | - return output.failure(e); | |
279 | - } | |
280 | - LogHelper.info(LogTypeEnum.CATEGORY,"调用接口searchCategoryInfo成功!返回内容={},耗时:{}", | |
281 | - JSON.toJSONString(output.getData()),System.currentTimeMillis() - start); | |
282 | - return output; | |
283 | - } | |
319 | + BaseOutput<List<CategoryOut>> output = new BaseOutput<List<CategoryOut>>(); | |
320 | + List<CategoryOut> cate = new ArrayList<CategoryOut>(); | |
321 | + try { | |
322 | + HashMap<String, String> map = getParamObject(request, new TypeReference<HashMap<String, String>>() { | |
323 | + }); | |
324 | + String cname = map.get("cname"); | |
325 | + LogHelper.info(LogTypeEnum.CATEGORY, "调用接口searchCategoryInfo参数:{}", cname); | |
326 | + List<CategoryOut> cats = categoryRestService.listAll(0, 0); | |
327 | + if (!Tools.checkListNotNull(cats)) { | |
328 | + for (CategoryOut categoryOut : cats) { | |
329 | + if (categoryOut.getCname().indexOf(cname, 0) >= 0) { | |
330 | + cate.add(categoryOut); | |
331 | + } | |
332 | + } | |
333 | + output.setData(cate); | |
334 | + } | |
335 | + } catch (TitanError e) { | |
336 | + LogHelper.error(LogTypeEnum.CATEGORY, e, "调用接口searchCategoryInfo异常!耗时:{}", System.currentTimeMillis() - start); | |
337 | + return output.failure(e); | |
338 | + } | |
339 | + LogHelper.info(LogTypeEnum.CATEGORY, "调用接口searchCategoryInfo成功!返回内容={},耗时:{}", | |
340 | + JSON.toJSONString(output.getData()), System.currentTimeMillis() - start); | |
341 | + return output; | |
342 | + } | |
284 | 343 | } | ... | ... |
titan-api/src/main/java/com/diligrp/titan/ws/category/CategoryRestService.java
1 | 1 | package com.diligrp.titan.ws.category; |
2 | 2 | |
3 | +import com.diligrp.titan.domain.Category; | |
3 | 4 | import com.diligrp.titan.rest.domain.output.AttributeOut; |
4 | 5 | import com.diligrp.titan.rest.domain.output.CategoryOut; |
5 | 6 | |
... | ... | @@ -15,7 +16,7 @@ public interface CategoryRestService { |
15 | 16 | * @createTime 2014年5月29日 下午2:42:07 |
16 | 17 | * @author celine |
17 | 18 | */ |
18 | - public List<CategoryOut> listAll(int cid); | |
19 | + public List<CategoryOut> listAll(int cid,int shopId); | |
19 | 20 | |
20 | 21 | /** |
21 | 22 | * 获取类目面包屑 |
... | ... | @@ -32,7 +33,7 @@ public interface CategoryRestService { |
32 | 33 | * @param cid 类目ID |
33 | 34 | * @return |
34 | 35 | */ |
35 | - public List<CategoryOut> listChildren(int cid); | |
36 | + public List<CategoryOut> listChildren(int cid,int shopId); | |
36 | 37 | |
37 | 38 | |
38 | 39 | |
... | ... | @@ -81,4 +82,8 @@ public interface CategoryRestService { |
81 | 82 | * @author ywd |
82 | 83 | */ |
83 | 84 | public boolean hasChildren(int cid); |
85 | + | |
86 | + public Long addCategory(Category category); | |
87 | + | |
88 | + Boolean updateCategory(Category category); | |
84 | 89 | } | ... | ... |
titan-api/src/main/java/com/diligrp/titan/ws/category/impl/CategoryRestServiceImpl.java
... | ... | @@ -2,6 +2,7 @@ package com.diligrp.titan.ws.category.impl; |
2 | 2 | |
3 | 3 | import com.diligrp.titan.common.datasource.DynamicSource; |
4 | 4 | import com.diligrp.titan.common.tools.Tools; |
5 | +import com.diligrp.titan.domain.Category; | |
5 | 6 | import com.diligrp.titan.domain.CategoryAttr; |
6 | 7 | import com.diligrp.titan.rest.domain.output.AttributeOut; |
7 | 8 | import com.diligrp.titan.rest.domain.output.CategoryOut; |
... | ... | @@ -34,18 +35,19 @@ public class CategoryRestServiceImpl implements CategoryRestService { |
34 | 35 | |
35 | 36 | /** |
36 | 37 | * 查询类目下的所有子孙类目 |
37 | - * 1.初始化要返回的List<CategoryOut>对象 | |
38 | + * 1.初始化要返回的List<CategoryOut>对象 | |
39 | + * | |
38 | 40 | * @param cid |
39 | 41 | * @return |
40 | 42 | * @createTime 2014年5月29日 下午2:42:07 |
41 | 43 | * @author celine |
42 | 44 | */ |
43 | - public List<CategoryOut> listAll(int cid) { | |
45 | + public List<CategoryOut> listAll(int cid, int shopId) { | |
44 | 46 | List<CategoryOut> cats = new ArrayList<CategoryOut>(); |
45 | 47 | boolean hasChild = categoryService.hasChildren(cid); |
46 | 48 | if (hasChild) { |
47 | 49 | // 获取所有的子节点id |
48 | - Set<String> childCids = categoryService.getChildCidByParentId(cid); | |
50 | + Set<String> childCids = categoryService.getChildCidByParentId(cid,shopId); | |
49 | 51 | if (CollectionUtils.isEmpty(childCids)) { |
50 | 52 | return null; |
51 | 53 | } |
... | ... | @@ -63,8 +65,8 @@ public class CategoryRestServiceImpl implements CategoryRestService { |
63 | 65 | } |
64 | 66 | |
65 | 67 | // 递归获取子节点的子孙,并加入cat |
66 | - List<CategoryOut> childCats = listAll(Integer.parseInt(childCid)); | |
67 | - if(CollectionUtils.isEmpty(childCats)){ | |
68 | + List<CategoryOut> childCats = listAll(Integer.parseInt(childCid),shopId); | |
69 | + if (CollectionUtils.isEmpty(childCats)) { | |
68 | 70 | continue; |
69 | 71 | } |
70 | 72 | for (CategoryOut child : childCats) { |
... | ... | @@ -112,11 +114,11 @@ public class CategoryRestServiceImpl implements CategoryRestService { |
112 | 114 | * @createTime 2014年5月29日 下午2:41:39 |
113 | 115 | * @author celine |
114 | 116 | */ |
115 | - public List<CategoryOut> listChildren(int cid) { | |
117 | + public List<CategoryOut> listChildren(int cid,int shopId) { | |
116 | 118 | List<CategoryOut> cats = new ArrayList<CategoryOut>(); |
117 | 119 | if (categoryService.hasChildren(cid)) { |
118 | 120 | // 获取子节点id |
119 | - Set<String> childCids = categoryService.getChildCidByParentId(cid); | |
121 | + Set<String> childCids = categoryService.getChildCidByParentId(cid,shopId); | |
120 | 122 | if (CollectionUtils.isEmpty(childCids)) { |
121 | 123 | return null; |
122 | 124 | } |
... | ... | @@ -152,7 +154,7 @@ public class CategoryRestServiceImpl implements CategoryRestService { |
152 | 154 | String attrId = String.valueOf(catAttr.getAttrId()); |
153 | 155 | AttributeOut attr = attributeRestService.findAttrAndValueById(attrId); |
154 | 156 | if (Tools.objectIsNotNull(attr)) { |
155 | - if (attr.getStatus() == AttributeOut.STATUS_NORMAL || attr.getStatus()==AttributeOut.STATUS_LOCK) { | |
157 | + if (attr.getStatus() == AttributeOut.STATUS_NORMAL || attr.getStatus() == AttributeOut.STATUS_LOCK) { | |
156 | 158 | if (Tools.objectIsNotNull(attr.getSaleType())) { |
157 | 159 | if (attr.getSaleType().equals(DESC_ATT_TYPE)) { |
158 | 160 | descAtt.add(attr); |
... | ... | @@ -207,6 +209,16 @@ public class CategoryRestServiceImpl implements CategoryRestService { |
207 | 209 | return categoryService.hasChildren(cid); |
208 | 210 | } |
209 | 211 | |
212 | + @Override | |
213 | + public Long addCategory(Category categoryOut) { | |
214 | + return categoryService.addCategory(categoryOut); | |
215 | + } | |
216 | + | |
217 | + @Override | |
218 | + public Boolean updateCategory(Category category) { | |
219 | + return categoryService.updateCategory(category); | |
220 | + } | |
221 | + | |
210 | 222 | public List<CategoryOut> listCategoriesInfo(List<Integer> cids) { |
211 | 223 | List<CategoryOut> categorise = new ArrayList<CategoryOut>(); |
212 | 224 | for (Integer cid : cids) { | ... | ... |
titan-api/src/main/java/com/diligrp/titan/ws/gq/impl/PreSaleRestServiceImpl.java
... | ... | @@ -145,9 +145,9 @@ public class PreSaleRestServiceImpl implements PresaleRestService { |
145 | 145 | if(!(cg.getActivate() == Category.SHOW_STATUS_ACTIVE) || !(cg.getStatus() == Category.STATUS_NORMAL)){ |
146 | 146 | return output.failure(TitanError.CATEGORY_STATE_ERROR); |
147 | 147 | } |
148 | - if(CollectionUtils.isNotEmpty(categoryRestService.listChildren(cg.getCid()))){ | |
149 | - return output.failure(TitanError.CATEGORY_HAS_CHILD); | |
150 | - } | |
148 | + //if(CollectionUtils.isNotEmpty(categoryRestService.listChildren(cg.getCid()))){ | |
149 | + // return output.failure(TitanError.CATEGORY_HAS_CHILD); | |
150 | + //} | |
151 | 151 | return output; |
152 | 152 | } |
153 | 153 | ... | ... |
titan-api/src/main/java/com/diligrp/titan/ws/gq/impl/PurchaseRestServiceImpl.java
... | ... | @@ -158,9 +158,9 @@ public class PurchaseRestServiceImpl implements PurchaseRestService { |
158 | 158 | if(!(cg.getActivate() == Category.SHOW_STATUS_ACTIVE) || !(cg.getStatus() == Category.STATUS_NORMAL)){ |
159 | 159 | return output.failure(TitanError.CATEGORY_STATE_ERROR); |
160 | 160 | } |
161 | - if(CollectionUtils.isNotEmpty(categoryRestService.listChildren(cg.getCid()))){ | |
162 | - return output.failure(TitanError.CATEGORY_HAS_CHILD); | |
163 | - } | |
161 | + //if(CollectionUtils.isNotEmpty(categoryRestService.listChildren(cg.getCid()))){ | |
162 | + // return output.failure(TitanError.CATEGORY_HAS_CHILD); | |
163 | + //} | |
164 | 164 | return output; |
165 | 165 | } |
166 | 166 | ... | ... |
titan-api/src/main/java/com/diligrp/titan/ws/gq/impl/SupplyRestServiceImpl.java
... | ... | @@ -158,9 +158,9 @@ public class SupplyRestServiceImpl implements SupplyRestService { |
158 | 158 | if(!(cg.getActivate() == Category.SHOW_STATUS_ACTIVE) || !(cg.getStatus() == Category.STATUS_NORMAL)){ |
159 | 159 | return output.failure(TitanError.CATEGORY_STATE_ERROR); |
160 | 160 | } |
161 | - if(CollectionUtils.isNotEmpty(categoryRestService.listChildren(cg.getCid()))){ | |
162 | - return output.failure(TitanError.CATEGORY_HAS_CHILD); | |
163 | - } | |
161 | + //if(CollectionUtils.isNotEmpty(categoryRestService.listChildren(cg.getCid()))){ | |
162 | + // return output.failure(TitanError.CATEGORY_HAS_CHILD); | |
163 | + //} | |
164 | 164 | return output; |
165 | 165 | } |
166 | 166 | ... | ... |
titan-api/src/main/resources/log4j.xml
... | ... | @@ -7,209 +7,9 @@ |
7 | 7 | </layout> |
8 | 8 | </appender> |
9 | 9 | |
10 | - <!--默认日志 --> | |
11 | - <appender name="FILE_ALL" class="org.apache.log4j.DailyRollingFileAppender"> | |
12 | - <param name="Encoding" value="UTF-8"/> | |
13 | - <param name="File" value="${dili_titan.log.path}/titan.api.1n4j.com/all.log"/> | |
14 | - <layout class="org.apache.log4j.PatternLayout"> | |
15 | - <param name="ConversionPattern" value="[%5p] [%d{yyyy-MM-dd HH:mm:ss SSS}] [%t] (%F:%L) %m%n"/> | |
16 | - </layout> | |
17 | - </appender> | |
18 | - | |
19 | - <category name="DEFALUT" additivity="false"> <!-- 自定义的日志分类,请根据实际情况调整 --> | |
20 | - <priority value="${dili_titan.log.level}"/> <!-- 根据实际情况修改日志级别,一般线上是INFO以上 --> | |
21 | - <appender-ref ref="${dili_titan.log.root.appender}"/> | |
22 | - </category> | |
23 | - | |
24 | - <!--商品日志 --> | |
25 | - <appender name="PRODUCT" class="org.apache.log4j.DailyRollingFileAppender"> | |
26 | - <param name="Encoding" value="UTF-8"/> | |
27 | - <param name="File" value="${dili_titan.log.path}/titan.api.1n4j.com/product.log"/> | |
28 | - <layout class="org.apache.log4j.PatternLayout"> | |
29 | - <param name="ConversionPattern" value="[%p] [%d] [%r] [%c] - %m %n"/> | |
30 | - </layout> | |
31 | - </appender> | |
32 | - | |
33 | - <category name="TITAN_PRODUCT" additivity="false"> <!-- 自定义的日志分类,请根据实际情况调整 --> | |
34 | - <priority value="${dili_titan.log.level}"/> <!-- 根据实际情况修改日志级别,一般线上是INFO以上 --> | |
35 | - <appender-ref ref="${dili_titan.log.root.appender}"/> <!-- 该appender需要在上线时删除,以免输出重复的日志到catalina.out文件 --> | |
36 | - <appender-ref ref="PRODUCT"/> | |
37 | - </category> | |
38 | - | |
39 | - <!--类目日志 --> | |
40 | - <appender name="CATEGORY" class="org.apache.log4j.DailyRollingFileAppender"> | |
41 | - <param name="Encoding" value="UTF-8"/> | |
42 | - <param name="File" value="${dili_titan.log.path}/titan.api.1n4j.com/category.log"/> | |
43 | - <layout class="org.apache.log4j.PatternLayout"> | |
44 | - <param name="ConversionPattern" value="[%p] [%d] [%r] [%c] - %m %n"/> | |
45 | - </layout> | |
46 | - </appender> | |
47 | - | |
48 | - <category name="TITAN_CATEGORY" additivity="false"> <!-- 自定义的日志分类,请根据实际情况调整 --> | |
49 | - <priority value="${dili_titan.log.level}"/> <!-- 根据实际情况修改日志级别,一般线上是INFO以上 --> | |
50 | - <appender-ref ref="${dili_titan.log.root.appender}"/> <!-- 该appender需要在上线时删除,以免输出重复的日志到catalina.out文件 --> | |
51 | - <appender-ref ref="CATEGORY"/> | |
52 | - </category> | |
53 | - | |
54 | - <!--属性日志 --> | |
55 | - <appender name="ATTRIBUTE" class="org.apache.log4j.DailyRollingFileAppender"> | |
56 | - <param name="Encoding" value="UTF-8"/> | |
57 | - <param name="File" value="${dili_titan.log.path}/titan.api.1n4j.com/attribute.log"/> | |
58 | - <layout class="org.apache.log4j.PatternLayout"> | |
59 | - <param name="ConversionPattern" value="[%p] [%d] [%r] [%c] - %m %n"/> | |
60 | - </layout> | |
61 | - </appender> | |
62 | - | |
63 | - <category name="TITAN_ATTRIBUTE" additivity="false"> <!-- 自定义的日志分类,请根据实际情况调整 --> | |
64 | - <priority value="${dili_titan.log.level}"/> <!-- 根据实际情况修改日志级别,一般线上是INFO以上 --> | |
65 | - <appender-ref ref="${dili_titan.log.root.appender}"/> <!-- 该appender需要在上线时删除,以免输出重复的日志到catalina.out文件 --> | |
66 | - <appender-ref ref="ATTRIBUTE"/> | |
67 | - </category> | |
68 | - | |
69 | - <!--评论日志 --> | |
70 | - <appender name="COMMENT" class="org.apache.log4j.DailyRollingFileAppender"> | |
71 | - <param name="Encoding" value="UTF-8"/> | |
72 | - <param name="File" value="${dili_titan.log.path}/titan.api.1n4j.com/comment.log"/> | |
73 | - <layout class="org.apache.log4j.PatternLayout"> | |
74 | - <param name="ConversionPattern" value="[%p] [%d] [%r] [%c] - %m %n"/> | |
75 | - </layout> | |
76 | - </appender> | |
77 | - | |
78 | - <category name="TITAN_COMMENT" additivity="false"> <!-- 自定义的日志分类,请根据实际情况调整 --> | |
79 | - <priority value="${dili_titan.log.level}"/> <!-- 根据实际情况修改日志级别,一般线上是INFO以上 --> | |
80 | - <appender-ref ref="${dili_titan.log.root.appender}"/> <!-- 该appender需要在上线时删除,以免输出重复的日志到catalina.out文件 --> | |
81 | - <appender-ref ref="COMMENT"/> | |
82 | - </category> | |
83 | - | |
84 | - <!--库存日志 --> | |
85 | - <appender name="STOCK" class="org.apache.log4j.DailyRollingFileAppender"> | |
86 | - <param name="Encoding" value="UTF-8"/> | |
87 | - <param name="File" value="${dili_titan.log.path}/titan.api.1n4j.com/stock.log"/> | |
88 | - <layout class="org.apache.log4j.PatternLayout"> | |
89 | - <param name="ConversionPattern" value="[%p] [%d] [%r] [%c] - %m %n"/> | |
90 | - </layout> | |
91 | - </appender> | |
92 | - | |
93 | - <category name="TITAN_STOCK" additivity="false"> <!-- 自定义的日志分类,请根据实际情况调整 --> | |
94 | - <priority value="${dili_titan.log.level}"/> <!-- 根据实际情况修改日志级别,一般线上是INFO以上 --> | |
95 | - <appender-ref ref="${dili_titan.log.root.appender}"/> <!-- 该appender需要在上线时删除,以免输出重复的日志到catalina.out文件 --> | |
96 | - <appender-ref ref="STOCK"/> | |
97 | - </category> | |
98 | - | |
99 | - <!--供应商商品日志 --> | |
100 | - <appender name="SUPPLIER" class="org.apache.log4j.DailyRollingFileAppender"> | |
101 | - <param name="Encoding" value="UTF-8"/> | |
102 | - <param name="File" value="${dili_titan.log.path}/titan.api.1n4j.com/product_tp.log"/> | |
103 | - <layout class="org.apache.log4j.PatternLayout"> | |
104 | - <param name="ConversionPattern" value="[%p] [%d] [%r] [%c] - %m %n"/> | |
105 | - </layout> | |
106 | - </appender> | |
107 | - | |
108 | - <category name="TITAN_SUPPLIER" additivity="false"> <!-- 自定义的日志分类,请根据实际情况调整 --> | |
109 | - <priority value="${dili_titan.log.level}"/> <!-- 根据实际情况修改日志级别,一般线上是INFO以上 --> | |
110 | - <appender-ref ref="${dili_titan.log.root.appender}"/> <!-- 该appender需要在上线时删除,以免输出重复的日志到catalina.out文件 --> | |
111 | - <appender-ref ref="SUPPLIER"/> | |
112 | - </category> | |
113 | - <!--商品认证日志 --> | |
114 | - <appender name="AUTH" class="org.apache.log4j.DailyRollingFileAppender"> | |
115 | - <param name="Encoding" value="UTF-8"/> | |
116 | - <param name="File" value="${dili_titan.log.path}/titan.api.1n4j.com/auth.log"/> | |
117 | - <layout class="org.apache.log4j.PatternLayout"> | |
118 | - <param name="ConversionPattern" value="[%p] [%d] [%r] [%c] - %m %n"/> | |
119 | - </layout> | |
120 | - </appender> | |
121 | - | |
122 | - <category name="TITAN_AUTH" additivity="false"> <!-- 自定义的日志分类,请根据实际情况调整 --> | |
123 | - <priority value="${dili_titan.log.level}"/> <!-- 根据实际情况修改日志级别,一般线上是INFO以上 --> | |
124 | - <appender-ref ref="${dili_titan.log.root.appender}"/> <!-- 该appender需要在上线时删除,以免输出重复的日志到catalina.out文件 --> | |
125 | - <appender-ref ref="AUTH"/> | |
126 | - </category> | |
127 | - | |
128 | - <!--供应信息日志 --> | |
129 | - <appender name="SUPPLY" class="org.apache.log4j.DailyRollingFileAppender"> | |
130 | - <param name="Encoding" value="UTF-8"/> | |
131 | - <param name="File" value="${dili_titan.log.path}/titan.api.1n4j.com/supply.log"/> | |
132 | - <layout class="org.apache.log4j.PatternLayout"> | |
133 | - <param name="ConversionPattern" value="[%p] [%d] [%r] [%c] - %m %n"/> | |
134 | - </layout> | |
135 | - </appender> | |
136 | - | |
137 | - <category name="TITAN_SUPPLY" additivity="false"> <!-- 自定义的日志分类,请根据实际情况调整 --> | |
138 | - <priority value="${dili_titan.log.level}"/> <!-- 根据实际情况修改日志级别,一般线上是INFO以上 --> | |
139 | - <appender-ref ref="${dili_titan.log.root.appender}"/> <!-- 该appender需要在上线时删除,以免输出重复的日志到catalina.out文件 --> | |
140 | - <appender-ref ref="SUPPLY"/> | |
141 | - </category> | |
142 | - | |
143 | - <!--求购信息日志 --> | |
144 | - <appender name="PURCHASE" class="org.apache.log4j.DailyRollingFileAppender"> | |
145 | - <param name="Encoding" value="UTF-8"/> | |
146 | - <param name="File" value="${dili_titan.log.path}/titan.api.1n4j.com/purchase.log"/> | |
147 | - <layout class="org.apache.log4j.PatternLayout"> | |
148 | - <param name="ConversionPattern" value="[%p] [%d] [%r] [%c] - %m %n"/> | |
149 | - </layout> | |
150 | - </appender> | |
151 | - | |
152 | - <category name="TITAN_PURCHASE" additivity="false"> <!-- 自定义的日志分类,请根据实际情况调整 --> | |
153 | - <priority value="${dili_titan.log.level}"/> <!-- 根据实际情况修改日志级别,一般线上是INFO以上 --> | |
154 | - <appender-ref ref="${dili_titan.log.root.appender}"/> <!-- 该appender需要在上线时删除,以免输出重复的日志到catalina.out文件 --> | |
155 | - <appender-ref ref="PURCHASE"/> | |
156 | - </category> | |
157 | - | |
158 | - <!--预售信息日志 --> | |
159 | - <appender name="PRESALE" class="org.apache.log4j.DailyRollingFileAppender"> | |
160 | - <param name="Encoding" value="UTF-8"/> | |
161 | - <param name="File" value="${dili_titan.log.path}/titan.api.1n4j.com/presale.log"/> | |
162 | - <layout class="org.apache.log4j.PatternLayout"> | |
163 | - <param name="ConversionPattern" value="[%p] [%d] [%r] [%c] - %m %n"/> | |
164 | - </layout> | |
165 | - </appender> | |
166 | - | |
167 | - <category name="TITAN_PRESALE" additivity="false"> <!-- 自定义的日志分类,请根据实际情况调整 --> | |
168 | - <priority value="${dili_titan.log.level}"/> <!-- 根据实际情况修改日志级别,一般线上是INFO以上 --> | |
169 | - <appender-ref ref="${dili_titan.log.root.appender}"/> <!-- 该appender需要在上线时删除,以免输出重复的日志到catalina.out文件 --> | |
170 | - <appender-ref ref="PRESALE"/> | |
171 | - </category> | |
172 | - | |
173 | - <!--指数类目日志 --> | |
174 | - <appender name="INDEXCATEGORY" class="org.apache.log4j.DailyRollingFileAppender"> | |
175 | - <param name="Encoding" value="UTF-8"/> | |
176 | - <param name="File" value="${dili_titan.log.path}/titan.api.1n4j.com/index_category.log"/> | |
177 | - <layout class="org.apache.log4j.PatternLayout"> | |
178 | - <param name="ConversionPattern" value="[%p] [%d] [%r] [%c] - %m %n"/> | |
179 | - </layout> | |
180 | - </appender> | |
181 | - | |
182 | - <category name="INDEX_CATEGORY" additivity="false"> <!-- 自定义的日志分类,请根据实际情况调整 --> | |
183 | - <priority value="${dili_titan.log.level}"/> <!-- 根据实际情况修改日志级别,一般线上是INFO以上 --> | |
184 | - <appender-ref ref="${dili_titan.log.root.appender}"/> <!-- 该appender需要在上线时删除,以免输出重复的日志到catalina.out文件 --> | |
185 | - <appender-ref ref="INDEXCATEGORY"/> | |
186 | - </category> | |
187 | - | |
188 | - <!--运行时异常 --> | |
189 | - <appender name="EXCEPTION" class="org.apache.log4j.DailyRollingFileAppender"> | |
190 | - <param name="Encoding" value="UTF-8"/> | |
191 | - <param name="File" value="${dili_titan.log.path}/titan.api.1n4j.com/exception.log"/> | |
192 | - <layout class="org.apache.log4j.PatternLayout"> | |
193 | - <param name="ConversionPattern" value="[%p] [%d] [%r] [%c] - %m %n"/> | |
194 | - </layout> | |
195 | - </appender> | |
196 | - | |
197 | - <category name="EXCEPTION" additivity="false"> <!-- 自定义的日志分类,请根据实际情况调整 --> | |
198 | - <priority value="${dili_titan.log.level}"/> <!-- 根据实际情况修改日志级别,一般线上是INFO以上 --> | |
199 | - <appender-ref ref="${dili_titan.log.root.appender}"/> <!-- 该appender需要在上线时删除,以免输出重复的日志到catalina.out文件 --> | |
200 | - <appender-ref ref="EXCEPTION"/> | |
201 | - </category> | |
202 | - | |
203 | - <category name="com.dili" additivity="false"> <!-- 自定义的日志分类,请根据实际情况调整 --> | |
204 | - <priority value="${dili_titan.log.level}"/> <!-- 根据实际情况修改日志级别,一般线上是INFO以上 --> | |
205 | - <appender-ref ref="${dili_titan.log.root.appender}"/> <!-- 该appender需要在上线时删除,以免输出重复的日志到catalina.out文件 --> | |
206 | - </category> | |
207 | - | |
208 | - | |
209 | - | |
210 | 10 | <root> |
211 | - <priority value="${dili_titan.log.level}"/> <!-- 根据实际情况修改日志级别,一般线上是INFO以上 --> | |
212 | - <appender-ref ref="${dili_titan.log.root.appender}"/> <!-- 该appender需要在上线时删除,以免输出重复的日志到catalina.out文件 --> | |
11 | + <priority value="debug"/> <!-- 根据实际情况修改日志级别,一般线上是INFO以上 --> | |
12 | + <appender-ref ref="CONSOLE"/> <!-- 该appender需要在上线时删除,以免输出重复的日志到catalina.out文件 --> | |
213 | 13 | <!--<appender-ref ref="FILE"/>--> |
214 | 14 | </root> |
215 | 15 | </log4j:configuration> |
216 | 16 | \ No newline at end of file | ... | ... |
titan-api/src/main/resources/spring-config-dao.xml
... | ... | @@ -10,7 +10,7 @@ |
10 | 10 | http://www.springframework.org/schema/aop/spring-aop.xsd" |
11 | 11 | default-autowire="byName"> |
12 | 12 | |
13 | - <context:component-scan base-package="com.dili.titan.dao" /> | |
13 | + <context:component-scan base-package="com.diligrp.titan.dao" /> | |
14 | 14 | |
15 | 15 | <bean id="baseDataSource" class="com.alibaba.druid.pool.DruidDataSource"> |
16 | 16 | <property name="filters" value="stat"/> | ... | ... |
titan-api/src/main/resources/spring-config-mq.xml
... | ... | @@ -6,7 +6,7 @@ |
6 | 6 | http://www.springframework.org/schema/context |
7 | 7 | http://www.springframework.org/schema/context/spring-context-3.2.xsd"> |
8 | 8 | |
9 | - <context:component-scan base-package="com.dili.titan.mq" /> | |
9 | + <context:component-scan base-package="com.diligrp.titan.mq" /> | |
10 | 10 | <bean id="diliMQProducer" |
11 | 11 | class="com.diligrp.util.rocketMQUtil.impl.DiliMQProducerImpl"/> |
12 | 12 | <bean id="messageProducerClient" class="com.diligrp.messageCenter.sdk.MessageProducerClient"> | ... | ... |
titan-api/src/main/resources/spring-config-redis.xml
... | ... | @@ -7,7 +7,7 @@ |
7 | 7 | http://www.springframework.org/schema/context/spring-context.xsd" |
8 | 8 | default-autowire="byName"> |
9 | 9 | |
10 | - <context:component-scan base-package="com.dili.titan.redis" /> | |
10 | + | |
11 | 11 | |
12 | 12 | <bean id="jedisPoolConfig" class="redis.clients.jedis.JedisPoolConfig"> |
13 | 13 | <property name="maxIdle" value="6"></property> | ... | ... |
titan-api/src/main/resources/spring-config-service.xml
... | ... | @@ -11,9 +11,9 @@ |
11 | 11 | http://www.springframework.org/schema/tx/spring-tx.xsd" |
12 | 12 | default-autowire="byName"> |
13 | 13 | |
14 | - <context:component-scan base-package="com.dili.titan.service"/> | |
15 | - <context:component-scan base-package="com.dili.titan.ws"/> | |
16 | - <context:component-scan base-package="com.dili.titan.rpc"/> | |
14 | + <context:component-scan base-package="com.diligrp.titan.service"/> | |
15 | + <context:component-scan base-package="com.diligrp.titan.ws"/> | |
16 | + <context:component-scan base-package="com.diligrp.titan.rpc"/> | |
17 | 17 | <!-- 启用对事务的注解支持 --> |
18 | 18 | <tx:annotation-driven transaction-manager="transactionManager" proxy-target-class="true"/> |
19 | 19 | </beans> |
20 | 20 | \ No newline at end of file | ... | ... |
titan-api/src/main/resources/spring-config-servlet.xml
... | ... | @@ -9,7 +9,7 @@ |
9 | 9 | default-autowire="byName"> |
10 | 10 | |
11 | 11 | <!-- mvc controller --> |
12 | - <context:component-scan base-package="com.dili.titan.web.ws" /> | |
12 | + <context:component-scan base-package="com.diligrp.titan.web.ws" /> | |
13 | 13 | <!--<aop:aspectj-autoproxy proxy-target-class="true" />--> |
14 | 14 | <context:annotation-config /> |
15 | 15 | ... | ... |
titan-api/src/main/resources/sqlmap/Attribute.xml
100755 → 100644
titan-api/src/main/resources/sqlmap/AttributeValue.xml
100755 → 100644
titan-api/src/main/resources/sqlmap/Auth.xml
100755 → 100644
titan-api/src/main/resources/sqlmap/AuthScope.xml
100755 → 100644
titan-api/src/main/resources/sqlmap/Category.xml
100755 → 100644
1 | 1 | <?xml version="1.0" encoding="UTF-8" ?> |
2 | 2 | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
3 | 3 | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
4 | -<mapper namespace="com.diligrp.titan.dao.category.CategoryDao"> | |
4 | +<mapper namespace="CategoryDao"> | |
5 | 5 | |
6 | 6 | <!-- category 所有查询列 --> |
7 | 7 | <sql id="QUERY_COLUMN_LIST"> |
8 | - <![CDATA[id,name,jp,parent,template,icon,deal_type AS dealType,status,activate, `order`]]> | |
8 | + <![CDATA[id,name,jp,parent,template,icon,deal_type AS dealType,status,activate, `order`, note,product_img as productImg, shop_id as shopId]]> | |
9 | 9 | </sql> |
10 | 10 | |
11 | 11 | <!-- category 查询列来源表--> |
... | ... | @@ -23,7 +23,7 @@ |
23 | 23 | <if test="order != null and order != ''"><![CDATA[AND `order` = #{order}]]></if> |
24 | 24 | </where> |
25 | 25 | </sql> |
26 | - | |
26 | + | |
27 | 27 | <!-- 智能排序与分页 --> |
28 | 28 | <sql id="QUERY_ORDER_LIMIT_CONDTION"> |
29 | 29 | <if test="orderField != null and orderField != '' and orderFieldType != null and orderFieldType != ''"><![CDATA[ORDER BY ${orderField} ${orderFieldType}]]></if> |
... | ... | @@ -45,8 +45,8 @@ |
45 | 45 | <!-- 插入category记录 --> |
46 | 46 | <insert id="insertEntry" parameterType="category" > |
47 | 47 | <![CDATA[ |
48 | - INSERT INTO category (id,name,jp,parent,icon,template,status,activate, `order`,ctime) | |
49 | - VALUES (#{id},#{name},#{parent},#{icon},#{template},#{status},#{activate}, #{order} ,now()) | |
48 | + INSERT INTO category (id,name,parent,icon,template,status,activate, `order`,ctime,shop_id,deal_type) | |
49 | + VALUES (#{id},#{name},#{parent},#{icon},#{template},#{status},#{activate}, #{order} ,now(),#{shopId},#{dealType}) | |
50 | 50 | ]]> |
51 | 51 | </insert> |
52 | 52 | ... | ... |
titan-api/src/main/resources/sqlmap/CategoryAttr.xml
100755 → 100644
titan-api/src/main/resources/sqlmap/CategorySearchAttr.xml
100755 → 100644
titan-api/src/main/resources/sqlmap/IndexCategory.xml
100755 → 100644
titan-api/src/main/resources/sqlmap/ProductAuth.xml
100755 → 100644
titan-api/src/main/resources/sqlmap/ProductComment.xml
100755 → 100644
titan-api/src/main/resources/sqlmap/ProductImg.xml
100755 → 100644
titan-api/src/main/resources/sqlmap/ProductPopGroupBuying.xml
100755 → 100644
titan-api/src/main/resources/sqlmap/ProductSample.xml
100755 → 100644
titan-api/src/main/resources/sqlmap/ProductSearchSort.xml
100755 → 100644
1 | 1 | <?xml version="1.0" encoding="UTF-8" ?> |
2 | 2 | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
3 | 3 | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
4 | -<mapper namespace="com.dili.titan.dao.ProductSearchSortDao"> | |
4 | +<mapper namespace="com.diligrp.titan.dao.ProductSearchSortDao"> | |
5 | 5 | |
6 | 6 | <!-- product_search_sort 所有查询列 --> |
7 | 7 | <sql id="QUERY_COLUMN_LIST"> | ... | ... |
titan-api/src/main/resources/sqlmap/ProductVideo.xml
100755 → 100644
1 | 1 | <?xml version="1.0" encoding="UTF-8" ?> |
2 | 2 | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
3 | 3 | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
4 | -<mapper namespace="com.dili.titan.dao.ProductVideoDao"> | |
4 | +<mapper namespace="com.diligrp.titan.dao.ProductVideoDao"> | |
5 | 5 | |
6 | 6 | <!-- product_video 所有查询列 --> |
7 | 7 | <sql id="QUERY_COLUMN_LIST"> | ... | ... |
titan-api/src/main/resources/sqlmap/SnapshotSku.xml
100755 → 100644
titan-api/src/main/resources/sqlmap/Stock.xml
100755 → 100644
titan-api/src/main/resources/sqlmap/TitanSequence.xml
100755 → 100644
titan-api/src/main/resources/sqlmap/Video.xml
100755 → 100644
titan-api/src/main/resources/sqlmap/gq/Presale.xml
100755 → 100644
1 | 1 | <?xml version="1.0" encoding="UTF-8" ?> |
2 | 2 | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
3 | 3 | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
4 | -<mapper namespace="com.dili.titan.dao.PresaleDao"> | |
4 | +<mapper namespace="com.diligrp.titan.dao.PresaleDao"> | |
5 | 5 | |
6 | 6 | <!-- presale 所有查询列 --> |
7 | 7 | <sql id="QUERY_COLUMN_LIST"> | ... | ... |
titan-api/src/main/resources/sqlmap/gq/Purchase.xml
100755 → 100644
1 | 1 | <?xml version="1.0" encoding="UTF-8" ?> |
2 | 2 | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
3 | 3 | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
4 | -<mapper namespace="com.dili.titan.dao.PurchaseDao"> | |
4 | +<mapper namespace="com.diligrp.titan.dao.PurchaseDao"> | |
5 | 5 | |
6 | 6 | <!-- purchase 所有查询列 --> |
7 | 7 | <sql id="QUERY_COLUMN_LIST"> | ... | ... |
titan-api/src/main/resources/sqlmap/gq/Supply.xml
100755 → 100644
1 | 1 | <?xml version="1.0" encoding="UTF-8" ?> |
2 | 2 | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
3 | 3 | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
4 | -<mapper namespace="com.dili.titan.dao.SupplyDao"> | |
4 | +<mapper namespace="com.diligrp.titan.dao.SupplyDao"> | |
5 | 5 | |
6 | 6 | <!-- supply 所有查询列 --> |
7 | 7 | <sql id="QUERY_COLUMN_LIST"> | ... | ... |
titan-api/src/main/resources/sqlmap/pop/ProductPop.xml
100755 → 100644
titan-api/src/main/resources/sqlmap/pop/ProductPopAttr.xml
100755 → 100644
titan-api/src/main/resources/sqlmap/pop/ProductPopAttrValue.xml
100755 → 100644
titan-api/src/main/resources/sqlmap/pop/ProductPopAudit.xml
100755 → 100644
titan-api/src/main/resources/sqlmap/pop/ProductPopPriceRange.xml
100755 → 100644
titan-api/src/main/resources/sqlmap/pop/ProductSkuPop.xml
100755 → 100644
titan-cache/src/main/resources/sqlmap/Attribute.xml renamed to titan-cache/src/main/resources/com/diligrp/titan/dao/sqlmap/Attribute.xml
titan-cache/src/main/resources/sqlmap/Category.xml renamed to titan-cache/src/main/resources/com/diligrp/titan/dao/sqlmap/Category.xml
titan-cache/src/main/resources/sqlmap/ProductImg.xml renamed to titan-cache/src/main/resources/com/diligrp/titan/dao/sqlmap/ProductImg.xml
titan-cache/src/main/resources/sqlmap/ProductPop.xml renamed to titan-cache/src/main/resources/com/diligrp/titan/dao/sqlmap/ProductPop.xml
titan-cache/src/main/resources/sqlmap/gq/Presale.xml renamed to titan-cache/src/main/resources/com/diligrp/titan/dao/sqlmap/gq/Presale.xml
titan-cache/src/main/resources/sqlmap/gq/Purchase.xml renamed to titan-cache/src/main/resources/com/diligrp/titan/dao/sqlmap/gq/Purchase.xml
titan-cache/src/main/resources/sqlmap/gq/Supply.xml renamed to titan-cache/src/main/resources/com/diligrp/titan/dao/sqlmap/gq/Supply.xml
titan-cache/src/main/resources/sqlmap/sqlmap-config.xml renamed to titan-cache/src/main/resources/com/diligrp/titan/dao/sqlmap/sqlmap-config.xml
... | ... | @@ -25,14 +25,14 @@ |
25 | 25 | </typeAliases> |
26 | 26 | |
27 | 27 | <mappers> |
28 | - <mapper resource="sqlmap/Attribute.xml" /> | |
29 | - <mapper resource="sqlmap/Category.xml" /> | |
28 | + <mapper resource="com.diligrp.titan.dao.sqlmap/Attribute.xml" /> | |
29 | + <mapper resource="com.diligrp.titan.dao.sqlmap/Category.xml" /> | |
30 | 30 | <!--供求需求--> |
31 | - <mapper resource="sqlmap/gq/Purchase.xml"/> | |
32 | - <mapper resource="sqlmap/gq/Presale.xml"/> | |
33 | - <mapper resource="sqlmap/gq/Supply.xml"/> | |
34 | - <mapper resource="sqlmap/ProductImg.xml" /> | |
35 | - <mapper resource="sqlmap/ProductPop.xml" /> | |
31 | + <mapper resource="com.diligrp.titan.dao.sqlmap/gq/Purchase.xml"/> | |
32 | + <mapper resource="com.diligrp.titan.dao.sqlmap/gq/Presale.xml"/> | |
33 | + <mapper resource="com.diligrp.titan.dao.sqlmap/gq/Supply.xml"/> | |
34 | + <mapper resource="com.diligrp.titan.dao.sqlmap/ProductImg.xml" /> | |
35 | + <mapper resource="com.diligrp.titan.dao.sqlmap/ProductPop.xml" /> | |
36 | 36 | </mappers> |
37 | 37 | |
38 | 38 | </configuration> |
39 | 39 | \ No newline at end of file | ... | ... |
titan-cache/src/main/resources/spring-config-dao.xml
... | ... | @@ -53,7 +53,7 @@ |
53 | 53 | |
54 | 54 | <bean id="sessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean"> |
55 | 55 | <property name="dataSource" ref="masterDataSource" /> |
56 | - <property name="configLocation" value="classpath:sqlmap/sqlmap-config.xml" /> | |
56 | + <property name="configLocation" value="classpath:com.diligrp.titan.dao.sqlmap/com.diligrp.titan.dao.sqlmap-config.xml" /> | |
57 | 57 | </bean> |
58 | 58 | |
59 | 59 | <bean id="sqlTemplate" class="org.mybatis.spring.SqlSessionTemplate"> | ... | ... |
titan-sdk/src/main/java/com/diligrp/titan/sdk/domain/Category.java
... | ... | @@ -51,6 +51,36 @@ public class Category { |
51 | 51 | */ |
52 | 52 | private String cname; |
53 | 53 | |
54 | + private String note; | |
55 | + | |
56 | + private String productImg; | |
57 | + | |
58 | + private Long shopId; | |
59 | + | |
60 | + public String getNote() { | |
61 | + return note; | |
62 | + } | |
63 | + | |
64 | + public void setNote(String note) { | |
65 | + this.note = note; | |
66 | + } | |
67 | + | |
68 | + public String getProductImg() { | |
69 | + return productImg; | |
70 | + } | |
71 | + | |
72 | + public void setProductImg(String productImg) { | |
73 | + this.productImg = productImg; | |
74 | + } | |
75 | + | |
76 | + public Long getShopId() { | |
77 | + return shopId; | |
78 | + } | |
79 | + | |
80 | + public void setShopId(Long shopId) { | |
81 | + this.shopId = shopId; | |
82 | + } | |
83 | + | |
54 | 84 | /** |
55 | 85 | * 类目简拼 |
56 | 86 | */ | ... | ... |
titan-sdk/src/main/java/com/diligrp/titan/sdk/input/CategoryInput.java
0 → 100644
1 | +package com.diligrp.titan.sdk.input; | |
2 | + | |
3 | +/** | |
4 | + * Created by yanggang on 2016/12/7. | |
5 | + */ | |
6 | +public class CategoryInput { | |
7 | + | |
8 | + private String name; | |
9 | + private Integer parent; | |
10 | + private Integer shopId; | |
11 | + private Long id; | |
12 | + | |
13 | + public Long getId() { | |
14 | + return id; | |
15 | + } | |
16 | + | |
17 | + public void setId(Long id) { | |
18 | + this.id = id; | |
19 | + } | |
20 | + | |
21 | + public String getName() { | |
22 | + return name; | |
23 | + } | |
24 | + | |
25 | + public void setName(String name) { | |
26 | + this.name = name; | |
27 | + } | |
28 | + | |
29 | + public Integer getParent() { | |
30 | + return parent; | |
31 | + } | |
32 | + | |
33 | + public void setParent(Integer parent) { | |
34 | + this.parent = parent; | |
35 | + } | |
36 | + | |
37 | + public Integer getShopId() { | |
38 | + return shopId; | |
39 | + } | |
40 | + | |
41 | + public void setShopId(Integer shopId) { | |
42 | + this.shopId = shopId; | |
43 | + } | |
44 | +} | ... | ... |
titan-sdk/src/main/java/com/diligrp/titan/sdk/service/CategoryService.java
... | ... | @@ -2,6 +2,7 @@ package com.diligrp.titan.sdk.service; |
2 | 2 | |
3 | 3 | import com.diligrp.titan.sdk.domain.Attribute; |
4 | 4 | import com.diligrp.titan.sdk.domain.Category; |
5 | +import com.diligrp.titan.sdk.input.CategoryInput; | |
5 | 6 | import com.diligrp.titan.sdk.output.BaseOutput; |
6 | 7 | |
7 | 8 | import java.util.HashMap; |
... | ... | @@ -23,7 +24,7 @@ public interface CategoryService { |
23 | 24 | * @param cid 父类目id,0表示根节点 |
24 | 25 | * @return {@link Category} |
25 | 26 | */ |
26 | - public BaseOutput<List<Category>> listAll(int cid); | |
27 | + public BaseOutput<List<Category>> listAll(int cid,int shopId); | |
27 | 28 | |
28 | 29 | /** |
29 | 30 | * 获取类目的面包屑 |
... | ... | @@ -37,7 +38,9 @@ public interface CategoryService { |
37 | 38 | * @param cid 父类目id,0表示根节点 |
38 | 39 | * @return {@link Category} |
39 | 40 | */ |
40 | - public BaseOutput<List<Category>> listChildren(int cid); | |
41 | + public BaseOutput<List<Category>> listChildren(int cid,int shopId); | |
42 | + | |
43 | + public BaseOutput<Object> addCategory(Category category); | |
41 | 44 | |
42 | 45 | /** |
43 | 46 | * 获取类目的属性 |
... | ... | @@ -81,4 +84,8 @@ public interface CategoryService { |
81 | 84 | * @author yangjianjun |
82 | 85 | */ |
83 | 86 | public BaseOutput<List<Category>> searchCategoryInfo(String cname); |
87 | + | |
88 | + BaseOutput<Object> insertCategory(CategoryInput categoryInput); | |
89 | + | |
90 | + BaseOutput<Object> updateCategory(CategoryInput categoryInput); | |
84 | 91 | } | ... | ... |
titan-sdk/src/main/java/com/diligrp/titan/sdk/service/impl/CategoryServiceImpl.java
... | ... | @@ -3,6 +3,7 @@ package com.diligrp.titan.sdk.service.impl; |
3 | 3 | import com.alibaba.fastjson.TypeReference; |
4 | 4 | import com.diligrp.titan.sdk.domain.Attribute; |
5 | 5 | import com.diligrp.titan.sdk.domain.Category; |
6 | +import com.diligrp.titan.sdk.input.CategoryInput; | |
6 | 7 | import com.diligrp.titan.sdk.output.BaseOutput; |
7 | 8 | import com.diligrp.titan.sdk.service.CategoryService; |
8 | 9 | import com.diligrp.titan.sdk.service.ServiceExcutor; |
... | ... | @@ -13,53 +14,63 @@ import java.util.Map; |
13 | 14 | |
14 | 15 | public class CategoryServiceImpl extends ServiceExcutor implements CategoryService { |
15 | 16 | |
16 | - public CategoryServiceImpl(String accesskey, String secretkey) { | |
17 | - super(accesskey, secretkey); | |
18 | - } | |
17 | + public CategoryServiceImpl(String accesskey, String secretkey) { | |
18 | + super(accesskey, secretkey); | |
19 | + } | |
19 | 20 | |
20 | - public CategoryServiceImpl(String accesskey, String secretkey,int timeOut) { | |
21 | - super(accesskey, secretkey,timeOut); | |
21 | + public CategoryServiceImpl(String accesskey, String secretkey, int timeOut) { | |
22 | + super(accesskey, secretkey, timeOut); | |
22 | 23 | } |
23 | 24 | |
24 | - @Override | |
25 | - public BaseOutput<List<Category>> listAll(int cid) { | |
26 | - BaseOutput<List<Category>> output = new BaseOutput<List<Category>>(); | |
27 | - Map<String, Integer> params = new HashMap<String, Integer>(); | |
28 | - params.put("cid", cid); | |
29 | - output = execute("/category/listAll", params, output, new TypeReference<BaseOutput<List<Category>>>() { | |
30 | - }); | |
31 | - return output; | |
32 | - } | |
33 | - | |
34 | - @Override | |
35 | - public BaseOutput<List<Category>> listCrumbs(int cid) { | |
36 | - BaseOutput<List<Category>> outPut = new BaseOutput<List<Category>>(); | |
37 | - Map<String, Integer> params = new HashMap<String, Integer>(); | |
38 | - params.put("cid", cid); | |
39 | - outPut = execute("/category/listCrumbs", params, outPut, new TypeReference<BaseOutput<List<Category>>>() { | |
40 | - }); | |
41 | - return outPut; | |
42 | - } | |
43 | - | |
44 | - @Override | |
45 | - public BaseOutput<List<Category>> listChildren(int cid) { | |
46 | - BaseOutput<List<Category>> output = new BaseOutput<List<Category>>(); | |
47 | - Map<String, Integer> params = new HashMap<String, Integer>(); | |
48 | - params.put("cid", cid); | |
49 | - output = execute("/category/listChildren", params, output, new TypeReference<BaseOutput<List<Category>>>() { | |
50 | - }); | |
51 | - return output; | |
52 | - } | |
53 | - | |
54 | - @Override | |
55 | - public BaseOutput<HashMap<String, List<Attribute>>> listAttributes(int cid) { | |
56 | - BaseOutput<HashMap<String, List<Attribute>>> output = new BaseOutput<HashMap<String, List<Attribute>>>(); | |
57 | - Map<String, Integer> params = new HashMap<String, Integer>(); | |
58 | - params.put("cid", cid); | |
59 | - output = execute("/category/attributes", params, output, new TypeReference<BaseOutput<HashMap<String, List<Attribute>>>>() { | |
60 | - }); | |
61 | - return output; | |
62 | - } | |
25 | + @Override | |
26 | + public BaseOutput<List<Category>> listAll(int cid, int shopId) { | |
27 | + BaseOutput<List<Category>> output = new BaseOutput<List<Category>>(); | |
28 | + Map<String, Integer> params = new HashMap<String, Integer>(); | |
29 | + params.put("cid", cid); | |
30 | + params.put("shopId", shopId); | |
31 | + output = execute("/category/listAll", params, output, new TypeReference<BaseOutput<List<Category>>>() { | |
32 | + }); | |
33 | + return output; | |
34 | + } | |
35 | + | |
36 | + @Override | |
37 | + public BaseOutput<List<Category>> listCrumbs(int cid) { | |
38 | + BaseOutput<List<Category>> outPut = new BaseOutput<List<Category>>(); | |
39 | + Map<String, Integer> params = new HashMap<String, Integer>(); | |
40 | + params.put("cid", cid); | |
41 | + outPut = execute("/category/listCrumbs", params, outPut, new TypeReference<BaseOutput<List<Category>>>() { | |
42 | + }); | |
43 | + return outPut; | |
44 | + } | |
45 | + | |
46 | + @Override | |
47 | + public BaseOutput<List<Category>> listChildren(int cid, int shopId) { | |
48 | + BaseOutput<List<Category>> output = new BaseOutput<List<Category>>(); | |
49 | + Map<String, Integer> params = new HashMap<String, Integer>(); | |
50 | + params.put("cid", cid); | |
51 | + params.put("shopId", shopId); | |
52 | + output = execute("/category/listChildren", params, output, new TypeReference<BaseOutput<List<Category>>>() { | |
53 | + }); | |
54 | + return output; | |
55 | + } | |
56 | + | |
57 | + @Override | |
58 | + public BaseOutput<Object> addCategory(Category category) { | |
59 | + BaseOutput<Object> output = new BaseOutput<Object>(); | |
60 | + output = execute("/category/insertCategory", category, output, new TypeReference<BaseOutput<Object>>() { | |
61 | + }); | |
62 | + return output; | |
63 | + } | |
64 | + | |
65 | + @Override | |
66 | + public BaseOutput<HashMap<String, List<Attribute>>> listAttributes(int cid) { | |
67 | + BaseOutput<HashMap<String, List<Attribute>>> output = new BaseOutput<HashMap<String, List<Attribute>>>(); | |
68 | + Map<String, Integer> params = new HashMap<String, Integer>(); | |
69 | + params.put("cid", cid); | |
70 | + output = execute("/category/attributes", params, output, new TypeReference<BaseOutput<HashMap<String, List<Attribute>>>>() { | |
71 | + }); | |
72 | + return output; | |
73 | + } | |
63 | 74 | |
64 | 75 | @Override |
65 | 76 | public BaseOutput<HashMap<String, List<Attribute>>> listAttributes(int cid, boolean includeDel) { |
... | ... | @@ -73,32 +84,48 @@ public class CategoryServiceImpl extends ServiceExcutor implements CategoryServi |
73 | 84 | } |
74 | 85 | |
75 | 86 | @Override |
76 | - public BaseOutput<List<Category>> listCategoriesInfo(List<Integer> cids) { | |
77 | - BaseOutput<List<Category>> outPut = new BaseOutput<List<Category>>(); | |
78 | - Map<String, List<Integer>> params = new HashMap<String, List<Integer>>(); | |
79 | - params.put("cids", cids); | |
80 | - outPut = execute("/category/listCategoriesInfo", params, outPut, new TypeReference<BaseOutput<List<Category>>>() { | |
87 | + public BaseOutput<List<Category>> listCategoriesInfo(List<Integer> cids) { | |
88 | + BaseOutput<List<Category>> outPut = new BaseOutput<List<Category>>(); | |
89 | + Map<String, List<Integer>> params = new HashMap<String, List<Integer>>(); | |
90 | + params.put("cids", cids); | |
91 | + outPut = execute("/category/listCategoriesInfo", params, outPut, new TypeReference<BaseOutput<List<Category>>>() { | |
92 | + }); | |
93 | + return outPut; | |
94 | + } | |
95 | + | |
96 | + @Override | |
97 | + public BaseOutput<Category> getCategoryInfo(int cid) { | |
98 | + BaseOutput<Category> outPut = new BaseOutput<Category>(); | |
99 | + Map<String, Integer> params = new HashMap<String, Integer>(); | |
100 | + params.put("cid", cid); | |
101 | + outPut = execute("/category/getCategoryInfo", params, outPut, new TypeReference<BaseOutput<Category>>() { | |
102 | + }); | |
103 | + return outPut; | |
104 | + } | |
105 | + | |
106 | + @Override | |
107 | + public BaseOutput<List<Category>> searchCategoryInfo(String cname) { | |
108 | + BaseOutput<List<Category>> output = new BaseOutput<List<Category>>(); | |
109 | + Map<String, String> params = new HashMap<String, String>(); | |
110 | + params.put("cname", cname); | |
111 | + output = execute("/category/searchCategoryInfo", params, output, new TypeReference<BaseOutput<List<Category>>>() { | |
112 | + }); | |
113 | + return output; | |
114 | + } | |
115 | + | |
116 | + @Override | |
117 | + public BaseOutput<Object> insertCategory(CategoryInput categoryInput) { | |
118 | + BaseOutput<Object> output = new BaseOutput<Object>(); | |
119 | + output = execute("/category/insertCategory", categoryInput, output, new TypeReference<BaseOutput<Object>>() { | |
81 | 120 | }); |
82 | - return outPut; | |
83 | - } | |
84 | - | |
85 | - @Override | |
86 | - public BaseOutput<Category> getCategoryInfo(int cid) { | |
87 | - BaseOutput<Category> outPut = new BaseOutput<Category>(); | |
88 | - Map<String, Integer> params = new HashMap<String, Integer>(); | |
89 | - params.put("cid", cid); | |
90 | - outPut = execute("/category/getCategoryInfo", params, outPut, new TypeReference<BaseOutput<Category>>() { | |
121 | + return output; | |
122 | + } | |
123 | + | |
124 | + @Override | |
125 | + public BaseOutput<Object> updateCategory(CategoryInput categoryInput) { | |
126 | + BaseOutput<Object> output = new BaseOutput<Object>(); | |
127 | + output = execute("/category/updateCategory", categoryInput, output, new TypeReference<BaseOutput<Object>>() { | |
91 | 128 | }); |
92 | - return outPut; | |
93 | - } | |
94 | - | |
95 | - @Override | |
96 | - public BaseOutput<List<Category>> searchCategoryInfo(String cname) { | |
97 | - BaseOutput<List<Category>> output = new BaseOutput<List<Category>>(); | |
98 | - Map<String, String> params = new HashMap<String, String>(); | |
99 | - params.put("cname", cname); | |
100 | - output = execute("/category/searchCategoryInfo", params, output, new TypeReference<BaseOutput<List<Category>>>() { | |
101 | - }); | |
102 | - return output; | |
103 | - } | |
129 | + return output; | |
130 | + } | |
104 | 131 | } | ... | ... |
titan-sdk/src/test/java/com/diligrp/titan/sdk/TestCategoryService.java
... | ... | @@ -3,6 +3,7 @@ package com.diligrp.titan.sdk; |
3 | 3 | import com.alibaba.fastjson.JSON; |
4 | 4 | import com.diligrp.titan.sdk.domain.Attribute; |
5 | 5 | import com.diligrp.titan.sdk.domain.Category; |
6 | +import com.diligrp.titan.sdk.input.CategoryInput; | |
6 | 7 | import com.diligrp.titan.sdk.output.BaseOutput; |
7 | 8 | import com.diligrp.titan.sdk.service.CategoryService; |
8 | 9 | import org.apache.log4j.Logger; |
... | ... | @@ -11,131 +12,172 @@ import org.junit.Test; |
11 | 12 | import java.util.ArrayList; |
12 | 13 | import java.util.HashMap; |
13 | 14 | import java.util.List; |
15 | + | |
14 | 16 | public class TestCategoryService { |
15 | - private static Logger logger = Logger.getLogger(TestCategoryService.class); | |
16 | - static String accesskey = "9c379f079214447fad2959c4621cd6feVb797oH1"; | |
17 | - static String secretkey = "5e998dbbafb44ca783099afcdead40fa7A3Vf7Fh"; | |
18 | - static TitanClient client = new TitanClient(accesskey, secretkey,"http://titan.api.1n4j.com"); | |
19 | -// static TitanClient client = new TitanClient(accesskey, secretkey,40000); | |
20 | - static CategoryService categoryService = client.getCategoryService(); | |
21 | - | |
22 | - /** | |
23 | - * this method is 获取类目的所有子类目 | |
24 | - * @createTime 2014年7月22日 下午4:03:02 | |
25 | - * @author yangjianjun | |
26 | - */ | |
27 | - @Test | |
28 | - public void testListAll(){ | |
29 | - BaseOutput<List<Category>> output = categoryService.listAll(1); | |
30 | - logger.info("Test category listAll:" + | |
31 | - JSON.toJSONString(output)); | |
32 | - } | |
33 | - /** | |
34 | - * this method is 列出运营范围下的所有子类目 | |
35 | - * @createTime 2014年7月22日 下午4:02:50 | |
36 | - * @author yangjianjun | |
37 | - */ | |
38 | - @Test | |
39 | - public void testListAllRange(){ | |
40 | - BaseOutput<List<Category>> output = categoryService.listAll(0); | |
41 | - logger.info("Test category listAll:" + | |
42 | - JSON.toJSONString(output)); | |
43 | - } | |
44 | - /** | |
45 | - * this method is 列出运营范围下的子类目 | |
46 | - * @createTime 2014年7月22日 下午4:02:35 | |
47 | - * @author yangjianjun | |
48 | - */ | |
49 | - @Test | |
50 | - public void testListChildrenRange(){ | |
51 | - BaseOutput<List<Category>> output = categoryService.listChildren(3); | |
52 | - logger.info("Test category listChildren:" + | |
53 | - JSON.toJSONString(output)); | |
54 | - } | |
55 | - /** | |
56 | - * this method is 获取类目下一级子类目 | |
57 | - * @createTime 2014年7月22日 下午4:04:30 | |
58 | - * @author yangjianjun | |
59 | - */ | |
60 | - @Test | |
61 | - public void testListChildren(){ | |
62 | - BaseOutput<List<Category>> output = categoryService.listChildren(0); | |
63 | - logger.info("Test category listChildren:" + | |
64 | - JSON.toJSONString(output)); | |
65 | - } | |
66 | - /** | |
67 | - * this method is 获取类目的属性 | |
68 | - * @createTime 2014年7月22日 下午4:06:35 | |
69 | - * @author yangjianjun | |
70 | - */ | |
71 | - @Test | |
72 | - public void testListAttributes(){ | |
73 | - BaseOutput<HashMap<String, List<Attribute>>> output =categoryService.listAttributes(57); | |
74 | - logger.info("Test category testListAttributes:" + | |
75 | - JSON.toJSONString(output)); | |
76 | - } | |
17 | + private static Logger logger = Logger.getLogger(TestCategoryService.class); | |
18 | + static String accesskey = "9c379f079214447fad2959c4621cd6feVb797oH1"; | |
19 | + static String secretkey = "5e998dbbafb44ca783099afcdead40fa7A3Vf7Fh"; | |
20 | + static TitanClient client = new TitanClient(accesskey, secretkey, "http://127.0.0.1"); | |
21 | + // static TitanClient client = new TitanClient(accesskey, secretkey,40000); | |
22 | + static CategoryService categoryService = client.getCategoryService(); | |
23 | + | |
24 | + /** | |
25 | + * this method is 获取类目的所有子类目 | |
26 | + * | |
27 | + * @createTime 2014年7月22日 下午4:03:02 | |
28 | + * @author yangjianjun | |
29 | + */ | |
30 | + @Test | |
31 | + public void testListAll() { | |
32 | + BaseOutput<List<Category>> output = categoryService.listAll(1, 1); | |
33 | + logger.info("Test category listAll:" + | |
34 | + JSON.toJSONString(output)); | |
35 | + } | |
36 | + | |
37 | + /** | |
38 | + * this method is 列出运营范围下的所有子类目 | |
39 | + * | |
40 | + * @createTime 2014年7月22日 下午4:02:50 | |
41 | + * @author yangjianjun | |
42 | + */ | |
43 | + @Test | |
44 | + public void testListAllRange() { | |
45 | + BaseOutput<List<Category>> output = categoryService.listAll(0, 1); | |
46 | + logger.info("Test category listAll:" + | |
47 | + JSON.toJSONString(output)); | |
48 | + } | |
77 | 49 | |
50 | + /** | |
51 | + * this method is 列出运营范围下的子类目 | |
52 | + * | |
53 | + * @createTime 2014年7月22日 下午4:02:35 | |
54 | + * @author yangjianjun | |
55 | + */ | |
78 | 56 | @Test |
79 | - public void testListAttributes1(){ | |
80 | - BaseOutput<HashMap<String, List<Attribute>>> output =categoryService.listAttributes(298,true); | |
57 | + public void testListChildrenRange() { | |
58 | + BaseOutput<List<Category>> output = categoryService.listChildren(3, 1); | |
59 | + logger.info("Test category listChildren:" + | |
60 | + JSON.toJSONString(output)); | |
61 | + } | |
62 | + | |
63 | + /** | |
64 | + * this method is 获取类目下一级子类目 | |
65 | + * | |
66 | + * @createTime 2014年7月22日 下午4:04:30 | |
67 | + * @author yangjianjun | |
68 | + */ | |
69 | + @Test | |
70 | + public void testListChildren() { | |
71 | + BaseOutput<List<Category>> output = categoryService.listChildren(0, 1); | |
72 | + logger.info("Test category listChildren:" + | |
73 | + JSON.toJSONString(output)); | |
74 | + } | |
75 | + | |
76 | + /** | |
77 | + * this method is 获取类目的属性 | |
78 | + * | |
79 | + * @createTime 2014年7月22日 下午4:06:35 | |
80 | + * @author yangjianjun | |
81 | + */ | |
82 | + @Test | |
83 | + public void testListAttributes() { | |
84 | + BaseOutput<HashMap<String, List<Attribute>>> output = categoryService.listAttributes(57); | |
81 | 85 | logger.info("Test category testListAttributes:" + |
82 | 86 | JSON.toJSONString(output)); |
83 | 87 | } |
84 | - /** | |
85 | - * this method is 获取类目的面包屑 | |
86 | - * @createTime 2014年7月22日 下午4:08:55 | |
87 | - * @author yangjianjun | |
88 | - */ | |
89 | - @Test | |
90 | - public void testListCrumbs(){ | |
91 | - BaseOutput<List<Category>> output = categoryService.listCrumbs(1); | |
92 | - logger.info("Test category listCrumbs:" + | |
93 | - JSON.toJSONString(output)); | |
94 | - } | |
95 | - /** | |
96 | - * this method is 批量获取类目的属性与类目信息 | |
97 | - * @createTime 2014年7月22日 下午4:12:33 | |
98 | - * @author yangjianjun | |
99 | - */ | |
100 | - @Test | |
101 | - public void testListCategoriesInfo(){ | |
102 | - List<Integer> cids = new ArrayList<Integer>(); | |
103 | - cids.add(1); | |
104 | - cids.add(2); | |
105 | - BaseOutput<List<Category>> output=categoryService.listCategoriesInfo(cids); | |
106 | - logger.info("Test category listCategoriesInfo:" + | |
107 | - JSON.toJSONString(output)); | |
108 | - } | |
109 | - /** | |
110 | - * this method is 获取单个类目的属性与类目信息 | |
111 | - * @createTime 2014年7月22日 下午4:14:30 | |
112 | - * @author yangjianjun | |
113 | - */ | |
114 | - @Test | |
115 | - public void testGetCategoryInfo(){ | |
116 | - BaseOutput<Category> output=categoryService.getCategoryInfo(75); | |
117 | - logger.info("Test category getCategoryInfo:" + | |
118 | - JSON.toJSONString(output)); | |
119 | - } | |
120 | - /** | |
121 | - * this method is 获取商品类目的SEO设置 | |
122 | - * @createTime 2014年7月22日 下午4:15:41 | |
123 | - * @author yangjianjun | |
124 | - */ | |
88 | + | |
89 | + @Test | |
90 | + public void testListAttributes1() { | |
91 | + BaseOutput<HashMap<String, List<Attribute>>> output = categoryService.listAttributes(298, true); | |
92 | + logger.info("Test category testListAttributes:" + | |
93 | + JSON.toJSONString(output)); | |
94 | + } | |
95 | + | |
96 | + /** | |
97 | + * this method is 获取类目的面包屑 | |
98 | + * | |
99 | + * @createTime 2014年7月22日 下午4:08:55 | |
100 | + * @author yangjianjun | |
101 | + */ | |
102 | + @Test | |
103 | + public void testListCrumbs() { | |
104 | + BaseOutput<List<Category>> output = categoryService.listCrumbs(1); | |
105 | + logger.info("Test category listCrumbs:" + | |
106 | + JSON.toJSONString(output)); | |
107 | + } | |
108 | + | |
109 | + /** | |
110 | + * this method is 批量获取类目的属性与类目信息 | |
111 | + * | |
112 | + * @createTime 2014年7月22日 下午4:12:33 | |
113 | + * @author yangjianjun | |
114 | + */ | |
115 | + @Test | |
116 | + public void testListCategoriesInfo() { | |
117 | + List<Integer> cids = new ArrayList<Integer>(); | |
118 | + cids.add(1); | |
119 | + cids.add(2); | |
120 | + BaseOutput<List<Category>> output = categoryService.listCategoriesInfo(cids); | |
121 | + logger.info("Test category listCategoriesInfo:" + | |
122 | + JSON.toJSONString(output)); | |
123 | + } | |
124 | + | |
125 | + /** | |
126 | + * this method is 获取单个类目的属性与类目信息 | |
127 | + * | |
128 | + * @createTime 2014年7月22日 下午4:14:30 | |
129 | + * @author yangjianjun | |
130 | + */ | |
131 | + @Test | |
132 | + public void testGetCategoryInfo() { | |
133 | + BaseOutput<Category> output = categoryService.getCategoryInfo(75); | |
134 | + logger.info("Test category getCategoryInfo:" + | |
135 | + JSON.toJSONString(output)); | |
136 | + } | |
137 | + /** | |
138 | + * this method is 获取商品类目的SEO设置 | |
139 | + * @createTime 2014年7月22日 下午4:15:41 | |
140 | + * @author yangjianjun | |
141 | + */ | |
125 | 142 | // @Test |
126 | 143 | // public void testGetSeoInfo(){ |
127 | 144 | // BaseOutput<SeoInfo> output=categoryService.getSeoInfo(1); |
128 | 145 | // logger.info("Test category getSeoInfo:" + |
129 | 146 | // JSON.toJSONString(output)); |
130 | 147 | // } |
131 | - /** | |
132 | - * this method is 测试搜索分类 | |
133 | - * @createTime 2014年8月21日 下午4:14:10 | |
134 | - * @author yangjianjun | |
135 | - */ | |
136 | - @Test | |
137 | - public void testSearchCategoryInfo(){ | |
138 | - BaseOutput<List<Category>> output=categoryService.searchCategoryInfo("苔"); | |
139 | - logger.info(JSON.toJSONString(output)); | |
140 | - } | |
148 | + | |
149 | + /** | |
150 | + * this method is 测试搜索分类 | |
151 | + * | |
152 | + * @createTime 2014年8月21日 下午4:14:10 | |
153 | + * @author yangjianjun | |
154 | + */ | |
155 | + @Test | |
156 | + public void testSearchCategoryInfo() { | |
157 | + BaseOutput<List<Category>> output = categoryService.searchCategoryInfo("苔"); | |
158 | + logger.info(JSON.toJSONString(output)); | |
159 | + } | |
160 | + | |
161 | + @Test | |
162 | + public void testInster() { | |
163 | + CategoryInput input = new CategoryInput(); | |
164 | + input.setShopId(1); | |
165 | + input.setName("sdk"); | |
166 | + input.setParent(0); | |
167 | + BaseOutput<Object> objectBaseOutput = categoryService.insertCategory(input); | |
168 | + logger.info(JSON.toJSONString(objectBaseOutput)); | |
169 | + } | |
170 | + | |
171 | + @Test | |
172 | + public void testUpdate() { | |
173 | + CategoryInput input = new CategoryInput(); | |
174 | + input.setShopId(1); | |
175 | + input.setName("sd1"); | |
176 | + input.setParent(0); | |
177 | + input.setId(1456l); | |
178 | + BaseOutput<Object> objectBaseOutput = categoryService.updateCategory(input); | |
179 | + logger.info(JSON.toJSONString(objectBaseOutput)); | |
180 | + } | |
181 | + | |
182 | + | |
141 | 183 | } | ... | ... |
titan-sdk/src/test/java/com/diligrp/titan/sdk/TestSDK.java
... | ... | @@ -27,7 +27,7 @@ public class TestSDK { |
27 | 27 | TitanClient client = new TitanClient(accesskey, secretkey); |
28 | 28 | // Test CategoryService |
29 | 29 | CategoryService categoryService = client.getCategoryService(); |
30 | - BaseOutput<List<Category>> output = categoryService.listAll(0); | |
30 | + BaseOutput<List<Category>> output = categoryService.listAll(0,1); | |
31 | 31 | // logger.info("Test category listAll:" + |
32 | 32 | // JSON.toJSONString(output)); |
33 | 33 | // output = categoryService.listAll(0, 4); | ... | ... |
titan-web/src/main/java/com/dili/titan/domain/Category.java
... | ... | @@ -51,6 +51,9 @@ public class Category extends BaseDomain implements Comparable<Category> { |
51 | 51 | * 分类图标 |
52 | 52 | */ |
53 | 53 | private String icon; |
54 | + | |
55 | + private String productImg; | |
56 | + private String note; | |
54 | 57 | /** |
55 | 58 | * 交易场景 1.线上 2.线下 3,线上和线下 <br/> |
56 | 59 | * CategoryAttr类、Category类、Attribute类有常量表示 |
... | ... | @@ -269,6 +272,22 @@ public class Category extends BaseDomain implements Comparable<Category> { |
269 | 272 | this.jp = jp; |
270 | 273 | } |
271 | 274 | |
275 | + public String getProductImg() { | |
276 | + return productImg; | |
277 | + } | |
278 | + | |
279 | + public void setProductImg(String productImg) { | |
280 | + this.productImg = productImg; | |
281 | + } | |
282 | + | |
283 | + public String getNote() { | |
284 | + return note; | |
285 | + } | |
286 | + | |
287 | + public void setNote(String note) { | |
288 | + this.note = note; | |
289 | + } | |
290 | + | |
272 | 291 | @Override |
273 | 292 | public boolean equals(Object o) { |
274 | 293 | if (this == o) return true; | ... | ... |
titan-web/src/main/java/com/dili/titan/web/controller/CategoryController.java
... | ... | @@ -244,7 +244,7 @@ public class CategoryController extends BaseController { |
244 | 244 | */ |
245 | 245 | @RequestMapping(value = "/add", method = { RequestMethod.PUT }) |
246 | 246 | @ResponseBody |
247 | - public String doSave(Category category, Model view) throws Exception { | |
247 | + public String doSave(Category category, Model view, boolean use) throws Exception { | |
248 | 248 | long start = System.currentTimeMillis(); |
249 | 249 | JSONObject result = new JSONObject(); |
250 | 250 | Long cateId = null; | ... | ... |
titan-web/src/main/resources/sqlmap/Attribute.xml renamed to titan-web/src/main/resources/com/diligrp/titan/dao/sqlmap/Attribute.xml
titan-web/src/main/resources/sqlmap/AttributeValue.xml renamed to titan-web/src/main/resources/com/diligrp/titan/dao/sqlmap/AttributeValue.xml
titan-web/src/main/resources/sqlmap/Auth.xml renamed to titan-web/src/main/resources/com/diligrp/titan/dao/sqlmap/Auth.xml
titan-web/src/main/resources/sqlmap/AuthScope.xml renamed to titan-web/src/main/resources/com/diligrp/titan/dao/sqlmap/AuthScope.xml
titan-web/src/main/resources/sqlmap/Category.xml renamed to titan-web/src/main/resources/com/diligrp/titan/dao/sqlmap/Category.xml
... | ... | @@ -51,8 +51,8 @@ |
51 | 51 | <!-- 插入category记录 --> |
52 | 52 | <insert id="insertEntry" parameterType="category" > |
53 | 53 | <![CDATA[ |
54 | - INSERT INTO category (id,`name`,jp,`alias`,parent,status,activate, `order`,icon,deal_type,ctime,utime) | |
55 | - VALUES (#{id},#{name},#{jp},#{alias},#{parent},#{status},#{activate}, #{order},#{icon}, #{dealType},now(),now()) | |
54 | + INSERT INTO category (id,`name`,jp,`alias`,parent,status,activate, `order`,icon,deal_type,ctime,utime,note,product_img) | |
55 | + VALUES (#{id},#{name},#{jp},#{alias},#{parent},#{status},#{activate}, #{order},#{icon}, #{dealType},now(),now(),#{note},#{productImg}) | |
56 | 56 | ]]> |
57 | 57 | </insert> |
58 | 58 | ... | ... |
titan-web/src/main/resources/sqlmap/CategoryAttr.xml renamed to titan-web/src/main/resources/com/diligrp/titan/dao/sqlmap/CategoryAttr.xml
titan-web/src/main/resources/sqlmap/CategorySearchAttr.xml renamed to titan-web/src/main/resources/com/diligrp/titan/dao/sqlmap/CategorySearchAttr.xml
titan-web/src/main/resources/sqlmap/CategorySeo.xml renamed to titan-web/src/main/resources/com/diligrp/titan/dao/sqlmap/CategorySeo.xml
titan-web/src/main/resources/sqlmap/CategoryTemplete.xml renamed to titan-web/src/main/resources/com/diligrp/titan/dao/sqlmap/CategoryTemplete.xml
titan-web/src/main/resources/sqlmap/Image.xml renamed to titan-web/src/main/resources/com/diligrp/titan/dao/sqlmap/Image.xml
titan-web/src/main/resources/sqlmap/IndexCategory.xml renamed to titan-web/src/main/resources/com/diligrp/titan/dao/sqlmap/IndexCategory.xml
titan-web/src/main/resources/sqlmap/ProductAuth.xml renamed to titan-web/src/main/resources/com/diligrp/titan/dao/sqlmap/ProductAuth.xml
titan-web/src/main/resources/sqlmap/ProductImg.xml renamed to titan-web/src/main/resources/com/diligrp/titan/dao/sqlmap/ProductImg.xml
titan-web/src/main/resources/sqlmap/ProductOffline.xml renamed to titan-web/src/main/resources/com/diligrp/titan/dao/sqlmap/ProductOffline.xml
titan-web/src/main/resources/sqlmap/ProductOfflineAttrValue.xml renamed to titan-web/src/main/resources/com/diligrp/titan/dao/sqlmap/ProductOfflineAttrValue.xml
titan-web/src/main/resources/sqlmap/ProductPop.xml renamed to titan-web/src/main/resources/com/diligrp/titan/dao/sqlmap/ProductPop.xml
titan-web/src/main/resources/sqlmap/ProductPopAttr.xml renamed to titan-web/src/main/resources/com/diligrp/titan/dao/sqlmap/ProductPopAttr.xml
titan-web/src/main/resources/sqlmap/ProductPopAttrValue.xml renamed to titan-web/src/main/resources/com/diligrp/titan/dao/sqlmap/ProductPopAttrValue.xml
titan-web/src/main/resources/sqlmap/ProductPopAudit.xml renamed to titan-web/src/main/resources/com/diligrp/titan/dao/sqlmap/ProductPopAudit.xml
titan-web/src/main/resources/sqlmap/ProductPopPriceRange.xml renamed to titan-web/src/main/resources/com/diligrp/titan/dao/sqlmap/ProductPopPriceRange.xml
titan-web/src/main/resources/sqlmap/ProductSearchCate.xml renamed to titan-web/src/main/resources/com/diligrp/titan/dao/sqlmap/ProductSearchCate.xml
titan-web/src/main/resources/sqlmap/ProductSearchSort.xml renamed to titan-web/src/main/resources/com/diligrp/titan/dao/sqlmap/ProductSearchSort.xml
titan-web/src/main/resources/sqlmap/ProductSkuPop.xml renamed to titan-web/src/main/resources/com/diligrp/titan/dao/sqlmap/ProductSkuPop.xml
titan-web/src/main/resources/sqlmap/ProductTemplete.xml renamed to titan-web/src/main/resources/com/diligrp/titan/dao/sqlmap/ProductTemplete.xml
titan-web/src/main/resources/sqlmap/ProductVideo.xml renamed to titan-web/src/main/resources/com/diligrp/titan/dao/sqlmap/ProductVideo.xml
titan-web/src/main/resources/sqlmap/SnapshotSku.xml renamed to titan-web/src/main/resources/com/diligrp/titan/dao/sqlmap/SnapshotSku.xml
titan-web/src/main/resources/sqlmap/SystemConfigure.xml renamed to titan-web/src/main/resources/com/diligrp/titan/dao/sqlmap/SystemConfigure.xml
titan-web/src/main/resources/sqlmap/Templete.xml renamed to titan-web/src/main/resources/com/diligrp/titan/dao/sqlmap/Templete.xml
titan-web/src/main/resources/sqlmap/TitanSequence.xml renamed to titan-web/src/main/resources/com/diligrp/titan/dao/sqlmap/TitanSequence.xml
titan-web/src/main/resources/sqlmap/Video.xml renamed to titan-web/src/main/resources/com/diligrp/titan/dao/sqlmap/Video.xml