Commit aa94ae197e4053cbacdb1a3c01394067d27dd68b

Authored by alexyang
1 parent a8542304

ini

Showing 116 changed files with 2083 additions and 2032 deletions
titan-api/pom.xml
@@ -434,7 +434,7 @@ @@ -434,7 +434,7 @@
434 <dependency> 434 <dependency>
435 <groupId>com.yqyw.user</groupId> 435 <groupId>com.yqyw.user</groupId>
436 <artifactId>diligrp-user-client</artifactId> 436 <artifactId>diligrp-user-client</artifactId>
437 - <version>0.0.4-SNAPSHOT</version> 437 + <version>0.0.5-SNAPSHOT</version>
438 <exclusions> 438 <exclusions>
439 <exclusion> 439 <exclusion>
440 <artifactId>diligrp-website-util</artifactId> 440 <artifactId>diligrp-website-util</artifactId>
@@ -498,12 +498,12 @@ @@ -498,12 +498,12 @@
498 <!-- 数据库 --> 498 <!-- 数据库 -->
499 <dili_titan.jdbc.driver>com.mysql.jdbc.Driver</dili_titan.jdbc.driver> 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&amp;characterEncoding=utf8</dili_titan.master.jdbc.url> 501 + <dili_titan.master.jdbc.url>jdbc:MySql://10.28.11.162:3306/titan?useUnicode=true&amp;characterEncoding=utf8</dili_titan.master.jdbc.url>
502 <dili_titan.master.jdbc.username>root</dili_titan.master.jdbc.username> 502 <dili_titan.master.jdbc.username>root</dili_titan.master.jdbc.username>
503 <dili_titan.master.jdbc.password>123456</dili_titan.master.jdbc.password> 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&amp;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&amp;characterEncoding=utf8</dili_titan.slave.jdbc.url>
  506 + <dili_titan.slave.jdbc.username>root</dili_titan.slave.jdbc.username>
507 <dili_titan.slave.jdbc.password>123456</dili_titan.slave.jdbc.password> 507 <dili_titan.slave.jdbc.password>123456</dili_titan.slave.jdbc.password>
508 <!-- crm接口地址 --> 508 <!-- crm接口地址 -->
509 <dili_titan.crm.url>supplier.1n4j.com</dili_titan.crm.url> 509 <dili_titan.crm.url>supplier.1n4j.com</dili_titan.crm.url>
@@ -514,9 +514,9 @@ @@ -514,9 +514,9 @@
514 <!--shop接口地址,需要测试自己修改 --> 514 <!--shop接口地址,需要测试自己修改 -->
515 <dili_titan.shop.url>http://shop.1n4j.com</dili_titan.shop.url> 515 <dili_titan.shop.url>http://shop.1n4j.com</dili_titan.shop.url>
516 <!-- redis接口地址 --> 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 <!--权限管理的redis配置--> 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 <manage.redis.port>6379</manage.redis.port> 520 <manage.redis.port>6379</manage.redis.port>
521 <!-- MQ 地址--> 521 <!-- MQ 地址-->
522 <conf.mq.namesrvAddr>10.28.10.209:9876;10.28.10.149:9876</conf.mq.namesrvAddr> 522 <conf.mq.namesrvAddr>10.28.10.209:9876;10.28.10.149:9876</conf.mq.namesrvAddr>
@@ -536,219 +536,6 @@ @@ -536,219 +536,6 @@
536 <titan.aqy.appSecret>f48d2b799f9661acdb6041e4ac7c142f</titan.aqy.appSecret> 536 <titan.aqy.appSecret>f48d2b799f9661acdb6041e4ac7c142f</titan.aqy.appSecret>
537 </properties> 537 </properties>
538 </profile> 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&amp;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&amp;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&amp;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&amp;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&amp;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&amp;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&amp;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&amp;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 </profiles> 539 </profiles>
753 540
754 </project> 541 </project>
titan-api/src/main/java/com/diligrp/titan/dao/base/BaseDaoImpl.java
@@ -91,7 +91,7 @@ public abstract class BaseDaoImpl&lt;T, KEY extends Serializable&gt; extends MyBatisSu @@ -91,7 +91,7 @@ public abstract class BaseDaoImpl&lt;T, KEY extends Serializable&gt; extends MyBatisSu
91 return null; 91 return null;
92 } 92 }
93 93
94 - public List<T> selectEntryList(KEY... key) { 94 + public List<T> selectEntryList(KEY... key) {
95 if (key == null || key.length <= 0) { 95 if (key == null || key.length <= 0) {
96 return null; 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&lt;Category,Integer&gt;{ @@ -30,5 +30,13 @@ public interface CategoryDao extends BaseDao&lt;Category,Integer&gt;{
30 * @author ywd 30 * @author ywd
31 */ 31 */
32 public List<CategoryAttr> getCategorySeacherAttrById(int cateId); 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,6 +8,7 @@ import com.diligrp.titan.dao.base.BaseDaoImpl;
8 import com.diligrp.titan.dao.category.CategoryDao; 8 import com.diligrp.titan.dao.category.CategoryDao;
9 import com.diligrp.titan.domain.Category; 9 import com.diligrp.titan.domain.Category;
10 import com.diligrp.titan.domain.CategoryAttr; 10 import com.diligrp.titan.domain.CategoryAttr;
  11 +import com.diligrp.titan.domain.common.TitanSequence;
11 import org.springframework.stereotype.Repository; 12 import org.springframework.stereotype.Repository;
12 13
13 import java.util.List; 14 import java.util.List;
@@ -33,5 +34,16 @@ public class CategoryDaoImpl extends BaseDaoImpl&lt;Category,Integer&gt; implements Ca @@ -33,5 +34,16 @@ public class CategoryDaoImpl extends BaseDaoImpl&lt;Category,Integer&gt; implements Ca
33 public List<CategoryAttr> getCategorySeacherAttrById(int cateId) { 34 public List<CategoryAttr> getCategorySeacherAttrById(int cateId) {
34 return this.selectList(getNameSpace("selectCateSeacherAttrById"), cateId); 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,7 +17,7 @@ import org.springframework.stereotype.Repository;
17 */ 17 */
18 @Repository("presaleDao") 18 @Repository("presaleDao")
19 public class PresaleDaoImpl extends BaseDaoImpl<Presale,Long> implements PresaleDao { 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 //返回本DAO命名空间,并添加statement 22 //返回本DAO命名空间,并添加statement
23 public String getNameSpace(String statement) { 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,7 +17,7 @@ import org.springframework.stereotype.Repository;
17 */ 17 */
18 @Repository("purchaseDao") 18 @Repository("purchaseDao")
19 public class PurchaseDaoImpl extends BaseDaoImpl<Purchase,Long> implements PurchaseDao { 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 //返回本DAO命名空间,并添加statement 22 //返回本DAO命名空间,并添加statement
23 public String getNameSpace(String statement) { 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,7 +17,7 @@ import org.springframework.stereotype.Repository;
17 */ 17 */
18 @Repository("supplyDao") 18 @Repository("supplyDao")
19 public class SupplyDaoImpl extends BaseDaoImpl<Supply,Long> implements SupplyDao { 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 //返回本DAO命名空间,并添加statement 22 //返回本DAO命名空间,并添加statement
23 public String getNameSpace(String statement) { 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,7 +20,7 @@ import org.springframework.stereotype.Repository;
20 */ 20 */
21 @Repository("productSearchSortDao") 21 @Repository("productSearchSortDao")
22 public class ProductSearchSortDaoImpl extends BaseDaoImpl<ProductSearchSort,Integer> implements ProductSearchSortDao { 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 //返回本DAO命名空间,并添加statement 25 //返回本DAO命名空间,并添加statement
26 public String getNameSpace(String statement) { 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,7 +16,7 @@ import org.springframework.stereotype.Repository;
16 */ 16 */
17 @Repository("productVideoDao") 17 @Repository("productVideoDao")
18 public class ProductVideoDaoImpl extends BaseDaoImpl<ProductVideo,Long> implements ProductVideoDao { 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 //返回本DAO命名空间,并添加statement 21 //返回本DAO命名空间,并添加statement
22 public String getNameSpace(String statement) { 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&lt;Category&gt;{ @@ -55,7 +55,35 @@ public class Category extends BaseDomain implements Comparable&lt;Category&gt;{
55 private String icon; 55 private String icon;
56 private boolean hasChild; 56 private boolean hasChild;
57 private Integer dealType; 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 private List<Category> allLevelateList; 87 private List<Category> allLevelateList;
60 88
61 public Category(){ 89 public Category(){
titan-api/src/main/java/com/diligrp/titan/rest/domain/output/CategoryOut.java
@@ -48,7 +48,37 @@ public class CategoryOut { @@ -48,7 +48,37 @@ public class CategoryOut {
48 48
49 private String icon; 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 private String alias; 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&lt;Category,Integer&gt; { @@ -35,7 +35,7 @@ public interface CategoryService extends BaseService&lt;Category,Integer&gt; {
35 * @createTime 2015年3月6日 下午2:12:36 35 * @createTime 2015年3月6日 下午2:12:36
36 * @author ywd 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 * this method is 根据类目ID获取类目属性 41 * this method is 根据类目ID获取类目属性
@@ -65,4 +65,8 @@ public interface CategoryService extends BaseService&lt;Category,Integer&gt; { @@ -65,4 +65,8 @@ public interface CategoryService extends BaseService&lt;Category,Integer&gt; {
65 * @author ywd 65 * @author ywd
66 */ 66 */
67 public boolean hasChildren(int cid); 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,13 +5,13 @@
5 package com.diligrp.titan.service.category.impl; 5 package com.diligrp.titan.service.category.impl;
6 6
7 import com.alibaba.fastjson.JSON; 7 import com.alibaba.fastjson.JSON;
8 -import com.diligrp.titan.rpc.redis.JedisClient;  
9 import com.diligrp.titan.dao.base.BaseDao; 8 import com.diligrp.titan.dao.base.BaseDao;
10 import com.diligrp.titan.dao.category.CategoryDao; 9 import com.diligrp.titan.dao.category.CategoryDao;
11 import com.diligrp.titan.domain.Category; 10 import com.diligrp.titan.domain.Category;
12 import com.diligrp.titan.domain.CategoryAttr; 11 import com.diligrp.titan.domain.CategoryAttr;
13 import com.diligrp.titan.domain.base.RedisKeyConstant; 12 import com.diligrp.titan.domain.base.RedisKeyConstant;
14 import com.diligrp.titan.rest.domain.output.CategoryOut; 13 import com.diligrp.titan.rest.domain.output.CategoryOut;
  14 +import com.diligrp.titan.rpc.redis.JedisClient;
15 import com.diligrp.titan.service.base.BaseServiceImpl; 15 import com.diligrp.titan.service.base.BaseServiceImpl;
16 import com.diligrp.titan.service.category.CategoryService; 16 import com.diligrp.titan.service.category.CategoryService;
17 import org.apache.commons.collections.CollectionUtils; 17 import org.apache.commons.collections.CollectionUtils;
@@ -19,136 +19,209 @@ import org.apache.commons.lang3.StringUtils; @@ -19,136 +19,209 @@ import org.apache.commons.lang3.StringUtils;
19 import org.springframework.stereotype.Service; 19 import org.springframework.stereotype.Service;
20 20
21 import javax.annotation.Resource; 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 * CategoryService 实现类 25 * CategoryService 实现类
  26 + *
28 * @author dev-center 27 * @author dev-center
29 * @since 2014-05-10 28 * @since 2014-05-10
30 */ 29 */
31 @Service("categoryService") 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 catAttrs = categoryDao.getCategoryAttrById(cid); 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 return catAttrs; 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 catSearchAttrs = categoryDao.getCategorySeacherAttrById(cid); 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,6 +5,7 @@ import com.diligrp.titan.common.exception.TitanError;
5 import com.diligrp.titan.common.log.LogHelper; 5 import com.diligrp.titan.common.log.LogHelper;
6 import com.diligrp.titan.common.log.LogTypeEnum; 6 import com.diligrp.titan.common.log.LogTypeEnum;
7 import com.diligrp.titan.common.tools.Tools; 7 import com.diligrp.titan.common.tools.Tools;
  8 +import com.diligrp.titan.domain.Category;
8 import com.diligrp.titan.rest.domain.output.AttributeOut; 9 import com.diligrp.titan.rest.domain.output.AttributeOut;
9 import com.diligrp.titan.rest.domain.output.BaseOutput; 10 import com.diligrp.titan.rest.domain.output.BaseOutput;
10 import com.diligrp.titan.rest.domain.output.CategoryOut; 11 import com.diligrp.titan.rest.domain.output.CategoryOut;
@@ -28,116 +29,169 @@ import java.util.List; @@ -28,116 +29,169 @@ import java.util.List;
28 * <B>Description</B> 商品类目服务的ws <br /> 29 * <B>Description</B> 商品类目服务的ws <br />
29 * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br /> 30 * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br />
30 * <B>Company</B> 地利集团 31 * <B>Company</B> 地利集团
31 - * @createTime 2014年6月10日 下午3:00:56 32 + *
32 * @author yangjianjun 33 * @author yangjianjun
  34 + * @createTime 2014年6月10日 下午3:00:56
33 */ 35 */
34 @Service 36 @Service
35 @RequestMapping(value = "/category", produces = "application/json; charset=UTF-8") 37 @RequestMapping(value = "/category", produces = "application/json; charset=UTF-8")
36 public class CategoryWebservice extends BaseWebservice { 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 long start = System.currentTimeMillis(); 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 LogHelper.error(LogTypeEnum.CATEGORY, e, "调用接口listAll异常!耗时:{}", 115 LogHelper.error(LogTypeEnum.CATEGORY, e, "调用接口listAll异常!耗时:{}",
65 System.currentTimeMillis() - start); 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 MonitorUtils.startMonitor(); 134 MonitorUtils.startMonitor();
83 MonitorUtils.flowMonitor(CategoryWebservice.class, "获取面包屑listCrumbs"); 135 MonitorUtils.flowMonitor(CategoryWebservice.class, "获取面包屑listCrumbs");
84 long start = System.currentTimeMillis(); 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 MonitorUtils.endMonitor(CategoryWebservice.class, "获取面包屑listCrumbs"); 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 MonitorUtils.endMonitor(CategoryWebservice.class, "获取面包屑listCrumbs"); 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 long start = System.currentTimeMillis(); 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 * @param request 187 * @param request
134 * @param response 188 * @param response
135 * @return 189 * @return
136 * @createTime 2014年5月29日 下午3:27:22 190 * @createTime 2014年5月29日 下午3:27:22
137 * @author celine 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 @ResponseBody 195 @ResponseBody
142 public Object getAttributes(HttpServletRequest request, HttpServletResponse response) { 196 public Object getAttributes(HttpServletRequest request, HttpServletResponse response) {
143 long start = System.currentTimeMillis(); 197 long start = System.currentTimeMillis();
@@ -145,140 +199,145 @@ public class CategoryWebservice extends BaseWebservice { @@ -145,140 +199,145 @@ public class CategoryWebservice extends BaseWebservice {
145 try { 199 try {
146 HashMap<String, Object> param = getParamObject(request, new TypeReference<HashMap<String, Object>>() { 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 output.setData(attributes); 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 return output; 209 return output;
156 } catch (TitanError e) { 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 return output.failure(e); 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 RequestMethod.POST, 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 long start = System.currentTimeMillis(); 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 long start = System.currentTimeMillis(); 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 RequestMethod.GET}) 286 RequestMethod.GET})
230 - @ResponseBody  
231 - public Object listChildren(HttpServletRequest request, HttpServletResponse response) { 287 + @ResponseBody
  288 + public Object listChildren(HttpServletRequest request, HttpServletResponse response) {
232 long start = System.currentTimeMillis(); 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 long start = System.currentTimeMillis(); 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 package com.diligrp.titan.ws.category; 1 package com.diligrp.titan.ws.category;
2 2
  3 +import com.diligrp.titan.domain.Category;
3 import com.diligrp.titan.rest.domain.output.AttributeOut; 4 import com.diligrp.titan.rest.domain.output.AttributeOut;
4 import com.diligrp.titan.rest.domain.output.CategoryOut; 5 import com.diligrp.titan.rest.domain.output.CategoryOut;
5 6
@@ -15,7 +16,7 @@ public interface CategoryRestService { @@ -15,7 +16,7 @@ public interface CategoryRestService {
15 * @createTime 2014年5月29日 下午2:42:07 16 * @createTime 2014年5月29日 下午2:42:07
16 * @author celine 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,7 +33,7 @@ public interface CategoryRestService {
32 * @param cid 类目ID 33 * @param cid 类目ID
33 * @return 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,4 +82,8 @@ public interface CategoryRestService {
81 * @author ywd 82 * @author ywd
82 */ 83 */
83 public boolean hasChildren(int cid); 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,6 +2,7 @@ package com.diligrp.titan.ws.category.impl;
2 2
3 import com.diligrp.titan.common.datasource.DynamicSource; 3 import com.diligrp.titan.common.datasource.DynamicSource;
4 import com.diligrp.titan.common.tools.Tools; 4 import com.diligrp.titan.common.tools.Tools;
  5 +import com.diligrp.titan.domain.Category;
5 import com.diligrp.titan.domain.CategoryAttr; 6 import com.diligrp.titan.domain.CategoryAttr;
6 import com.diligrp.titan.rest.domain.output.AttributeOut; 7 import com.diligrp.titan.rest.domain.output.AttributeOut;
7 import com.diligrp.titan.rest.domain.output.CategoryOut; 8 import com.diligrp.titan.rest.domain.output.CategoryOut;
@@ -34,18 +35,19 @@ public class CategoryRestServiceImpl implements CategoryRestService { @@ -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 * @param cid 40 * @param cid
39 * @return 41 * @return
40 * @createTime 2014年5月29日 下午2:42:07 42 * @createTime 2014年5月29日 下午2:42:07
41 * @author celine 43 * @author celine
42 */ 44 */
43 - public List<CategoryOut> listAll(int cid) { 45 + public List<CategoryOut> listAll(int cid, int shopId) {
44 List<CategoryOut> cats = new ArrayList<CategoryOut>(); 46 List<CategoryOut> cats = new ArrayList<CategoryOut>();
45 boolean hasChild = categoryService.hasChildren(cid); 47 boolean hasChild = categoryService.hasChildren(cid);
46 if (hasChild) { 48 if (hasChild) {
47 // 获取所有的子节点id 49 // 获取所有的子节点id
48 - Set<String> childCids = categoryService.getChildCidByParentId(cid); 50 + Set<String> childCids = categoryService.getChildCidByParentId(cid,shopId);
49 if (CollectionUtils.isEmpty(childCids)) { 51 if (CollectionUtils.isEmpty(childCids)) {
50 return null; 52 return null;
51 } 53 }
@@ -63,8 +65,8 @@ public class CategoryRestServiceImpl implements CategoryRestService { @@ -63,8 +65,8 @@ public class CategoryRestServiceImpl implements CategoryRestService {
63 } 65 }
64 66
65 // 递归获取子节点的子孙,并加入cat 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 continue; 70 continue;
69 } 71 }
70 for (CategoryOut child : childCats) { 72 for (CategoryOut child : childCats) {
@@ -112,11 +114,11 @@ public class CategoryRestServiceImpl implements CategoryRestService { @@ -112,11 +114,11 @@ public class CategoryRestServiceImpl implements CategoryRestService {
112 * @createTime 2014年5月29日 下午2:41:39 114 * @createTime 2014年5月29日 下午2:41:39
113 * @author celine 115 * @author celine
114 */ 116 */
115 - public List<CategoryOut> listChildren(int cid) { 117 + public List<CategoryOut> listChildren(int cid,int shopId) {
116 List<CategoryOut> cats = new ArrayList<CategoryOut>(); 118 List<CategoryOut> cats = new ArrayList<CategoryOut>();
117 if (categoryService.hasChildren(cid)) { 119 if (categoryService.hasChildren(cid)) {
118 // 获取子节点id 120 // 获取子节点id
119 - Set<String> childCids = categoryService.getChildCidByParentId(cid); 121 + Set<String> childCids = categoryService.getChildCidByParentId(cid,shopId);
120 if (CollectionUtils.isEmpty(childCids)) { 122 if (CollectionUtils.isEmpty(childCids)) {
121 return null; 123 return null;
122 } 124 }
@@ -152,7 +154,7 @@ public class CategoryRestServiceImpl implements CategoryRestService { @@ -152,7 +154,7 @@ public class CategoryRestServiceImpl implements CategoryRestService {
152 String attrId = String.valueOf(catAttr.getAttrId()); 154 String attrId = String.valueOf(catAttr.getAttrId());
153 AttributeOut attr = attributeRestService.findAttrAndValueById(attrId); 155 AttributeOut attr = attributeRestService.findAttrAndValueById(attrId);
154 if (Tools.objectIsNotNull(attr)) { 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 if (Tools.objectIsNotNull(attr.getSaleType())) { 158 if (Tools.objectIsNotNull(attr.getSaleType())) {
157 if (attr.getSaleType().equals(DESC_ATT_TYPE)) { 159 if (attr.getSaleType().equals(DESC_ATT_TYPE)) {
158 descAtt.add(attr); 160 descAtt.add(attr);
@@ -207,6 +209,16 @@ public class CategoryRestServiceImpl implements CategoryRestService { @@ -207,6 +209,16 @@ public class CategoryRestServiceImpl implements CategoryRestService {
207 return categoryService.hasChildren(cid); 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 public List<CategoryOut> listCategoriesInfo(List<Integer> cids) { 222 public List<CategoryOut> listCategoriesInfo(List<Integer> cids) {
211 List<CategoryOut> categorise = new ArrayList<CategoryOut>(); 223 List<CategoryOut> categorise = new ArrayList<CategoryOut>();
212 for (Integer cid : cids) { 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,9 +145,9 @@ public class PreSaleRestServiceImpl implements PresaleRestService {
145 if(!(cg.getActivate() == Category.SHOW_STATUS_ACTIVE) || !(cg.getStatus() == Category.STATUS_NORMAL)){ 145 if(!(cg.getActivate() == Category.SHOW_STATUS_ACTIVE) || !(cg.getStatus() == Category.STATUS_NORMAL)){
146 return output.failure(TitanError.CATEGORY_STATE_ERROR); 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 return output; 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,9 +158,9 @@ public class PurchaseRestServiceImpl implements PurchaseRestService {
158 if(!(cg.getActivate() == Category.SHOW_STATUS_ACTIVE) || !(cg.getStatus() == Category.STATUS_NORMAL)){ 158 if(!(cg.getActivate() == Category.SHOW_STATUS_ACTIVE) || !(cg.getStatus() == Category.STATUS_NORMAL)){
159 return output.failure(TitanError.CATEGORY_STATE_ERROR); 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 return output; 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,9 +158,9 @@ public class SupplyRestServiceImpl implements SupplyRestService {
158 if(!(cg.getActivate() == Category.SHOW_STATUS_ACTIVE) || !(cg.getStatus() == Category.STATUS_NORMAL)){ 158 if(!(cg.getActivate() == Category.SHOW_STATUS_ACTIVE) || !(cg.getStatus() == Category.STATUS_NORMAL)){
159 return output.failure(TitanError.CATEGORY_STATE_ERROR); 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 return output; 164 return output;
165 } 165 }
166 166
titan-api/src/main/resources/log4j.xml
@@ -7,209 +7,9 @@ @@ -7,209 +7,9 @@
7 </layout> 7 </layout>
8 </appender> 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 <root> 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 <!--<appender-ref ref="FILE"/>--> 13 <!--<appender-ref ref="FILE"/>-->
214 </root> 14 </root>
215 </log4j:configuration> 15 </log4j:configuration>
216 \ No newline at end of file 16 \ No newline at end of file
titan-api/src/main/resources/spring-config-dao.xml
@@ -10,7 +10,7 @@ @@ -10,7 +10,7 @@
10 http://www.springframework.org/schema/aop/spring-aop.xsd" 10 http://www.springframework.org/schema/aop/spring-aop.xsd"
11 default-autowire="byName"> 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 <bean id="baseDataSource" class="com.alibaba.druid.pool.DruidDataSource"> 15 <bean id="baseDataSource" class="com.alibaba.druid.pool.DruidDataSource">
16 <property name="filters" value="stat"/> 16 <property name="filters" value="stat"/>
titan-api/src/main/resources/spring-config-mq.xml
@@ -6,7 +6,7 @@ @@ -6,7 +6,7 @@
6 http://www.springframework.org/schema/context 6 http://www.springframework.org/schema/context
7 http://www.springframework.org/schema/context/spring-context-3.2.xsd"> 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 <bean id="diliMQProducer" 10 <bean id="diliMQProducer"
11 class="com.diligrp.util.rocketMQUtil.impl.DiliMQProducerImpl"/> 11 class="com.diligrp.util.rocketMQUtil.impl.DiliMQProducerImpl"/>
12 <bean id="messageProducerClient" class="com.diligrp.messageCenter.sdk.MessageProducerClient"> 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 +7,7 @@
7 http://www.springframework.org/schema/context/spring-context.xsd" 7 http://www.springframework.org/schema/context/spring-context.xsd"
8 default-autowire="byName"> 8 default-autowire="byName">
9 9
10 - <context:component-scan base-package="com.dili.titan.redis" /> 10 +
11 11
12 <bean id="jedisPoolConfig" class="redis.clients.jedis.JedisPoolConfig"> 12 <bean id="jedisPoolConfig" class="redis.clients.jedis.JedisPoolConfig">
13 <property name="maxIdle" value="6"></property> 13 <property name="maxIdle" value="6"></property>
titan-api/src/main/resources/spring-config-service.xml
@@ -11,9 +11,9 @@ @@ -11,9 +11,9 @@
11 http://www.springframework.org/schema/tx/spring-tx.xsd" 11 http://www.springframework.org/schema/tx/spring-tx.xsd"
12 default-autowire="byName"> 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 <tx:annotation-driven transaction-manager="transactionManager" proxy-target-class="true"/> 18 <tx:annotation-driven transaction-manager="transactionManager" proxy-target-class="true"/>
19 </beans> 19 </beans>
20 \ No newline at end of file 20 \ No newline at end of file
titan-api/src/main/resources/spring-config-servlet.xml
@@ -9,7 +9,7 @@ @@ -9,7 +9,7 @@
9 default-autowire="byName"> 9 default-autowire="byName">
10 10
11 <!-- mvc controller --> 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 <!--<aop:aspectj-autoproxy proxy-target-class="true" />--> 13 <!--<aop:aspectj-autoproxy proxy-target-class="true" />-->
14 <context:annotation-config /> 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 <?xml version="1.0" encoding="UTF-8" ?> 1 <?xml version="1.0" encoding="UTF-8" ?>
2 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" 2 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
3 "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> 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 <!-- category 所有查询列 --> 6 <!-- category 所有查询列 -->
7 <sql id="QUERY_COLUMN_LIST"> 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 </sql> 9 </sql>
10 10
11 <!-- category 查询列来源表--> 11 <!-- category 查询列来源表-->
@@ -23,7 +23,7 @@ @@ -23,7 +23,7 @@
23 <if test="order != null and order != ''"><![CDATA[AND `order` = #{order}]]></if> 23 <if test="order != null and order != ''"><![CDATA[AND `order` = #{order}]]></if>
24 </where> 24 </where>
25 </sql> 25 </sql>
26 - 26 +
27 <!-- 智能排序与分页 --> 27 <!-- 智能排序与分页 -->
28 <sql id="QUERY_ORDER_LIMIT_CONDTION"> 28 <sql id="QUERY_ORDER_LIMIT_CONDTION">
29 <if test="orderField != null and orderField != '' and orderFieldType != null and orderFieldType != ''"><![CDATA[ORDER BY ${orderField} ${orderFieldType}]]></if> 29 <if test="orderField != null and orderField != '' and orderFieldType != null and orderFieldType != ''"><![CDATA[ORDER BY ${orderField} ${orderFieldType}]]></if>
@@ -45,8 +45,8 @@ @@ -45,8 +45,8 @@
45 <!-- 插入category记录 --> 45 <!-- 插入category记录 -->
46 <insert id="insertEntry" parameterType="category" > 46 <insert id="insertEntry" parameterType="category" >
47 <![CDATA[ 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 </insert> 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 <?xml version="1.0" encoding="UTF-8" ?> 1 <?xml version="1.0" encoding="UTF-8" ?>
2 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" 2 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
3 "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> 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 <!-- product_search_sort 所有查询列 --> 6 <!-- product_search_sort 所有查询列 -->
7 <sql id="QUERY_COLUMN_LIST"> 7 <sql id="QUERY_COLUMN_LIST">
titan-api/src/main/resources/sqlmap/ProductVideo.xml 100755 → 100644
1 <?xml version="1.0" encoding="UTF-8" ?> 1 <?xml version="1.0" encoding="UTF-8" ?>
2 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" 2 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
3 "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> 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 <!-- product_video 所有查询列 --> 6 <!-- product_video 所有查询列 -->
7 <sql id="QUERY_COLUMN_LIST"> 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 <?xml version="1.0" encoding="UTF-8" ?> 1 <?xml version="1.0" encoding="UTF-8" ?>
2 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" 2 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
3 "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> 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 <!-- presale 所有查询列 --> 6 <!-- presale 所有查询列 -->
7 <sql id="QUERY_COLUMN_LIST"> 7 <sql id="QUERY_COLUMN_LIST">
titan-api/src/main/resources/sqlmap/gq/Purchase.xml 100755 → 100644
1 <?xml version="1.0" encoding="UTF-8" ?> 1 <?xml version="1.0" encoding="UTF-8" ?>
2 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" 2 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
3 "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> 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 <!-- purchase 所有查询列 --> 6 <!-- purchase 所有查询列 -->
7 <sql id="QUERY_COLUMN_LIST"> 7 <sql id="QUERY_COLUMN_LIST">
titan-api/src/main/resources/sqlmap/gq/Supply.xml 100755 → 100644
1 <?xml version="1.0" encoding="UTF-8" ?> 1 <?xml version="1.0" encoding="UTF-8" ?>
2 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" 2 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
3 "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> 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 <!-- supply 所有查询列 --> 6 <!-- supply 所有查询列 -->
7 <sql id="QUERY_COLUMN_LIST"> 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,14 +25,14 @@
25 </typeAliases> 25 </typeAliases>
26 26
27 <mappers> 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 </mappers> 36 </mappers>
37 37
38 </configuration> 38 </configuration>
39 \ No newline at end of file 39 \ No newline at end of file
titan-cache/src/main/resources/spring-config-dao.xml
@@ -53,7 +53,7 @@ @@ -53,7 +53,7 @@
53 53
54 <bean id="sessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean"> 54 <bean id="sessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
55 <property name="dataSource" ref="masterDataSource" /> 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 </bean> 57 </bean>
58 58
59 <bean id="sqlTemplate" class="org.mybatis.spring.SqlSessionTemplate"> 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,6 +51,36 @@ public class Category {
51 */ 51 */
52 private String cname; 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,6 +2,7 @@ package com.diligrp.titan.sdk.service;
2 2
3 import com.diligrp.titan.sdk.domain.Attribute; 3 import com.diligrp.titan.sdk.domain.Attribute;
4 import com.diligrp.titan.sdk.domain.Category; 4 import com.diligrp.titan.sdk.domain.Category;
  5 +import com.diligrp.titan.sdk.input.CategoryInput;
5 import com.diligrp.titan.sdk.output.BaseOutput; 6 import com.diligrp.titan.sdk.output.BaseOutput;
6 7
7 import java.util.HashMap; 8 import java.util.HashMap;
@@ -23,7 +24,7 @@ public interface CategoryService { @@ -23,7 +24,7 @@ public interface CategoryService {
23 * @param cid 父类目id,0表示根节点 24 * @param cid 父类目id,0表示根节点
24 * @return {@link Category} 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,7 +38,9 @@ public interface CategoryService {
37 * @param cid 父类目id,0表示根节点 38 * @param cid 父类目id,0表示根节点
38 * @return {@link Category} 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,4 +84,8 @@ public interface CategoryService {
81 * @author yangjianjun 84 * @author yangjianjun
82 */ 85 */
83 public BaseOutput<List<Category>> searchCategoryInfo(String cname); 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,6 +3,7 @@ package com.diligrp.titan.sdk.service.impl;
3 import com.alibaba.fastjson.TypeReference; 3 import com.alibaba.fastjson.TypeReference;
4 import com.diligrp.titan.sdk.domain.Attribute; 4 import com.diligrp.titan.sdk.domain.Attribute;
5 import com.diligrp.titan.sdk.domain.Category; 5 import com.diligrp.titan.sdk.domain.Category;
  6 +import com.diligrp.titan.sdk.input.CategoryInput;
6 import com.diligrp.titan.sdk.output.BaseOutput; 7 import com.diligrp.titan.sdk.output.BaseOutput;
7 import com.diligrp.titan.sdk.service.CategoryService; 8 import com.diligrp.titan.sdk.service.CategoryService;
8 import com.diligrp.titan.sdk.service.ServiceExcutor; 9 import com.diligrp.titan.sdk.service.ServiceExcutor;
@@ -13,53 +14,63 @@ import java.util.Map; @@ -13,53 +14,63 @@ import java.util.Map;
13 14
14 public class CategoryServiceImpl extends ServiceExcutor implements CategoryService { 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 @Override 75 @Override
65 public BaseOutput<HashMap<String, List<Attribute>>> listAttributes(int cid, boolean includeDel) { 76 public BaseOutput<HashMap<String, List<Attribute>>> listAttributes(int cid, boolean includeDel) {
@@ -73,32 +84,48 @@ public class CategoryServiceImpl extends ServiceExcutor implements CategoryServi @@ -73,32 +84,48 @@ public class CategoryServiceImpl extends ServiceExcutor implements CategoryServi
73 } 84 }
74 85
75 @Override 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,6 +3,7 @@ package com.diligrp.titan.sdk;
3 import com.alibaba.fastjson.JSON; 3 import com.alibaba.fastjson.JSON;
4 import com.diligrp.titan.sdk.domain.Attribute; 4 import com.diligrp.titan.sdk.domain.Attribute;
5 import com.diligrp.titan.sdk.domain.Category; 5 import com.diligrp.titan.sdk.domain.Category;
  6 +import com.diligrp.titan.sdk.input.CategoryInput;
6 import com.diligrp.titan.sdk.output.BaseOutput; 7 import com.diligrp.titan.sdk.output.BaseOutput;
7 import com.diligrp.titan.sdk.service.CategoryService; 8 import com.diligrp.titan.sdk.service.CategoryService;
8 import org.apache.log4j.Logger; 9 import org.apache.log4j.Logger;
@@ -11,131 +12,172 @@ import org.junit.Test; @@ -11,131 +12,172 @@ import org.junit.Test;
11 import java.util.ArrayList; 12 import java.util.ArrayList;
12 import java.util.HashMap; 13 import java.util.HashMap;
13 import java.util.List; 14 import java.util.List;
  15 +
14 public class TestCategoryService { 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 @Test 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 logger.info("Test category testListAttributes:" + 85 logger.info("Test category testListAttributes:" +
82 JSON.toJSONString(output)); 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 // @Test 142 // @Test
126 // public void testGetSeoInfo(){ 143 // public void testGetSeoInfo(){
127 // BaseOutput<SeoInfo> output=categoryService.getSeoInfo(1); 144 // BaseOutput<SeoInfo> output=categoryService.getSeoInfo(1);
128 // logger.info("Test category getSeoInfo:" + 145 // logger.info("Test category getSeoInfo:" +
129 // JSON.toJSONString(output)); 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,7 +27,7 @@ public class TestSDK {
27 TitanClient client = new TitanClient(accesskey, secretkey); 27 TitanClient client = new TitanClient(accesskey, secretkey);
28 // Test CategoryService 28 // Test CategoryService
29 CategoryService categoryService = client.getCategoryService(); 29 CategoryService categoryService = client.getCategoryService();
30 - BaseOutput<List<Category>> output = categoryService.listAll(0); 30 + BaseOutput<List<Category>> output = categoryService.listAll(0,1);
31 // logger.info("Test category listAll:" + 31 // logger.info("Test category listAll:" +
32 // JSON.toJSONString(output)); 32 // JSON.toJSONString(output));
33 // output = categoryService.listAll(0, 4); 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&lt;Category&gt; { @@ -51,6 +51,9 @@ public class Category extends BaseDomain implements Comparable&lt;Category&gt; {
51 * 分类图标 51 * 分类图标
52 */ 52 */
53 private String icon; 53 private String icon;
  54 +
  55 + private String productImg;
  56 + private String note;
54 /** 57 /**
55 * 交易场景 1.线上 2.线下 3,线上和线下 <br/> 58 * 交易场景 1.线上 2.线下 3,线上和线下 <br/>
56 * CategoryAttr类、Category类、Attribute类有常量表示 59 * CategoryAttr类、Category类、Attribute类有常量表示
@@ -269,6 +272,22 @@ public class Category extends BaseDomain implements Comparable&lt;Category&gt; { @@ -269,6 +272,22 @@ public class Category extends BaseDomain implements Comparable&lt;Category&gt; {
269 this.jp = jp; 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 @Override 291 @Override
273 public boolean equals(Object o) { 292 public boolean equals(Object o) {
274 if (this == o) return true; 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,7 +244,7 @@ public class CategoryController extends BaseController {
244 */ 244 */
245 @RequestMapping(value = "/add", method = { RequestMethod.PUT }) 245 @RequestMapping(value = "/add", method = { RequestMethod.PUT })
246 @ResponseBody 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 long start = System.currentTimeMillis(); 248 long start = System.currentTimeMillis();
249 JSONObject result = new JSONObject(); 249 JSONObject result = new JSONObject();
250 Long cateId = null; 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,8 +51,8 @@
51 <!-- 插入category记录 --> 51 <!-- 插入category记录 -->
52 <insert id="insertEntry" parameterType="category" > 52 <insert id="insertEntry" parameterType="category" >
53 <![CDATA[ 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 </insert> 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
titan-web/src/main/resources/sqlmap/gq/Presale.xml renamed to titan-web/src/main/resources/com/diligrp/titan/dao/sqlmap/gq/Presale.xml
titan-web/src/main/resources/sqlmap/gq/Purchase.xml renamed to titan-web/src/main/resources/com/diligrp/titan/dao/sqlmap/gq/Purchase.xml
titan-web/src/main/resources/sqlmap/gq/Supply.xml renamed to titan-web/src/main/resources/com/diligrp/titan/dao/sqlmap/gq/Supply.xml
titan-web/src/main/resources/spring-config-dao.xml
@@ -82,7 +82,7 @@ @@ -82,7 +82,7 @@
82 <!-- 集成Mybatis --> 82 <!-- 集成Mybatis -->
83 <bean id="sessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean"> 83 <bean id="sessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
84 <property name="dataSource" ref="dynamicDataSource" /> 84 <property name="dataSource" ref="dynamicDataSource" />
85 - <property name="configLocation" value="classpath:sqlmap-config.xml" /> 85 + <property name="configLocation" value="classpath:com.diligrp.titan.dao.sqlmap-config.xml" />
86 </bean> 86 </bean>
87 87
88 <bean id="sqlTemplate" class="org.mybatis.spring.SqlSessionTemplate"> 88 <bean id="sqlTemplate" class="org.mybatis.spring.SqlSessionTemplate">
titan-web/src/main/resources/sqlmap-config.xml
@@ -56,42 +56,42 @@ @@ -56,42 +56,42 @@
56 56
57 <!-- 映射文件路径 --> 57 <!-- 映射文件路径 -->
58 <mappers> 58 <mappers>
59 - <mapper resource="sqlmap/Attribute.xml" />  
60 - <mapper resource="sqlmap/AttributeValue.xml" />  
61 - <mapper resource="sqlmap/Category.xml" />  
62 - <mapper resource="sqlmap/CategoryAttr.xml" />  
63 - <mapper resource="sqlmap/CategorySearchAttr.xml" />  
64 - <mapper resource="sqlmap/CategorySeo.xml" />  
65 - <mapper resource="sqlmap/ProductTemplete.xml" />  
66 - <mapper resource="sqlmap/ProductPopAttr.xml" />  
67 - <mapper resource="sqlmap/ProductPopAttrValue.xml" />  
68 - <mapper resource="sqlmap/ProductImg.xml" />  
69 - <mapper resource="sqlmap/ProductPop.xml" />  
70 - <mapper resource="sqlmap/ProductPopAudit.xml" />  
71 - <mapper resource="sqlmap/ProductSkuPop.xml" />  
72 - <mapper resource="sqlmap/Templete.xml" />  
73 - <mapper resource="sqlmap/SystemConfigure.xml" />  
74 - <mapper resource="sqlmap/TitanSequence.xml" />  
75 - <mapper resource="sqlmap/SnapshotSku.xml" />  
76 - <mapper resource="sqlmap/CategoryTemplete.xml" />  
77 - <mapper resource="sqlmap/Image.xml" />  
78 - <mapper resource="sqlmap/ProductPopPriceRange.xml" />  
79 - <mapper resource="sqlmap/ProductSearchSort.xml"/>  
80 - <mapper resource="sqlmap/ProductSearchCate.xml"/> 59 + <mapper resource="com.diligrp.titan.dao.sqlmap/Attribute.xml" />
  60 + <mapper resource="com.diligrp.titan.dao.sqlmap/AttributeValue.xml" />
  61 + <mapper resource="com.diligrp.titan.dao.sqlmap/Category.xml" />
  62 + <mapper resource="com.diligrp.titan.dao.sqlmap/CategoryAttr.xml" />
  63 + <mapper resource="com.diligrp.titan.dao.sqlmap/CategorySearchAttr.xml" />
  64 + <mapper resource="com.diligrp.titan.dao.sqlmap/CategorySeo.xml" />
  65 + <mapper resource="com.diligrp.titan.dao.sqlmap/ProductTemplete.xml" />
  66 + <mapper resource="com.diligrp.titan.dao.sqlmap/ProductPopAttr.xml" />
  67 + <mapper resource="com.diligrp.titan.dao.sqlmap/ProductPopAttrValue.xml" />
  68 + <mapper resource="com.diligrp.titan.dao.sqlmap/ProductImg.xml" />
  69 + <mapper resource="com.diligrp.titan.dao.sqlmap/ProductPop.xml" />
  70 + <mapper resource="com.diligrp.titan.dao.sqlmap/ProductPopAudit.xml" />
  71 + <mapper resource="com.diligrp.titan.dao.sqlmap/ProductSkuPop.xml" />
  72 + <mapper resource="com.diligrp.titan.dao.sqlmap/Templete.xml" />
  73 + <mapper resource="com.diligrp.titan.dao.sqlmap/SystemConfigure.xml" />
  74 + <mapper resource="com.diligrp.titan.dao.sqlmap/TitanSequence.xml" />
  75 + <mapper resource="com.diligrp.titan.dao.sqlmap/SnapshotSku.xml" />
  76 + <mapper resource="com.diligrp.titan.dao.sqlmap/CategoryTemplete.xml" />
  77 + <mapper resource="com.diligrp.titan.dao.sqlmap/Image.xml" />
  78 + <mapper resource="com.diligrp.titan.dao.sqlmap/ProductPopPriceRange.xml" />
  79 + <mapper resource="com.diligrp.titan.dao.sqlmap/ProductSearchSort.xml"/>
  80 + <mapper resource="com.diligrp.titan.dao.sqlmap/ProductSearchCate.xml"/>
81 81
82 - <mapper resource="sqlmap/Auth.xml"/>  
83 - <mapper resource="sqlmap/AuthScope.xml"/>  
84 - <mapper resource="sqlmap/ProductAuth.xml"/>  
85 - <mapper resource="sqlmap/ProductVideo.xml"/>  
86 - <mapper resource="sqlmap/ProductOffline.xml"/>  
87 - <mapper resource="sqlmap/ProductOfflineAttrValue.xml"/>  
88 - <mapper resource="sqlmap/Video.xml"/> 82 + <mapper resource="com.diligrp.titan.dao.sqlmap/Auth.xml"/>
  83 + <mapper resource="com.diligrp.titan.dao.sqlmap/AuthScope.xml"/>
  84 + <mapper resource="com.diligrp.titan.dao.sqlmap/ProductAuth.xml"/>
  85 + <mapper resource="com.diligrp.titan.dao.sqlmap/ProductVideo.xml"/>
  86 + <mapper resource="com.diligrp.titan.dao.sqlmap/ProductOffline.xml"/>
  87 + <mapper resource="com.diligrp.titan.dao.sqlmap/ProductOfflineAttrValue.xml"/>
  88 + <mapper resource="com.diligrp.titan.dao.sqlmap/Video.xml"/>
89 89
90 - <mapper resource="sqlmap/IndexCategory.xml"/> 90 + <mapper resource="com.diligrp.titan.dao.sqlmap/IndexCategory.xml"/>
91 91
92 <!--供求需求--> 92 <!--供求需求-->
93 - <mapper resource="sqlmap/gq/Purchase.xml"/>  
94 - <mapper resource="sqlmap/gq/Supply.xml"/>  
95 - <mapper resource="sqlmap/gq/Presale.xml"/> 93 + <mapper resource="com.diligrp.titan.dao.sqlmap/gq/Purchase.xml"/>
  94 + <mapper resource="com.diligrp.titan.dao.sqlmap/gq/Supply.xml"/>
  95 + <mapper resource="com.diligrp.titan.dao.sqlmap/gq/Presale.xml"/>
96 </mappers> 96 </mappers>
97 </configuration> 97 </configuration>
98 \ No newline at end of file 98 \ No newline at end of file
titan-web/src/main/sql/update.sql 0 → 100644
  1 +ALTER TABLE titan.category ADD note VARCHAR(200) NULL;
  2 +ALTER TABLE titan.category ADD product_img VARCHAR(200) NULL;
  3 +ALTER TABLE titan.category ADD shop_id INT NULL;
0 \ No newline at end of file 4 \ No newline at end of file
titan-web/src/main/webapp/WEB-INF/views/category/main.vm
@@ -192,15 +192,15 @@ @@ -192,15 +192,15 @@
192 </span> 192 </span>
193 </li> 193 </li>
194 <li> 194 <li>
195 - <span class="ar">分类图:</span> 195 + <span class="ar">分类图:</span>
196 <span class="iupld"> 196 <span class="iupld">
197 - <input name="image" type="file" id="uploadAddCategoryImg" 197 + <input name="image" type="file" id="uploadAddProductImg"
198 value="上传图片" 198 value="上传图片"
199 accept="image/gif,image/jpeg,image/png,image/jpg,image/bmp" 199 accept="image/gif,image/jpeg,image/png,image/jpg,image/bmp"
200 class="uploadFile uploadBtn"/> 200 class="uploadFile uploadBtn"/>
201 <!-- 使用标签请放置在 input 标签之后 --> 201 <!-- 使用标签请放置在 input 标签之后 -->
202 - <img src="" id="addCategoryIcon" width="90" height="90"/>  
203 - <p id="error-add-category"></p> 202 + <img src="" id="addProductIcon" width="90" height="90"/>
  203 + <p id="error-add-product"></p>
204 </span> 204 </span>
205 </li> 205 </li>
206 <li> 206 <li>
@@ -225,7 +225,12 @@ @@ -225,7 +225,12 @@
225 <li> 225 <li>
226 <span class="ar">商品描述:</span> 226 <span class="ar">商品描述:</span>
227 <span> 227 <span>
228 - <textarea cols="10" rows="10"></textarea> 228 + <textarea id="c_desc" cols="10" rows="10"></textarea>
  229 + </span>
  230 + </li>
  231 + <li id="use_up">
  232 + <span class="ar"><input type="checkbox" id="use"/>使用上级分类秒速和图片</span>
  233 + <span>
229 </span> 234 </span>
230 </li> 235 </li>
231 </ul> 236 </ul>
titan-web/src/main/webapp/assets/products/category.js
@@ -2,469 +2,483 @@ Namespace.register(&quot;XUI.Category&quot;); @@ -2,469 +2,483 @@ Namespace.register(&quot;XUI.Category&quot;);
2 tree = null; 2 tree = null;
3 addCateTree = null; 3 addCateTree = null;
4 4
5 -(function(){  
6 - XUI.Category = function(){  
7 - return {  
8 - init : function(){  
9 - var self = this;  
10 - self.bindEvent();  
11 - self.initTree();  
12 - },  
13 - //初始化树  
14 - initTree : function(){  
15 - var self = this;  
16 - tree = new YAHOO.widget.TreeView("treeDiv1");  
17 - tree.subscribe("expand", function(node) {  
18 - $(".ygtvcell").find(".tree-view").removeClass("ygtvfocus");  
19 - $("#"+node.contentElId).find(".tree-view").addClass("ygtvfocus");  
20 - initData(node.data.id);  
21 - $(".tree-view em[isLeaf=true]").live("click",function(){  
22 - initData($(this).attr("id"));  
23 - });  
24 - });  
25 - tree.subscribe("collapse", function(node) {  
26 - $(".ygtvcell").find(".tree-view").removeClass("ygtvfocus");  
27 - $("#"+node.contentElId).find(".tree-view").addClass("ygtvfocus");  
28 - initData(node.data.id);  
29 - });  
30 -  
31 - var node = new YAHOO.widget.TextNode("所有分类", tree.getRoot(), true);  
32 - node.data = {parent : 0, id : 0, name : "所有分类"};  
33 - tree.setDynamicLoad(self.dynamic,1);  
34 - tree.draw();  
35 - tree.getRoot().expand();  
36 - },  
37 - refreshTree : function(){  
38 - var self = this;  
39 - tree.destroy();  
40 - self.initTree();  
41 - },  
42 - //动态加载树  
43 - dynamic : function(node, callback){  
44 - var showDisabled = 1;  
45 - if($("#show-disabled-category").is(":checked")){  
46 - showDisabled = 0;  
47 - }  
48 - var keyword = "";  
49 - if($("#markIsSearchId").val() == 1){  
50 - keyword = $("#search-keyword").val();  
51 - }  
52 - $.ajax({  
53 - type : "post",  
54 - data : {parent : node.data.id, status : 1, activate : showDisabled,keyword:keyword},  
55 - url : "/titan/category/findByParent",  
56 - dataType : "json",  
57 - success : function(data){  
58 - var list = data.list;  
59 - if(list!=null && list.length!=0){  
60 - var maxOrder = list[list.length-1].order;  
61 - $.each(list, function(i, n){  
62 - var activeT = "已激活";  
63 - var activeF = "已停用"; 5 +(function () {
  6 + XUI.Category = function () {
  7 + return {
  8 + init: function () {
  9 + var self = this;
  10 + self.bindEvent();
  11 + self.initTree();
  12 + },
  13 + //初始化树
  14 + initTree: function () {
  15 + var self = this;
  16 + tree = new YAHOO.widget.TreeView("treeDiv1");
  17 + tree.subscribe("expand", function (node) {
  18 + $(".ygtvcell").find(".tree-view").removeClass("ygtvfocus");
  19 + $("#" + node.contentElId).find(".tree-view").addClass("ygtvfocus");
  20 + initData(node.data.id);
  21 + $(".tree-view em[isLeaf=true]").live("click", function () {
  22 + initData($(this).attr("id"));
  23 + });
  24 + });
  25 + tree.subscribe("collapse", function (node) {
  26 + $(".ygtvcell").find(".tree-view").removeClass("ygtvfocus");
  27 + $("#" + node.contentElId).find(".tree-view").addClass("ygtvfocus");
  28 + initData(node.data.id);
  29 + });
  30 +
  31 + var node = new YAHOO.widget.TextNode("所有分类", tree.getRoot(), true);
  32 + node.data = {parent: 0, id: 0, name: "所有分类"};
  33 + tree.setDynamicLoad(self.dynamic, 1);
  34 + tree.draw();
  35 + tree.getRoot().expand();
  36 + },
  37 + refreshTree: function () {
  38 + var self = this;
  39 + tree.destroy();
  40 + self.initTree();
  41 + },
  42 + //动态加载树
  43 + dynamic: function (node, callback) {
  44 + var showDisabled = 1;
  45 + if ($("#show-disabled-category").is(":checked")) {
  46 + showDisabled = 0;
  47 + }
  48 + var keyword = "";
  49 + if ($("#markIsSearchId").val() == 1) {
  50 + keyword = $("#search-keyword").val();
  51 + }
  52 + $.ajax({
  53 + type: "post",
  54 + data: {parent: node.data.id, status: 1, activate: showDisabled, keyword: keyword},
  55 + url: "/titan/category/findByParent",
  56 + dataType: "json",
  57 + success: function (data) {
  58 + var list = data.list;
  59 + if (list != null && list.length != 0) {
  60 + var maxOrder = list[list.length - 1].order;
  61 + $.each(list, function (i, n) {
  62 + var activeT = "已激活";
  63 + var activeF = "已停用";
64 var name = ""; 64 var name = "";
65 /*if(node.data.id==0){ 65 /*if(node.data.id==0){
66 - name="<em>" + n.name + "</em>";  
67 - }else{ 66 + name="<em>" + n.name + "</em>";
  67 + }else{
68 68
69 - }*/ 69 + }*/
70 var statusHtml = ""; 70 var statusHtml = "";
71 - if(data.categoryActive == true){  
72 - statusHtml = "<a onClick='XUI.Category.toggleActivate(\""+ n.id +"\")'>" +(n.activate==0 ? activeF : activeT)+ "</a> </div>";  
73 - }else{  
74 - statusHtml = (n.activate==0 ? activeF : activeT)+ "</div>"; 71 + if (data.categoryActive == true) {
  72 + statusHtml = "<a onClick='XUI.Category.toggleActivate(\"" + n.id + "\")'>" + (n.activate == 0 ? activeF : activeT) + "</a> </div>";
  73 + } else {
  74 + statusHtml = (n.activate == 0 ? activeF : activeT) + "</div>";
75 } 75 }
76 - if(!n.isClick){  
77 - statusHtml = (n.activate==0 ? activeF : activeT)+"</div>"; 76 + if (!n.isClick) {
  77 + statusHtml = (n.activate == 0 ? activeF : activeT) + "</div>";
78 } 78 }
79 var isLastHtml = ""; 79 var isLastHtml = "";
80 - if(!n.isLast && data.addCategory == true){  
81 - isLastHtml = "<a href='#cate-fancy' id='addCateFancyId' onClick='XUI.Category.treeOperation(\""+n.id+"\",\"" + n.name+"\", \"add\")' " +  
82 - " class='btn btn-minier'>添加</a>";  
83 - }  
84 - var showDeleteBtn="";  
85 - if(data.deleteCategory == true){  
86 - showDeleteBtn = "<a onClick='XUI.Category.treeOperation(\""+n.id+"\",\"" + n.name+"\", \"delete\")' class='btn btn-minier' >删除</a>";  
87 - }  
88 - var showCateOrder = "";  
89 - if(data.categoryOrder){  
90 - showCateOrder = "<img id='u1_img' class='img' title='向下排序' alt='向下排序' " +  
91 - "onClick='XUI.Category.treeOperation(\""+n.id+"\",\"" + n.name+"\",\"down\");' style='cursor: pointer;' src='/assets/image/u61.png'>"+  
92 - "<img id='u1_img' class='img' title='向上排序' alt='向上排序' " +  
93 - "onClick='XUI.Category.treeOperation(\""+n.id+"\",\"" + n.name+"\",\"up\");' style='cursor: pointer;' src='/assets/image/u140.png'></span>";  
94 - }  
95 - var node1 =new YAHOO.widget.HTMLNode("<div class='tree-view'><em isLeaf="+n.isClick+" id="+n.id+">" + n.name+"("+n.id+")" + "</em><span>" +  
96 - isLastHtml+showDeleteBtn+showCateOrder+ 80 + if (!n.isLast && data.addCategory == true) {
  81 + isLastHtml = "<a href='#cate-fancy' id='addCateFancyId' onClick='XUI.Category.treeOperation(\"" + n.id + "\",\"" + n.name + "\", \"add\", \"" + n.level + "\")' " +
  82 + " class='btn btn-minier'>添加</a>";
  83 + }
  84 + var showDeleteBtn = "";
  85 + if (data.deleteCategory == true) {
  86 + showDeleteBtn = "<a onClick='XUI.Category.treeOperation(\"" + n.id + "\",\"" + n.name + "\", \"delete\")' class='btn btn-minier' >删除</a>";
  87 + }
  88 + var showCateOrder = "";
  89 + if (data.categoryOrder) {
  90 + showCateOrder = "<img id='u1_img' class='img' title='向下排序' alt='向下排序' " +
  91 + "onClick='XUI.Category.treeOperation(\"" + n.id + "\",\"" + n.name + "\",\"down\");' style='cursor: pointer;' src='/assets/image/u61.png'>" +
  92 + "<img id='u1_img' class='img' title='向上排序' alt='向上排序' " +
  93 + "onClick='XUI.Category.treeOperation(\"" + n.id + "\",\"" + n.name + "\",\"up\");' style='cursor: pointer;' src='/assets/image/u140.png'></span>";
  94 + }
  95 + var node1 = new YAHOO.widget.HTMLNode("<div class='tree-view'><em isLeaf=" + n.isClick + " id=" + n.id + ">" + n.name + "(" + n.id + ")" + "</em><span>" +
  96 + isLastHtml + showDeleteBtn + showCateOrder +
97 statusHtml, node, false); 97 statusHtml, node, false);
98 - node1.data = {parent : n.parent, name : n.name, id : n.id, order : n.order,maxOrder:maxOrder}; 98 + node1.data = {
  99 + parent: n.parent,
  100 + name: n.name,
  101 + id: n.id,
  102 + order: n.order,
  103 + maxOrder: maxOrder
  104 + };
99 // if(n.isClick){ 105 // if(n.isClick){
100 // node1.isLeaf=true; 106 // node1.isLeaf=true;
101 // } 107 // }
102 - node1.id = n.id;  
103 - });  
104 - }  
105 - callback();  
106 - }  
107 - });  
108 - },  
109 - toggleActivate : function(id){  
110 - var self = this;  
111 - $.ajax({  
112 - type : "post",  
113 - url : "/titan/category/toggleActivate",  
114 - data : {id : id},  
115 - dataType : "json",  
116 - success : function(data){  
117 - if(data.success){  
118 - XUI.window.alert(data.msg, function(){  
119 - self.refreshTree();  
120 - });  
121 - }else{  
122 - XUI.window.alert(data.msg);  
123 - }  
124 - },  
125 - error : function(){  
126 - XUI.window.alert("网络错误,请稍后重试");  
127 - }  
128 - });  
129 - },  
130 - //树操作  
131 - treeOperation : function(id, parentName, operation){  
132 - var self = this;  
133 - var node= tree.getNodeByProperty("id", id);  
134 - if(operation =="add"){  
135 - XUI.Category.common.addCategory(id,parentName);  
136 - //self.refreshTree();  
137 - }  
138 - if(operation =="up"){  
139 - if(node.data.order == 0){  
140 - XUI.window.alert("分类已经处于最顶端,无法上移");  
141 - return false;  
142 - }  
143 - var activate = 0;  
144 - if(!document.getElementById("show-disabled-category").checked){  
145 - activate = 1;  
146 - }  
147 - self.order({id : id, operation : "up",activate:activate});  
148 - }  
149 - if(operation == "down"){  
150 - if(node.data.order == (node.data.maxOrder )){  
151 - XUI.window.alert("分类已经处于最末端,无法下移");  
152 - return false;  
153 - }  
154 - var activate = 0;  
155 - if(!document.getElementById("show-disabled-category").checked){  
156 - activate = 1;  
157 - }  
158 - self.order({id : id , operation : "down",activate:activate});  
159 - }  
160 - if(operation == "delete"){  
161 - XUI.Category.common.deleteCategory(id);  
162 - }  
163 - },  
164 - bindEvent : function(){  
165 - var self = this;  
166 -  
167 - //点击添加一级分类按钮  
168 - $("#add-first-category").unbind().bind("click", function(){  
169 - XUI.Category.common.addFirstCategory("");  
170 - });  
171 -  
172 - //显示未激活分类  
173 - $("#show-disabled-category").unbind().bind("click", function(){  
174 - self.refreshTree();  
175 - });  
176 - //搜索按钮  
177 - $("#search-category-button").unbind().bind("click", function(){  
178 - $("#markIsSearchId").val(1);  
179 - self.refreshTree();  
180 - });  
181 - },  
182 - //分类排序  
183 - order : function(param){  
184 - var self = this;  
185 - $.ajax({  
186 - type : "post",  
187 - url : "/titan/category/changeCateOrder",  
188 - dataType : "json",  
189 - data : param,  
190 - success : function(data){  
191 - console.log(data);  
192 - if(data){  
193 - if(data.success){  
194 - XUI.window.alert(data.msg, function(){  
195 - self.refreshTree();  
196 - });  
197 - }else{  
198 - XUI.window.alert(data.msg);  
199 - }  
200 - }  
201 - },  
202 - error : function(){  
203 - XUI.window.alert("网络错误,请稍后重试");  
204 - }  
205 - });  
206 - }  
207 - };  
208 - }();  
209 -  
210 - //分类模块公共方法  
211 - XUI.Category.common = function(){  
212 - return {  
213 - //删除分类  
214 - deleteCategory : function(id){  
215 - XUI.window.confirm("确定删除该类别吗?","确认删除", function(){  
216 - $.ajax({  
217 - type : "delete",  
218 - dataType : "json",  
219 - url : "/titan/category/delete/" + id,  
220 - success : function(data){  
221 - if(data.success){  
222 - XUI.window.alert(data.msg, function(){  
223 - window.location.href = "/titan/category";  
224 - });  
225 - }else{  
226 - XUI.window.alert(data.msg);  
227 - }  
228 - },  
229 - error : function(){  
230 - XUI.window.alert("网络错误,请稍后重试");  
231 - }  
232 - });  
233 - });  
234 - },  
235 - //激活  
236 - toggleActivate : function(id){  
237 - $.ajax({  
238 - type : "post",  
239 - url : "/titan/category/toggleActivate",  
240 - data : {id : id},  
241 - dataType : "json",  
242 - success : function(data){  
243 - if(data.success){  
244 - XUI.window.alert(data.msg, function(){  
245 - window.location.href = "/titan/category";  
246 - });  
247 - }else{  
248 - XUI.window.alert(data.msg);  
249 - }  
250 - },  
251 - error : function(){  
252 - XUI.window.alert("网络错误,请稍后重试");  
253 - }  
254 - });  
255 - },  
256 - //添加分类  
257 - addCategory : function(id, parentName){  
258 - $("input[name='add-cate-name']").val("");  
259 - $("input[name='add-cate-alias']").val("");  
260 - $("input[name='add-cate-parent']").val("");  
261 - $("#addCategoryIcon").attr("src","");  
262 - $("#addCateFancyId").fancybox({  
263 - helpers: {  
264 - overlay: {  
265 - closeClick: false  
266 - }  
267 - },  
268 - beforeShow: function(){  
269 - if(parentName == null || parentName == ""){  
270 - parentName = "无";  
271 - }  
272 - $("input[name='add-cate-parent']").val(parentName);  
273 - $("input[name='firstFlag']").val(id);  
274 - }  
275 - });  
276 - },  
277 - //添加分类  
278 - addFirstCategory : function(parentName){  
279 - $("input[name='add-cate-name']").val("");  
280 - $("input[name='add-cate-alias']").val("");  
281 - $("input[name='add-cate-parent']").val("");  
282 - $("#addCategoryIcon").attr("src","");  
283 - $("#add-first-category").fancybox({  
284 - helpers: {  
285 - overlay: {  
286 - closeClick: false  
287 - }  
288 - },  
289 - beforeShow: function(){  
290 - if(parentName == null || parentName == ""){  
291 - parentName = "无";  
292 - }  
293 - $("input[name='add-cate-parent']").val(parentName);  
294 - $("input[name='firstFlag']").val("0");  
295 - }  
296 - });  
297 - }  
298 - };  
299 - }();  
300 -  
301 - //添加和修改分类页面对象  
302 - XUI.Category.add = function(){  
303 - return {  
304 - init : function(){  
305 - var self = this;  
306 - self.bindEvent();  
307 - },  
308 - //绑定事件  
309 - bindEvent : function(){  
310 - var self = this;  
311 - //修改分类信息  
312 - $("#save-category-item").unbind().bind("click",function(){  
313 - self.submit();  
314 - });  
315 - },  
316 - //提交保存  
317 - submit : function(){  
318 - var parent = $("input[name='parent']").val();  
319 - var name = $("input[name='category-name']").val();  
320 - if(name!=""){ 108 + node1.id = n.id;
  109 + });
  110 + }
  111 + callback();
  112 + }
  113 + });
  114 + },
  115 + toggleActivate: function (id) {
  116 + var self = this;
  117 + $.ajax({
  118 + type: "post",
  119 + url: "/titan/category/toggleActivate",
  120 + data: {id: id},
  121 + dataType: "json",
  122 + success: function (data) {
  123 + if (data.success) {
  124 + XUI.window.alert(data.msg, function () {
  125 + self.refreshTree();
  126 + });
  127 + } else {
  128 + XUI.window.alert(data.msg);
  129 + }
  130 + },
  131 + error: function () {
  132 + XUI.window.alert("网络错误,请稍后重试");
  133 + }
  134 + });
  135 + },
  136 + //树操作
  137 + treeOperation: function (id, parentName, operation, level) {
  138 + if (level == 1) {
  139 + $("#use_up").hide();
  140 + $("#use").attr("checked", false);
  141 + }
  142 +
  143 + if (level == 2) {
  144 + $("#use_up").show();
  145 + $("#use").attr("checked", false);
  146 + }
  147 + var self = this;
  148 + var node = tree.getNodeByProperty("id", id);
  149 + if (operation == "add") {
  150 + XUI.Category.common.addCategory(id, parentName);
  151 + //self.refreshTree();
  152 + }
  153 + if (operation == "up") {
  154 + if (node.data.order == 0) {
  155 + XUI.window.alert("分类已经处于最顶端,无法上移");
  156 + return false;
  157 + }
  158 + var activate = 0;
  159 + if (!document.getElementById("show-disabled-category").checked) {
  160 + activate = 1;
  161 + }
  162 + self.order({id: id, operation: "up", activate: activate});
  163 + }
  164 + if (operation == "down") {
  165 + if (node.data.order == (node.data.maxOrder )) {
  166 + XUI.window.alert("分类已经处于最末端,无法下移");
  167 + return false;
  168 + }
  169 + var activate = 0;
  170 + if (!document.getElementById("show-disabled-category").checked) {
  171 + activate = 1;
  172 + }
  173 + self.order({id: id, operation: "down", activate: activate});
  174 + }
  175 + if (operation == "delete") {
  176 + XUI.Category.common.deleteCategory(id);
  177 + }
  178 + },
  179 + bindEvent: function () {
  180 + var self = this;
  181 +
  182 + //点击添加一级分类按钮
  183 + $("#add-first-category").unbind().bind("click", function () {
  184 + XUI.Category.common.addFirstCategory("");
  185 + });
  186 +
  187 + //显示未激活分类
  188 + $("#show-disabled-category").unbind().bind("click", function () {
  189 + self.refreshTree();
  190 + });
  191 + //搜索按钮
  192 + $("#search-category-button").unbind().bind("click", function () {
  193 + $("#markIsSearchId").val(1);
  194 + self.refreshTree();
  195 + });
  196 + },
  197 + //分类排序
  198 + order: function (param) {
  199 + var self = this;
  200 + $.ajax({
  201 + type: "post",
  202 + url: "/titan/category/changeCateOrder",
  203 + dataType: "json",
  204 + data: param,
  205 + success: function (data) {
  206 + console.log(data);
  207 + if (data) {
  208 + if (data.success) {
  209 + XUI.window.alert(data.msg, function () {
  210 + self.refreshTree();
  211 + });
  212 + } else {
  213 + XUI.window.alert(data.msg);
  214 + }
  215 + }
  216 + },
  217 + error: function () {
  218 + XUI.window.alert("网络错误,请稍后重试");
  219 + }
  220 + });
  221 + }
  222 + };
  223 + }();
  224 +
  225 + //分类模块公共方法
  226 + XUI.Category.common = function () {
  227 + return {
  228 + //删除分类
  229 + deleteCategory: function (id) {
  230 + XUI.window.confirm("确定删除该类别吗?", "确认删除", function () {
  231 + $.ajax({
  232 + type: "delete",
  233 + dataType: "json",
  234 + url: "/titan/category/delete/" + id,
  235 + success: function (data) {
  236 + if (data.success) {
  237 + XUI.window.alert(data.msg, function () {
  238 + window.location.href = "/titan/category";
  239 + });
  240 + } else {
  241 + XUI.window.alert(data.msg);
  242 + }
  243 + },
  244 + error: function () {
  245 + XUI.window.alert("网络错误,请稍后重试");
  246 + }
  247 + });
  248 + });
  249 + },
  250 + //激活
  251 + toggleActivate: function (id) {
  252 + $.ajax({
  253 + type: "post",
  254 + url: "/titan/category/toggleActivate",
  255 + data: {id: id},
  256 + dataType: "json",
  257 + success: function (data) {
  258 + if (data.success) {
  259 + XUI.window.alert(data.msg, function () {
  260 + window.location.href = "/titan/category";
  261 + });
  262 + } else {
  263 + XUI.window.alert(data.msg);
  264 + }
  265 + },
  266 + error: function () {
  267 + XUI.window.alert("网络错误,请稍后重试");
  268 + }
  269 + });
  270 + },
  271 + //添加分类
  272 + addCategory: function (id, parentName) {
  273 + $("input[name='add-cate-name']").val("");
  274 + $("input[name='add-cate-alias']").val("");
  275 + $("input[name='add-cate-parent']").val("");
  276 + $("#addCategoryIcon").attr("src", "");
  277 + $("#addCateFancyId").fancybox({
  278 + helpers: {
  279 + overlay: {
  280 + closeClick: false
  281 + }
  282 + },
  283 + beforeShow: function () {
  284 + if (parentName == null || parentName == "") {
  285 + parentName = "无";
  286 + }
  287 + $("input[name='add-cate-parent']").val(parentName);
  288 + $("input[name='firstFlag']").val(id);
  289 + }
  290 + });
  291 + },
  292 + //添加分类
  293 + addFirstCategory: function (parentName) {
  294 + $("input[name='add-cate-name']").val("");
  295 + $("input[name='add-cate-alias']").val("");
  296 + $("input[name='add-cate-parent']").val("");
  297 + $("#addCategoryIcon").attr("src", "");
  298 + $("#add-first-category").fancybox({
  299 + helpers: {
  300 + overlay: {
  301 + closeClick: false
  302 + }
  303 + },
  304 + beforeShow: function () {
  305 + if (parentName == null || parentName == "") {
  306 + parentName = "无";
  307 + }
  308 + $("input[name='add-cate-parent']").val(parentName);
  309 + $("input[name='firstFlag']").val("0");
  310 + }
  311 + });
  312 + }
  313 + };
  314 + }();
  315 +
  316 + //添加和修改分类页面对象
  317 + XUI.Category.add = function () {
  318 + return {
  319 + init: function () {
  320 + var self = this;
  321 + self.bindEvent();
  322 + },
  323 + //绑定事件
  324 + bindEvent: function () {
  325 + var self = this;
  326 + //修改分类信息
  327 + $("#save-category-item").unbind().bind("click", function () {
  328 + self.submit();
  329 + });
  330 + },
  331 + //提交保存
  332 + submit: function () {
  333 + var parent = $("input[name='parent']").val();
  334 + var name = $("input[name='category-name']").val();
  335 + if (name != "") {
321 name = name.replace(/(^\s*)|(\s*$)/g, ""); 336 name = name.replace(/(^\s*)|(\s*$)/g, "");
322 } 337 }
323 - if(name.length > 20){  
324 - XUI.window.alert("分类名字长度不能超过20个字符!");  
325 - return false; 338 + if (name.length > 20) {
  339 + XUI.window.alert("分类名字长度不能超过20个字符!");
  340 + return false;
326 } 341 }
327 - $("input[name='category-name']").val(name); 342 + $("input[name='category-name']").val(name);
328 var alias = $("input[name='category-alias']").val(); 343 var alias = $("input[name='category-alias']").val();
329 - if(alias!=""){  
330 - alias = alias.replace(/(^\s*)|(\s*$)/g, "").replaceAll(",",","); 344 + if (alias != "") {
  345 + alias = alias.replace(/(^\s*)|(\s*$)/g, "").replaceAll(",", ",");
  346 + }
  347 + if (alias.length > 100) {
  348 + XUI.window.alert("分类别名长度不能超过100个字符!");
  349 + return false;
331 } 350 }
332 - if(alias.length > 100){  
333 - XUI.window.alert("分类别名长度不能超过100个字符!");  
334 - return false;  
335 - }  
336 var icon = $("#categoryIcon").attr("src"); 351 var icon = $("#categoryIcon").attr("src");
337 - if(icon==""){ 352 + if (icon == "") {
338 XUI.window.alert("分类图标必须上传!"); 353 XUI.window.alert("分类图标必须上传!");
339 return false; 354 return false;
340 } 355 }
341 - // $("input[name='category-alias']").val(alias);  
342 - var regex=/^[0-9a-zA-Z\u4e00-\u9fa5/()()&《》【】\+=\]\[]+$/g;  
343 - var message="请输入合法的分类名称(中文汉字、英文字母(含大小写)、数字、“/,(),&,《》,【】,[],=,+”)";  
344 - var message1="请输入合法的分类别名(中文汉字、英文字母(含大小写)、数字、“/,(),&,《》,【】,[],=,+”)";  
345 - var regex1=/^[0-9a-zA-Z\u4e00-\u9fa5/()()&《》【】\+=\]\[,]+$/g;  
346 - if (name=="" || !regex.test(name)) { 356 + // $("input[name='category-alias']").val(alias);
  357 + var regex = /^[0-9a-zA-Z\u4e00-\u9fa5/()()&《》【】\+=\]\[]+$/g;
  358 + var message = "请输入合法的分类名称(中文汉字、英文字母(含大小写)、数字、“/,(),&,《》,【】,[],=,+”)";
  359 + var message1 = "请输入合法的分类别名(中文汉字、英文字母(含大小写)、数字、“/,(),&,《》,【】,[],=,+”)";
  360 + var regex1 = /^[0-9a-zA-Z\u4e00-\u9fa5/()()&《》【】\+=\]\[,]+$/g;
  361 + if (name == "" || !regex.test(name)) {
347 XUI.window.alert(message); 362 XUI.window.alert(message);
348 - return false;  
349 - }  
350 - if (alias!=""&&!regex1.test(alias)) { 363 + return false;
  364 + }
  365 + if (alias != "" && !regex1.test(alias)) {
351 XUI.window.alert(message1); 366 XUI.window.alert(message1);
352 return false; 367 return false;
353 } 368 }
354 - var id = $("input[name='id']").val();  
355 - $.ajax({  
356 - type : "post",  
357 - dataType : "json",  
358 - url : "/titan/category/editSave",  
359 - data : {  
360 - name : name,  
361 - alias : alias,  
362 - id : id,  
363 - parent :parent,  
364 - icon :icon  
365 - },  
366 - success : function(data){  
367 - console.log(data);  
368 - if(data){  
369 - if(data.success){  
370 - XUI.window.alert(data.msg, function(){  
371 - window.location.href = "/titan/category";  
372 - });  
373 - }else{  
374 - XUI.window.alert(data.msg);  
375 - }  
376 - }  
377 - },  
378 - error : function(){  
379 - XUI.window.alert("网络错误,请稍后重试");  
380 - }  
381 - });  
382 - },  
383 - 369 + var id = $("input[name='id']").val();
  370 + $.ajax({
  371 + type: "post",
  372 + dataType: "json",
  373 + url: "/titan/category/editSave",
  374 + data: {
  375 + name: name,
  376 + alias: alias,
  377 + id: id,
  378 + parent: parent,
  379 + icon: icon
  380 + },
  381 + success: function (data) {
  382 + console.log(data);
  383 + if (data) {
  384 + if (data.success) {
  385 + XUI.window.alert(data.msg, function () {
  386 + window.location.href = "/titan/category";
  387 + });
  388 + } else {
  389 + XUI.window.alert(data.msg);
  390 + }
  391 + }
  392 + },
  393 + error: function () {
  394 + XUI.window.alert("网络错误,请稍后重试");
  395 + }
  396 + });
  397 + },
  398 +
384 }; 399 };
385 - }();  
386 -  
387 - //seo的修改  
388 - XUI.Category.seo = function(){  
389 - return {  
390 - init : function(){  
391 - var self = this;  
392 - self.bindEvent();  
393 - },  
394 - bindEvent : function(){ 400 + }();
  401 +
  402 + //seo的修改
  403 + XUI.Category.seo = function () {
  404 + return {
  405 + init: function () {
  406 + var self = this;
  407 + self.bindEvent();
  408 + },
  409 + bindEvent: function () {
395 var self = this; 410 var self = this;
396 - $("#submit-seo-info").unbind().bind("click", function(){ 411 + $("#submit-seo-info").unbind().bind("click", function () {
397 self.submit(); 412 self.submit();
398 }); 413 });
399 - $("#resetCategoryData").unbind().bind("click", function(){  
400 - resetCategoryData(); 414 + $("#resetCategoryData").unbind().bind("click", function () {
  415 + resetCategoryData();
  416 + });
  417 + $("#resetCategorySeoData").unbind().bind("click", function () {
  418 + resetCategoryData();
  419 + });
  420 + $("#clearSearchDataId").unbind().bind("click", function () {
  421 + $("#search-keyword").val("");
401 }); 422 });
402 - $("#resetCategorySeoData").unbind().bind("click", function(){  
403 - resetCategoryData();  
404 - });  
405 - $("#clearSearchDataId").unbind().bind("click", function(){  
406 - $("#search-keyword").val("");  
407 - });  
408 }, 423 },
409 - submit : function(){  
410 - var param = new Object();  
411 - param.cateId = $("#categoryId").val();  
412 - param.seoTitle = $("#seo-title").val();  
413 - if(param.seoTitle.trim()==""){ 424 + submit: function () {
  425 + var param = new Object();
  426 + param.cateId = $("#categoryId").val();
  427 + param.seoTitle = $("#seo-title").val();
  428 + if (param.seoTitle.trim() == "") {
414 XUI.window.alert("请输入title"); 429 XUI.window.alert("请输入title");
415 return false; 430 return false;
416 } 431 }
417 - if(param.seoTitle.length > 50){  
418 - XUI.window.alert("seo的title长度不能超过50个字符!");  
419 - return false; 432 + if (param.seoTitle.length > 50) {
  433 + XUI.window.alert("seo的title长度不能超过50个字符!");
  434 + return false;
420 } 435 }
421 - param.seoKeyword = $("#seo-keyword").val();  
422 - if(param.seoKeyword.trim()==""){ 436 + param.seoKeyword = $("#seo-keyword").val();
  437 + if (param.seoKeyword.trim() == "") {
423 XUI.window.alert("请输入keyword"); 438 XUI.window.alert("请输入keyword");
424 return false; 439 return false;
425 } 440 }
426 - if(param.seoKeyword.length > 50){  
427 - XUI.window.alert("seo的seoKeyword长度不能超过50个字符!");  
428 - return false; 441 + if (param.seoKeyword.length > 50) {
  442 + XUI.window.alert("seo的seoKeyword长度不能超过50个字符!");
  443 + return false;
429 } 444 }
430 - param.seoDesc = $("#seo-desc").val();  
431 - if(param.seoDesc.trim()==""){ 445 + param.seoDesc = $("#seo-desc").val();
  446 + if (param.seoDesc.trim() == "") {
432 XUI.window.alert("请输入description"); 447 XUI.window.alert("请输入description");
433 return false; 448 return false;
434 } 449 }
435 - if(param.seoDesc.length > 50){  
436 - XUI.window.alert("seo的seoDesc长度不能超过50个字符!");  
437 - return false; 450 + if (param.seoDesc.length > 50) {
  451 + XUI.window.alert("seo的seoDesc长度不能超过50个字符!");
  452 + return false;
438 } 453 }
439 - console.log(JSON.stringify(param));  
440 - $.ajax({  
441 - type : "put",  
442 - url : "/titan/category/seo",  
443 - dataType : "json",  
444 - data : param,  
445 - success : function(data){  
446 - console.log(data);  
447 - if(data){  
448 - if(data.success){  
449 - XUI.window.alert(data.msg, function(){  
450 - window.location.href = "/titan/category";  
451 - });  
452 - }else{  
453 - XUI.window.alert(data.msg);  
454 - }  
455 - }  
456 - },  
457 - error : function(){  
458 - XUI.window.alert("网络错误,请稍后重试");  
459 - }  
460 - });  
461 - }  
462 - };  
463 - }();  
464 - 454 + console.log(JSON.stringify(param));
  455 + $.ajax({
  456 + type: "put",
  457 + url: "/titan/category/seo",
  458 + dataType: "json",
  459 + data: param,
  460 + success: function (data) {
  461 + console.log(data);
  462 + if (data) {
  463 + if (data.success) {
  464 + XUI.window.alert(data.msg, function () {
  465 + window.location.href = "/titan/category";
  466 + });
  467 + } else {
  468 + XUI.window.alert(data.msg);
  469 + }
  470 + }
  471 + },
  472 + error: function () {
  473 + XUI.window.alert("网络错误,请稍后重试");
  474 + }
  475 + });
  476 + }
  477 + };
  478 + }();
  479 +
465 //验证图片 480 //验证图片
466 - var checkImage = function (elementId, maxsize)  
467 - { 481 + var checkImage = function (elementId, maxsize) {
468 var ua = window.navigator.userAgent.toLowerCase(); 482 var ua = window.navigator.userAgent.toLowerCase();
469 var obj_file = document.getElementById(elementId); 483 var obj_file = document.getElementById(elementId);
470 var AllImgExt = ".jpg|.jpeg|.gif|.bmp|.png|"; 484 var AllImgExt = ".jpg|.jpeg|.gif|.bmp|.png|";
@@ -487,601 +501,643 @@ addCateTree = null; @@ -487,601 +501,643 @@ addCateTree = null;
487 } 501 }
488 return true; 502 return true;
489 }; 503 };
490 - //分类图片上传  
491 - $('#uploadCategoryImg').live('change', function(){  
492 - if(!checkImage("uploadCategoryImg", 1024 * 100)){  
493 - return false;  
494 - }  
495 - //图片上传  
496 - $.ajaxFileUpload({  
497 - url: "/common/uploadCategoryIcon",  
498 - secureuri: false,  
499 - fileElementId: $(this),  
500 - dataType: 'json',  
501 - success: function (data) {  
502 - var errorMsg = null;  
503 - console.log(data);  
504 - if (data.success) {  
505 - $("#categoryIcon").attr("src",data.message);  
506 - } else {  
507 - errorMsg = result.message;  
508 - }  
509 - if (errorMsg) {  
510 - $('#error-place-category').css({"color": "red"}).html(errorMsg);  
511 - }  
512 - },  
513 - error: function (data) {  
514 - console.log(data);  
515 - $('#error-place-category').css({"color": "red"}).html(data.message);  
516 - }  
517 - });  
518 - });  
519 - $('#uploadAddCategoryImg').live('change', function(){  
520 - if(!checkImage("uploadAddCategoryImg", 1024 * 100)){  
521 - return false;  
522 - }  
523 - //图片上传  
524 - $.ajaxFileUpload({  
525 - url: "/common/uploadCategoryIcon",  
526 - secureuri: false,  
527 - fileElementId: $(this),  
528 - dataType: 'json',  
529 - success: function (data) {  
530 - var errorMsg = null;  
531 - console.log(data);  
532 - if (data.success) {  
533 - $("#addCategoryIcon").attr("src",data.message);  
534 - } else {  
535 - errorMsg = result.message;  
536 - }  
537 - if (errorMsg) {  
538 - $('#error-add-category').css({"color": "red"}).html(errorMsg);  
539 - }  
540 - },  
541 - error: function (data) {  
542 - console.log(data);  
543 - $('#error-add-category').css({"color": "red"}).html(data.message);  
544 - }  
545 - });  
546 - });  
547 - 504 + //分类图片上传
  505 + $('#uploadCategoryImg').live('change', function () {
  506 + if (!checkImage("uploadCategoryImg", 1024 * 100)) {
  507 + return false;
  508 + }
  509 + //图片上传
  510 + $.ajaxFileUpload({
  511 + url: "/common/uploadCategoryIcon",
  512 + secureuri: false,
  513 + fileElementId: $(this),
  514 + dataType: 'json',
  515 + success: function (data) {
  516 + var errorMsg = null;
  517 + console.log(data);
  518 + if (data.success) {
  519 + $("#categoryIcon").attr("src", data.message);
  520 + } else {
  521 + errorMsg = result.message;
  522 + }
  523 + if (errorMsg) {
  524 + $('#error-place-category').css({"color": "red"}).html(errorMsg);
  525 + }
  526 + },
  527 + error: function (data) {
  528 + console.log(data);
  529 + $('#error-place-category').css({"color": "red"}).html(data.message);
  530 + }
  531 + });
  532 + });
  533 + $('#uploadAddCategoryImg').live('change', function () {
  534 + if (!checkImage("uploadAddCategoryImg", 1024 * 100)) {
  535 + return false;
  536 + }
  537 + //图片上传
  538 + $.ajaxFileUpload({
  539 + url: "/common/uploadCategoryIcon",
  540 + secureuri: false,
  541 + fileElementId: $(this),
  542 + dataType: 'json',
  543 + success: function (data) {
  544 + var errorMsg = null;
  545 + console.log(data);
  546 + if (data.success) {
  547 + $("#addCategoryIcon").attr("src", data.message);
  548 + } else {
  549 + errorMsg = result.message;
  550 + }
  551 + if (errorMsg) {
  552 + $('#error-add-category').css({"color": "red"}).html(errorMsg);
  553 + }
  554 + },
  555 + error: function (data) {
  556 + console.log(data);
  557 + $('#error-add-category').css({"color": "red"}).html(data.message);
  558 + }
  559 + });
  560 + });
  561 +
  562 + $('#uploadAddProductImg').live('change', function () {
  563 + if (!checkImage("uploadAddProductImg", 1024 * 1000)) {
  564 + return false;
  565 + }
  566 + //图片上传
  567 + $.ajaxFileUpload({
  568 + url: "/common/uploadCategoryIcon",
  569 + secureuri: false,
  570 + fileElementId: $(this),
  571 + dataType: 'json',
  572 + success: function (data) {
  573 + var errorMsg = null;
  574 + console.log(data);
  575 + if (data.success) {
  576 + $("#addProductIcon").attr("src", data.message);
  577 + } else {
  578 + errorMsg = result.message;
  579 + }
  580 + if (errorMsg) {
  581 + $('#error-add-product').css({"color": "red"}).html(errorMsg);
  582 + }
  583 + },
  584 + error: function (data) {
  585 + console.log(data);
  586 + $('#error-add-product').css({"color": "red"}).html(data.message);
  587 + }
  588 + });
  589 + });
  590 +
548 })(); 591 })();
549 592
550 593
551 -function resetCategoryData(){  
552 - var cateId = $("#categoryId").val();  
553 - $.ajax({  
554 - type : "post",  
555 - data : {id:cateId},  
556 - url : "/titan/category/edit",  
557 - dataType : "json",  
558 - success : function(data){  
559 - $("#categoryName").val(data.category.name);  
560 - $("#categoryAlias").val(data.category.alias);  
561 - if(data.isChild){  
562 - $("#categoryAlias").attr("disabled",true);  
563 - }else{  
564 - $("#categoryAlias").attr("disabled",false);  
565 - }  
566 - $("#parentCateName").val(data.parentName);  
567 - $("#categoryIcon").attr("src",data.category.icon);  
568 - if(data.seo != null && data.seo != ""){  
569 - $("#seo-title").val(data.seo.seoTitle);  
570 - $("#seo-keyword").val(data.seo.seoKeyword);  
571 - $("#seo-desc").val(data.seo.seoDesc);  
572 - }else{  
573 - $("#seo-title").val("");  
574 - $("#seo-keyword").val("");  
575 - $("#seo-desc").val("");  
576 - }  
577 - }  
578 - }); 594 +function resetCategoryData() {
  595 + var cateId = $("#categoryId").val();
  596 + $.ajax({
  597 + type: "post",
  598 + data: {id: cateId},
  599 + url: "/titan/category/edit",
  600 + dataType: "json",
  601 + success: function (data) {
  602 + $("#categoryName").val(data.category.name);
  603 + $("#categoryAlias").val(data.category.alias);
  604 + if (data.isChild) {
  605 + $("#categoryAlias").attr("disabled", true);
  606 + } else {
  607 + $("#categoryAlias").attr("disabled", false);
  608 + }
  609 + $("#parentCateName").val(data.parentName);
  610 + $("#categoryIcon").attr("src", data.category.icon);
  611 + if (data.seo != null && data.seo != "") {
  612 + $("#seo-title").val(data.seo.seoTitle);
  613 + $("#seo-keyword").val(data.seo.seoKeyword);
  614 + $("#seo-desc").val(data.seo.seoDesc);
  615 + } else {
  616 + $("#seo-title").val("");
  617 + $("#seo-keyword").val("");
  618 + $("#seo-desc").val("");
  619 + }
  620 + }
  621 + });
579 } 622 }
580 623
581 /** 624 /**
582 * 点击树节点,加载右侧数据 625 * 点击树节点,加载右侧数据
583 * @param node 626 * @param node
584 */ 627 */
585 -function initData(id){  
586 - if(id != 0){  
587 - $.ajax({  
588 - type : "post",  
589 - data : {id:id},  
590 - url : "/titan/category/edit",  
591 - dataType : "json",  
592 - success : function(data){  
593 - $("#showAttrBtonId").css("display", "block");  
594 - if(data.updateCategory == true){  
595 - $("#showCateInfoBtonId").css("display", "block");  
596 - }else{  
597 - $("#showCateInfoBtonId").css("display", "none");  
598 - }  
599 - if(data.updateCateSeo == true){  
600 - $("#showCateSeoBtonId").css("display", "block");  
601 - }else{  
602 - $("#showCateSeoBtonId").css("display", "none");  
603 - }  
604 - if(data.addAttribute == true){  
605 - $("#addCategoryAttrId").css("display", "");  
606 - }else{  
607 - $("#addCategoryAttrId").css("display", "none");  
608 - }  
609 - if(data.copyParentCateAttr == true){  
610 - $("#copyParentCateAttr").css("display", "");  
611 - }else{  
612 - $("#copyParentCateAttr").css("display", "none");  
613 - }  
614 - $("#cateSearchAttrList").html("");  
615 - $("#cateAttrList").html("");  
616 - $("#categoryName").val(data.category.name);  
617 - $("#categoryAlias").val(data.category.alias);  
618 - if(data.isChild){  
619 - $("#categoryAlias").attr("disabled",true);  
620 - }else{  
621 - $("#categoryAlias").attr("disabled",false);  
622 - }  
623 - $("#parentCateName").val(data.parentName);  
624 - $("#categoryId").val(data.category.id);  
625 - $("#categoryIcon").attr("src",data.category.icon);  
626 - if(data.seo != null && data.seo != ""){  
627 - $("#seo-title").val(data.seo.seoTitle);  
628 - $("#seo-keyword").val(data.seo.seoKeyword);  
629 - $("#seo-desc").val(data.seo.seoDesc);  
630 - }else{  
631 - $("#seo-title").val("");  
632 - $("#seo-keyword").val("");  
633 - $("#seo-desc").val("");  
634 - }  
635 - setCategoryAttrData(data);  
636 - setCategorySearchAttrData(data);  
637 - }  
638 - });  
639 -  
640 - }  
641 -} 628 +function initData(id) {
  629 + if (id != 0) {
  630 + $.ajax({
  631 + type: "post",
  632 + data: {id: id},
  633 + url: "/titan/category/edit",
  634 + dataType: "json",
  635 + success: function (data) {
  636 + $("#showAttrBtonId").css("display", "block");
  637 + if (data.updateCategory == true) {
  638 + $("#showCateInfoBtonId").css("display", "block");
  639 + } else {
  640 + $("#showCateInfoBtonId").css("display", "none");
  641 + }
  642 + if (data.updateCateSeo == true) {
  643 + $("#showCateSeoBtonId").css("display", "block");
  644 + } else {
  645 + $("#showCateSeoBtonId").css("display", "none");
  646 + }
  647 + if (data.addAttribute == true) {
  648 + $("#addCategoryAttrId").css("display", "");
  649 + } else {
  650 + $("#addCategoryAttrId").css("display", "none");
  651 + }
  652 + if (data.copyParentCateAttr == true) {
  653 + $("#copyParentCateAttr").css("display", "");
  654 + } else {
  655 + $("#copyParentCateAttr").css("display", "none");
  656 + }
  657 + $("#cateSearchAttrList").html("");
  658 + $("#cateAttrList").html("");
  659 + $("#categoryName").val(data.category.name);
  660 + $("#categoryAlias").val(data.category.alias);
  661 + if (data.isChild) {
  662 + $("#categoryAlias").attr("disabled", true);
  663 + } else {
  664 + $("#categoryAlias").attr("disabled", false);
  665 + }
  666 + $("#parentCateName").val(data.parentName);
  667 + $("#categoryId").val(data.category.id);
  668 + $("#categoryIcon").attr("src", data.category.icon);
  669 + if (data.seo != null && data.seo != "") {
  670 + $("#seo-title").val(data.seo.seoTitle);
  671 + $("#seo-keyword").val(data.seo.seoKeyword);
  672 + $("#seo-desc").val(data.seo.seoDesc);
  673 + } else {
  674 + $("#seo-title").val("");
  675 + $("#seo-keyword").val("");
  676 + $("#seo-desc").val("");
  677 + }
  678 + setCategoryAttrData(data);
  679 + setCategorySearchAttrData(data);
  680 + }
  681 + });
642 682
643 - /**  
644 - * 设置属性是否为搜索属性  
645 - * @param id  
646 - * @param flag  
647 - */  
648 - function setCateSearchAttr(id,cateId,attrId){  
649 - var isChecked = $("#cateAttrId"+id).attr("checked");  
650 - if(isChecked == "checked"){  
651 - flag = 1;  
652 - }else{  
653 - flag = 0;  
654 - }  
655 - $.ajax({  
656 - type : "post",  
657 - data : {id:id,cateId:cateId,attrId:attrId,searchable:flag},  
658 - url : "/titan/category/changeCateSearchAttr",  
659 - dataType : "json",  
660 - success : function(data){  
661 - if(data.success == false){  
662 - XUI.window.alert(data.msg);  
663 - }  
664 - }  
665 - });  
666 - }  
667 -  
668 - /**  
669 - * 搜索属性  
670 - * @param callback  
671 - */  
672 - function searchCateAttr(callback){  
673 - var keyword = $("#keyword-input").val();  
674 - var cateId = $("#categoryId").val();  
675 - if(!keyword){  
676 - keyword = "";  
677 - }  
678 - var attrs = new Array();  
679 - var attrSelect = $("#selAttrs li");  
680 - if(attrSelect != null && attrSelect.length >0){  
681 - $.each(attrSelect , function(i, n){  
682 - var li = $(n);  
683 - var temp = new Object();  
684 - var attrId = li.attr("attr-id");  
685 - temp.attrId = attrId;  
686 - attrs.push(JSON.stringify(temp));  
687 - });  
688 - } 683 + }
  684 +}
689 685
690 - $.ajax({  
691 - type : "post",  
692 - dataType : "json",  
693 - url : "/titan/attribute/searchByAjax",  
694 - data : {keyword : keyword,cateId:cateId,list:JSON.stringify(attrs)},  
695 - success : function(data){  
696 - if(data.success == false){  
697 - XUI.window.alert(data.msg);  
698 - }  
699 - $("#allAttrs").html("");  
700 - if(data.list != null && data.list != "" && data.list.length >0){  
701 - for(var i=0;i<data.list.length;i++){  
702 - var li = "<li attr-id="+data.list[i].id+"><span class='inline'>"+data.list[i].show+"</span></li>";  
703 - $("#allAttrs").append(li);  
704 - //var temp ="<option attr-id="+n.id+" dealtype="+ n.dealType+ " attrtypeId="+ n.attrTypeId+" title=\""+ n.show +"\">" + n.show + "</option>";  
705 - }  
706 - if(data.success){  
707 - if(data.success == false){  
708 - XUI.window.alert(data.msg);  
709 - }  
710 - if(callback){  
711 - callback();  
712 - }  
713 - }else{  
714 - XUI.window.alert(data.msg);  
715 - }  
716 - }  
717 - },  
718 - error : function(){  
719 - XUI.window.alert("网络错误,请稍后重试");  
720 - }  
721 - }); 686 +/**
  687 + * 设置属性是否为搜索属性
  688 + * @param id
  689 + * @param flag
  690 + */
  691 +function setCateSearchAttr(id, cateId, attrId) {
  692 + var isChecked = $("#cateAttrId" + id).attr("checked");
  693 + if (isChecked == "checked") {
  694 + flag = 1;
  695 + } else {
  696 + flag = 0;
722 } 697 }
723 -  
724 - /**  
725 - * 搜索属性  
726 - */  
727 - $(document).ready(function(){  
728 - $(".btn-addAttr").click(function(){  
729 - $("#allAttrs").html("");  
730 - $("#selAttrs").html("");  
731 - $("#keyword-input").val("");  
732 - searchCateAttr(function(){  
733 - $("#btn-spanlink").fancybox({  
734 - helpers: {  
735 - overlay: {  
736 - closeClick: false  
737 - }  
738 - }  
739 - });  
740 - $("#btn-spanlink").click();  
741 - });  
742 - });  
743 - $("#search-attr").click(function(){  
744 - searchCateAttr();  
745 - });  
746 -  
747 - $("#delCategoryAttrOk").live({click: function(){  
748 - var attrId = $(this).attr("attrId");  
749 - var flag = $(this).attr("flag");  
750 - var cateId = $("#categoryId").val();  
751 - if(attrId == "" || attrId == null){  
752 - alert("传入的属性ID为空!");  
753 - return false;  
754 - }  
755 - if(cateId == "" || cateId == null){  
756 - alert("传入的类目ID为空!");  
757 - return false;  
758 - }  
759 - $(this).attr("attrId","");  
760 - $(this).attr("flag","");  
761 - $.ajax({  
762 - type : "post",  
763 - data : {cateId:cateId,attrId:attrId,flag:flag},  
764 - url : "/titan/category/delCategoryAttr",  
765 - dataType : "json",  
766 - success : function(data){  
767 - if(data.success == false){  
768 - XUI.window.alert(data.msg);  
769 - }else{  
770 - if(flag == 1){  
771 - getCategoryAttr();  
772 - }else if(flag == 2){  
773 - getCategorySearchAttr();  
774 - }  
775 - }  
776 - }  
777 - });  
778 - $.fancybox.close();  
779 - }  
780 - }); 698 + $.ajax({
  699 + type: "post",
  700 + data: {id: id, cateId: cateId, attrId: attrId, searchable: flag},
  701 + url: "/titan/category/changeCateSearchAttr",
  702 + dataType: "json",
  703 + success: function (data) {
  704 + if (data.success == false) {
  705 + XUI.window.alert(data.msg);
  706 + }
  707 + }
781 }); 708 });
782 -  
783 -  
784 - /**  
785 - * 取消添加属性  
786 - */  
787 - function cancelAddAttr(){  
788 - $("#allAttrs").html("");  
789 - $("#selAttrs").html("");  
790 - $("#keyword-input").val("");  
791 - $.fancybox.close(); 709 +}
  710 +
  711 +/**
  712 + * 搜索属性
  713 + * @param callback
  714 + */
  715 +function searchCateAttr(callback) {
  716 + var keyword = $("#keyword-input").val();
  717 + var cateId = $("#categoryId").val();
  718 + if (!keyword) {
  719 + keyword = "";
792 } 720 }
793 -  
794 - /**  
795 - * 删除分类属性 721 + var attrs = new Array();
  722 + var attrSelect = $("#selAttrs li");
  723 + if (attrSelect != null && attrSelect.length > 0) {
  724 + $.each(attrSelect, function (i, n) {
  725 + var li = $(n);
  726 + var temp = new Object();
  727 + var attrId = li.attr("attr-id");
  728 + temp.attrId = attrId;
  729 + attrs.push(JSON.stringify(temp));
  730 + });
  731 + }
  732 +
  733 + $.ajax({
  734 + type: "post",
  735 + dataType: "json",
  736 + url: "/titan/attribute/searchByAjax",
  737 + data: {keyword: keyword, cateId: cateId, list: JSON.stringify(attrs)},
  738 + success: function (data) {
  739 + if (data.success == false) {
  740 + XUI.window.alert(data.msg);
  741 + }
  742 + $("#allAttrs").html("");
  743 + if (data.list != null && data.list != "" && data.list.length > 0) {
  744 + for (var i = 0; i < data.list.length; i++) {
  745 + var li = "<li attr-id=" + data.list[i].id + "><span class='inline'>" + data.list[i].show + "</span></li>";
  746 + $("#allAttrs").append(li);
  747 + //var temp ="<option attr-id="+n.id+" dealtype="+ n.dealType+ " attrtypeId="+ n.attrTypeId+" title=\""+ n.show +"\">" + n.show + "</option>";
  748 + }
  749 + if (data.success) {
  750 + if (data.success == false) {
  751 + XUI.window.alert(data.msg);
  752 + }
  753 + if (callback) {
  754 + callback();
  755 + }
  756 + } else {
  757 + XUI.window.alert(data.msg);
  758 + }
  759 + }
  760 + },
  761 + error: function () {
  762 + XUI.window.alert("网络错误,请稍后重试");
  763 + }
  764 + });
  765 +}
  766 +
  767 +/**
  768 + * 搜索属性
  769 + */
  770 +$(document).ready(function () {
  771 + $(".btn-addAttr").click(function () {
  772 + $("#allAttrs").html("");
  773 + $("#selAttrs").html("");
  774 + $("#keyword-input").val("");
  775 + searchCateAttr(function () {
  776 + $("#btn-spanlink").fancybox({
  777 + helpers: {
  778 + overlay: {
  779 + closeClick: false
  780 + }
  781 + }
  782 + });
  783 + $("#btn-spanlink").click();
  784 + });
  785 + });
  786 + $("#search-attr").click(function () {
  787 + searchCateAttr();
  788 + });
  789 +
  790 + $("#delCategoryAttrOk").live({
  791 + click: function () {
  792 + var attrId = $(this).attr("attrId");
  793 + var flag = $(this).attr("flag");
  794 + var cateId = $("#categoryId").val();
  795 + if (attrId == "" || attrId == null) {
  796 + alert("传入的属性ID为空!");
  797 + return false;
  798 + }
  799 + if (cateId == "" || cateId == null) {
  800 + alert("传入的类目ID为空!");
  801 + return false;
  802 + }
  803 + $(this).attr("attrId", "");
  804 + $(this).attr("flag", "");
  805 + $.ajax({
  806 + type: "post",
  807 + data: {cateId: cateId, attrId: attrId, flag: flag},
  808 + url: "/titan/category/delCategoryAttr",
  809 + dataType: "json",
  810 + success: function (data) {
  811 + if (data.success == false) {
  812 + XUI.window.alert(data.msg);
  813 + } else {
  814 + if (flag == 1) {
  815 + getCategoryAttr();
  816 + } else if (flag == 2) {
  817 + getCategorySearchAttr();
  818 + }
  819 + }
  820 + }
  821 + });
  822 + $.fancybox.close();
  823 + }
  824 + });
  825 +});
  826 +
  827 +
  828 +/**
  829 + * 取消添加属性
  830 + */
  831 +function cancelAddAttr() {
  832 + $("#allAttrs").html("");
  833 + $("#selAttrs").html("");
  834 + $("#keyword-input").val("");
  835 + $.fancybox.close();
  836 +}
  837 +
  838 +/**
  839 + * 删除分类属性
796 * @param id 840 * @param id
797 */ 841 */
798 -function delCateAttr(attrId){  
799 - $(".showDialog").fancybox({  
800 - helpers: {  
801 - overlay: {  
802 - closeClick: false  
803 - }  
804 - },  
805 - content: $(".fancy-close")[0].outerHTML,  
806 - beforeShow: function(){  
807 - $(".fancybox-wrap .fancy-close").show();  
808 - $(".close-ensure").attr('attrId',attrId);  
809 - $(".close-ensure").attr('flag',1);  
810 - }  
811 - });  
812 - }  
813 -  
814 - /**  
815 - * 删除分类搜索属性  
816 - * @param id  
817 - */  
818 - function delCateSearchAttr(attrId){  
819 - $(".showDialog").fancybox({  
820 - helpers: {  
821 - overlay: {  
822 - closeClick: false  
823 - }  
824 - },  
825 - content: $(".fancy-close")[0].outerHTML,  
826 - beforeShow: function(){  
827 - $(".fancybox-wrap .fancy-close").show();  
828 - $(".close-ensure").attr('attrId',attrId);  
829 - $(".close-ensure").attr('flag',2);  
830 - }  
831 - });  
832 - }  
833 -  
834 - /**  
835 - * 添加属性  
836 - */  
837 - function btnAddAttr(){  
838 - var cateId = $("#categoryId").val();  
839 - var attrs = new Array();  
840 - var attrSelect = $("#selAttrs li");  
841 - if(attrSelect == null || attrSelect.length ==0){  
842 - XUI.window.alert("请选择需要添加的属性!");  
843 - return;  
844 - }  
845 - $.each(attrSelect , function(i, n){  
846 - var li = $(n);  
847 - var temp = new Object();  
848 - var attrId = li.attr("attr-id");  
849 - temp.attrId = attrId;  
850 - temp.searchable = 0;  
851 - attrs.push(JSON.stringify(temp));  
852 - });  
853 - $.ajax({  
854 - type : "post",  
855 - data : {cateId:cateId,list:JSON.stringify(attrs)},  
856 - url : "/titan/category/addCategoryAttr",  
857 - dataType : "json",  
858 - success : function(data){  
859 - if(data.success == false){  
860 - XUI.window.alert(data.msg);  
861 - }else{  
862 - cancelAddAttr();  
863 - getCategoryAttr();  
864 - }  
865 - }  
866 - }); 842 +function delCateAttr(attrId) {
  843 + $(".showDialog").fancybox({
  844 + helpers: {
  845 + overlay: {
  846 + closeClick: false
  847 + }
  848 + },
  849 + content: $(".fancy-close")[0].outerHTML,
  850 + beforeShow: function () {
  851 + $(".fancybox-wrap .fancy-close").show();
  852 + $(".close-ensure").attr('attrId', attrId);
  853 + $(".close-ensure").attr('flag', 1);
  854 + }
  855 + });
  856 +}
  857 +
  858 +/**
  859 + * 删除分类搜索属性
  860 + * @param id
  861 + */
  862 +function delCateSearchAttr(attrId) {
  863 + $(".showDialog").fancybox({
  864 + helpers: {
  865 + overlay: {
  866 + closeClick: false
  867 + }
  868 + },
  869 + content: $(".fancy-close")[0].outerHTML,
  870 + beforeShow: function () {
  871 + $(".fancybox-wrap .fancy-close").show();
  872 + $(".close-ensure").attr('attrId', attrId);
  873 + $(".close-ensure").attr('flag', 2);
  874 + }
  875 + });
  876 +}
  877 +
  878 +/**
  879 + * 添加属性
  880 + */
  881 +function btnAddAttr() {
  882 + var cateId = $("#categoryId").val();
  883 + var attrs = new Array();
  884 + var attrSelect = $("#selAttrs li");
  885 + if (attrSelect == null || attrSelect.length == 0) {
  886 + XUI.window.alert("请选择需要添加的属性!");
  887 + return;
  888 + }
  889 + $.each(attrSelect, function (i, n) {
  890 + var li = $(n);
  891 + var temp = new Object();
  892 + var attrId = li.attr("attr-id");
  893 + temp.attrId = attrId;
  894 + temp.searchable = 0;
  895 + attrs.push(JSON.stringify(temp));
  896 + });
  897 + $.ajax({
  898 + type: "post",
  899 + data: {cateId: cateId, list: JSON.stringify(attrs)},
  900 + url: "/titan/category/addCategoryAttr",
  901 + dataType: "json",
  902 + success: function (data) {
  903 + if (data.success == false) {
  904 + XUI.window.alert(data.msg);
  905 + } else {
  906 + cancelAddAttr();
  907 + getCategoryAttr();
  908 + }
  909 + }
  910 + });
  911 +}
  912 +
  913 +/**
  914 + * 获取类目属性
  915 + */
  916 +function getCategoryAttr() {
  917 + var cateId = $("#categoryId").val();
  918 + $.ajax({
  919 + type: "post",
  920 + data: {cateId: cateId},
  921 + url: "/titan/category/getCategoryAttr",
  922 + dataType: "json",
  923 + success: function (data) {
  924 + if (data.success == false) {
  925 + XUI.window.alert(data.msg);
  926 + } else {
  927 + setCategoryAttrData(data);
  928 + }
  929 + }
  930 + });
  931 +}
  932 +
  933 +/**
  934 + * 获取类目搜索属性
  935 + */
  936 +function getCategorySearchAttr() {
  937 + var cateId = $("#categoryId").val();
  938 + $.ajax({
  939 + type: "post",
  940 + data: {cateId: cateId},
  941 + url: "/titan/category/getCategorySearchAttr",
  942 + dataType: "json",
  943 + success: function (data) {
  944 + if (data.success == false) {
  945 + alert(data.msg);
  946 + } else {
  947 + setCategorySearchAttrData(data);
  948 + }
  949 + }
  950 + });
  951 +}
  952 +
  953 +/**
  954 + * 分类属性排序
  955 + * @param attrId
  956 + * @param operation
  957 + */
  958 +function changeCateAttrOrder(attrId, operation, flag) {
  959 + var cateId = $("#categoryId").val();
  960 + if (attrId == "" || attrId == null) {
  961 + alert("传入的属性ID为空!");
  962 + return false;
867 } 963 }
868 -  
869 - /**  
870 - * 获取类目属性  
871 - */  
872 - function getCategoryAttr(){  
873 - var cateId = $("#categoryId").val();  
874 - $.ajax({  
875 - type : "post",  
876 - data : {cateId:cateId},  
877 - url : "/titan/category/getCategoryAttr",  
878 - dataType : "json",  
879 - success : function(data){  
880 - if(data.success == false){  
881 - XUI.window.alert(data.msg);  
882 - }else{  
883 - setCategoryAttrData(data);  
884 - }  
885 - }  
886 - }); 964 + if (cateId == "" || cateId == null) {
  965 + alert("传入的类目ID为空!");
  966 + return false;
887 } 967 }
888 -  
889 - /**  
890 - * 获取类目搜索属性  
891 - */  
892 - function getCategorySearchAttr(){  
893 - var cateId = $("#categoryId").val();  
894 - $.ajax({  
895 - type : "post",  
896 - data : {cateId:cateId},  
897 - url : "/titan/category/getCategorySearchAttr",  
898 - dataType : "json",  
899 - success : function(data){  
900 - if(data.success == false){  
901 - alert(data.msg);  
902 - }else{  
903 - setCategorySearchAttrData(data);  
904 - }  
905 - }  
906 - });  
907 - }  
908 -  
909 - /**  
910 - * 分类属性排序  
911 - * @param attrId  
912 - * @param operation  
913 - */  
914 - function changeCateAttrOrder(attrId,operation,flag){  
915 - var cateId = $("#categoryId").val();  
916 - if(attrId == "" || attrId == null){  
917 - alert("传入的属性ID为空!");  
918 - return false;  
919 - }  
920 - if(cateId == "" || cateId == null){  
921 - alert("传入的类目ID为空!");  
922 - return false;  
923 - }  
924 - $.ajax({  
925 - type : "post",  
926 - data : {cateId:cateId,attrId:attrId,operation:operation,flag:flag},  
927 - url : "/titan/category/changeCateAtrOrder",  
928 - dataType : "json",  
929 - success : function(data){  
930 - if(data.success == false){  
931 - XUI.window.alert(data.msg);  
932 - }else{  
933 - if(flag == 1){  
934 - getCategoryAttr();  
935 - }else if(flag == 2){  
936 - getCategorySearchAttr();  
937 - }  
938 - }  
939 - }  
940 - });  
941 - }  
942 -  
943 - /**  
944 - * 复制父级分类属性  
945 - * @param attrId  
946 - * @param operation  
947 - */  
948 - function copyParentCategoryAttr(){  
949 - var cateId = $("#categoryId").val();  
950 - if(cateId == "" || cateId == null){  
951 - alert("传入的类目ID为空!");  
952 - return false;  
953 - }  
954 - $.ajax({  
955 - type : "post",  
956 - data : {cateId:cateId},  
957 - url : "/titan/category/copyParentCategoryAttr",  
958 - dataType : "json",  
959 - success : function(data){  
960 - if(data.success == false){  
961 - XUI.window.alert(data.msg);  
962 - }else{  
963 - getCategoryAttr();  
964 - //getCategorySearchAttr();  
965 - }  
966 - }  
967 - });  
968 - }  
969 -  
970 - function addCategoryData(){  
971 - var name = $("input[name='add-cate-name']").val();  
972 - if(name!=""){  
973 - name = name.replace(/(^\s*)|(\s*$)/g, ""); 968 + $.ajax({
  969 + type: "post",
  970 + data: {cateId: cateId, attrId: attrId, operation: operation, flag: flag},
  971 + url: "/titan/category/changeCateAtrOrder",
  972 + dataType: "json",
  973 + success: function (data) {
  974 + if (data.success == false) {
  975 + XUI.window.alert(data.msg);
  976 + } else {
  977 + if (flag == 1) {
  978 + getCategoryAttr();
  979 + } else if (flag == 2) {
  980 + getCategorySearchAttr();
  981 + }
  982 + }
974 } 983 }
975 - if(name.length > 20){  
976 - XUI.window.alert("分类名字长度不能超过20个字符!");  
977 - return false;  
978 - }  
979 - var alias = $("input[name='add-cate-alias']").val();  
980 - if(alias!=""){  
981 - alias = alias.replace(/(^\s*)|(\s*$)/g, "").replaceAll(",",","); 984 + });
  985 +}
  986 +
  987 +/**
  988 + * 复制父级分类属性
  989 + * @param attrId
  990 + * @param operation
  991 + */
  992 +function copyParentCategoryAttr() {
  993 + var cateId = $("#categoryId").val();
  994 + if (cateId == "" || cateId == null) {
  995 + alert("传入的类目ID为空!");
  996 + return false;
  997 + }
  998 + $.ajax({
  999 + type: "post",
  1000 + data: {cateId: cateId},
  1001 + url: "/titan/category/copyParentCategoryAttr",
  1002 + dataType: "json",
  1003 + success: function (data) {
  1004 + if (data.success == false) {
  1005 + XUI.window.alert(data.msg);
  1006 + } else {
  1007 + getCategoryAttr();
  1008 + //getCategorySearchAttr();
  1009 + }
982 } 1010 }
983 - if(alias.length > 100){  
984 - XUI.window.alert("分类别名长度不能超过100个字符!");  
985 - return false;  
986 - }  
987 - var icon = $("#addCategoryIcon").attr("src");  
988 - if(icon==""){  
989 - XUI.window.alert("分类图标必须上传!");  
990 - return false; 1011 + });
  1012 +}
  1013 +
  1014 +function addCategoryData() {
  1015 + var name = $("input[name='add-cate-name']").val();
  1016 + if (name != "") {
  1017 + name = name.replace(/(^\s*)|(\s*$)/g, "");
  1018 + }
  1019 + if (name.length > 20) {
  1020 + XUI.window.alert("分类名字长度不能超过20个字符!");
  1021 + return false;
  1022 + }
  1023 + var alias = $("input[name='add-cate-alias']").val();
  1024 + if (alias != "") {
  1025 + alias = alias.replace(/(^\s*)|(\s*$)/g, "").replaceAll(",", ",");
  1026 + }
  1027 + if (alias.length > 100) {
  1028 + XUI.window.alert("分类别名长度不能超过100个字符!");
  1029 + return false;
  1030 + }
  1031 + var icon = $("#addCategoryIcon").attr("src");
  1032 +
  1033 + var img = $("#addProductIcon").attr("src");
  1034 + if (icon == "") {
  1035 + XUI.window.alert("分类图标必须上传!");
  1036 + return false;
  1037 + }
  1038 + var regex = /^[0-9a-zA-Z\u4e00-\u9fa5/()()&《》【】\+=\]\[]+$/g;
  1039 + var message = "请输入合法的分类名称(中文汉字、英文字母(含大小写)、数字、“/,(),&,《》,【】,[],=,+”)";
  1040 + var message1 = "请输入合法的分类别名(中文汉字、英文字母(含大小写)、数字、“/,(),&,《》,【】,[],=,+”)";
  1041 + var regex1 = /^[0-9a-zA-Z\u4e00-\u9fa5/()()&《》【】\+=\]\[,]+$/g;
  1042 + if (name == "" || !regex.test(name)) {
  1043 + XUI.window.alert(message);
  1044 + return false;
  1045 + }
  1046 + if (alias != "" && !regex1.test(alias)) {
  1047 + XUI.window.alert(message1);
  1048 + return false;
  1049 + }
  1050 + var desc = $("#c_desc").val();
  1051 + if (desc.length > 200) {
  1052 + XUI.window.alert("描述长度不能超过200个字符!");
  1053 + return false;
  1054 + }
  1055 + var id = $("input[name='firstFlag']").val();
  1056 + var use = $("#use").is(':checked');
  1057 +
  1058 + $.ajax({
  1059 + type: "put",
  1060 + dataType: "json",
  1061 + url: "/titan/category/add",
  1062 + data: {
  1063 + name: name,
  1064 + alias: alias,
  1065 + parent: id,
  1066 + icon: icon,
  1067 + productImg: img,
  1068 + note: desc,
  1069 + use: use
  1070 + },
  1071 + success: function (data) {
  1072 + console.log(data);
  1073 + if (data) {
  1074 + if (data.success) {
  1075 + window.location.href = "/titan/category";
  1076 + } else {
  1077 + alert(data.msg);
  1078 + }
  1079 + }
  1080 + },
  1081 + error: function () {
  1082 + alert("网络错误,请稍后重试");
991 } 1083 }
992 - var regex=/^[0-9a-zA-Z\u4e00-\u9fa5/()()&《》【】\+=\]\[]+$/g;  
993 - var message="请输入合法的分类名称(中文汉字、英文字母(含大小写)、数字、“/,(),&,《》,【】,[],=,+”)";  
994 - var message1="请输入合法的分类别名(中文汉字、英文字母(含大小写)、数字、“/,(),&,《》,【】,[],=,+”)";  
995 - var regex1=/^[0-9a-zA-Z\u4e00-\u9fa5/()()&《》【】\+=\]\[,]+$/g;  
996 - if (name=="" || !regex.test(name)) {  
997 - XUI.window.alert(message);  
998 - return false;  
999 - }  
1000 - if (alias!=""&&!regex1.test(alias)) {  
1001 - XUI.window.alert(message1);  
1002 - return false; 1084 + });
  1085 +}
  1086 +
  1087 +function setCategoryAttrData(result) {
  1088 + var data = result.attrs;
  1089 + $("#cateAttrList").html("");
  1090 + if (data != null && data != "" && data.length > 0) {
  1091 + for (var i = 0; i < data.length; i++) {
  1092 + var isSearch = data[i].searchable == 1 ? "checked='checked'" : "";
  1093 + var isDisable = "";
  1094 + if ("复选框" == data[i].inputTypeText) {
  1095 + isDisable = "";
  1096 + } else {
  1097 + isDisable = "disabled";
  1098 + }
  1099 + var tr = "<tr><td>" + data[i].name + "</td><td>" + data[i].requiredText + "</td><td>";
  1100 + if (result.setCateSearchAttr == true) {
  1101 + if (isDisable == "") {
  1102 + tr = tr + "<input type='checkbox' " + isDisable + " " + isSearch + " id='cateAttrId" + data[i].id + "' onClick='setCateSearchAttr(" + data[i].id + "," + data[i].catId + "," + data[i].attrId + ")'/>";
  1103 + } else {
  1104 + tr = tr + "-";
  1105 + }
  1106 + } else if (data[i].searchable == 1) {
  1107 + tr = tr + "是";
  1108 + } else {
  1109 + tr = tr + "否";
  1110 + }
  1111 + tr = tr + "</td><td>" + data[i].inputTypeText + "</td><td>" + data[i].attrTypeText + "</td><td>";
  1112 + if (result.deleteCateAttr == true) {
  1113 + tr = tr + " <a class='backLink showDialog' onClick=delCateAttr(" + data[i].attrId + ") attrId='" + data[i].attrId + "'>删除</a>";
  1114 + }
  1115 + if (result.CateAttrOrder == true) {
  1116 + tr = tr + "<span class='downarrow' style='margin-left:5px' onClick=changeCateAttrOrder(" + data[i].attrId + ",'down',1) ></span> <span class='uparrow' onClick=changeCateAttrOrder(" + data[i].attrId + ",'up',1)></span>";
  1117 + }
  1118 + tr = tr + "</td></tr>";
  1119 + $("#cateAttrList").append(tr);
1003 } 1120 }
1004 - var id = $("input[name='firstFlag']").val();  
1005 - $.ajax({  
1006 - type : "put",  
1007 - dataType : "json",  
1008 - url : "/titan/category/add",  
1009 - data : {  
1010 - name : name,  
1011 - alias : alias,  
1012 - parent : id,  
1013 - icon :icon  
1014 - },  
1015 - success : function(data){  
1016 - console.log(data);  
1017 - if(data){  
1018 - if(data.success){  
1019 - window.location.href = "/titan/category";  
1020 - }else{  
1021 - alert(data.msg);  
1022 - }  
1023 - }  
1024 - },  
1025 - error : function(){  
1026 - alert("网络错误,请稍后重试");  
1027 - }  
1028 - });  
1029 - }  
1030 -  
1031 - function setCategoryAttrData(result){  
1032 - var data = result.attrs;  
1033 - $("#cateAttrList").html("");  
1034 - if(data != null && data != "" && data.length >0){  
1035 - for(var i=0;i<data.length;i++){  
1036 - var isSearch = data[i].searchable == 1 ? "checked='checked'" : "";  
1037 - var isDisable = "";  
1038 - if("复选框" == data[i].inputTypeText){  
1039 - isDisable = "";  
1040 - }else{  
1041 - isDisable = "disabled";  
1042 - }  
1043 - var tr = "<tr><td>"+data[i].name+"</td><td>"+data[i].requiredText+"</td><td>";  
1044 - if(result.setCateSearchAttr == true){  
1045 - if(isDisable == ""){  
1046 - tr = tr +"<input type='checkbox' "+isDisable+" "+isSearch+" id='cateAttrId"+data[i].id+"' onClick='setCateSearchAttr("+data[i].id+","+data[i].catId+","+data[i].attrId+")'/>";  
1047 - }else{  
1048 - tr = tr +"-";  
1049 - }  
1050 - }else if(data[i].searchable == 1){  
1051 - tr = tr +"是";  
1052 - }else{  
1053 - tr = tr +"否";  
1054 - }  
1055 - tr =tr + "</td><td>"+data[i].inputTypeText+"</td><td>"+data[i].attrTypeText+"</td><td>";  
1056 - if(result.deleteCateAttr == true){  
1057 - tr = tr + " <a class='backLink showDialog' onClick=delCateAttr("+data[i].attrId+") attrId='"+data[i].attrId+"'>删除</a>";  
1058 - }  
1059 - if(result.CateAttrOrder == true){  
1060 - tr = tr + "<span class='downarrow' style='margin-left:5px' onClick=changeCateAttrOrder("+data[i].attrId+",'down',1) ></span> <span class='uparrow' onClick=changeCateAttrOrder("+data[i].attrId+",'up',1)></span>";  
1061 - }  
1062 - tr = tr + "</td></tr>";  
1063 - $("#cateAttrList").append(tr);  
1064 - }  
1065 - }  
1066 - }  
1067 -  
1068 - function setCategorySearchAttrData(result){  
1069 - var data = result.searchable;  
1070 - $("#cateSearchAttrList").html("");  
1071 - if(data != null && data != "" && data.length >0){  
1072 - for(var i=0;i<data.length;i++){  
1073 - var tr = "<tr><td>"+data[i].name+"</td><td>"+data[i].requiredText+"</td>" +  
1074 - "<td>"+data[i].inputTypeText+"</td><td>"+data[i].attrTypeText+"</td><td>";  
1075 - if(result.deleteCateAttr == true){  
1076 - tr = tr + "<a class='backLink showDialog' style='margin-right: 5px;' onClick=delCateSearchAttr("+data[i].attrId+") attrId='"+data[i].attrId+"' id='delCateSearchAttr'>删除</a>";  
1077 - }  
1078 - if(result.CateAttrOrder == true){  
1079 - tr = tr + "<span class='downarrow' onClick=changeCateAttrOrder("+data[i].attrId+",'down',2)></span> <span class='uparrow' onClick=changeCateAttrOrder("+data[i].attrId+",'up',2)></span>";  
1080 - }  
1081 - tr = tr +"</td></tr>";  
1082 - $("#cateSearchAttrList").append(tr);  
1083 - }  
1084 - }  
1085 - } 1121 + }
  1122 +}
  1123 +
  1124 +function setCategorySearchAttrData(result) {
  1125 + var data = result.searchable;
  1126 + $("#cateSearchAttrList").html("");
  1127 + if (data != null && data != "" && data.length > 0) {
  1128 + for (var i = 0; i < data.length; i++) {
  1129 + var tr = "<tr><td>" + data[i].name + "</td><td>" + data[i].requiredText + "</td>" +
  1130 + "<td>" + data[i].inputTypeText + "</td><td>" + data[i].attrTypeText + "</td><td>";
  1131 + if (result.deleteCateAttr == true) {
  1132 + tr = tr + "<a class='backLink showDialog' style='margin-right: 5px;' onClick=delCateSearchAttr(" + data[i].attrId + ") attrId='" + data[i].attrId + "' id='delCateSearchAttr'>删除</a>";
  1133 + }
  1134 + if (result.CateAttrOrder == true) {
  1135 + tr = tr + "<span class='downarrow' onClick=changeCateAttrOrder(" + data[i].attrId + ",'down',2)></span> <span class='uparrow' onClick=changeCateAttrOrder(" + data[i].attrId + ",'up',2)></span>";
  1136 + }
  1137 + tr = tr + "</td></tr>";
  1138 + $("#cateSearchAttrList").append(tr);
  1139 + }
  1140 + }
  1141 +}
1086 1142
1087 1143
1088 \ No newline at end of file 1144 \ No newline at end of file
titan-worker/src/main/resources/sqlmap/Presale.xml renamed to titan-worker/src/main/resources/com/diligrp/titan/dao/sqlmap/Presale.xml
titan-worker/src/main/resources/sqlmap/ProductAuth.xml renamed to titan-worker/src/main/resources/com/diligrp/titan/dao/sqlmap/ProductAuth.xml
titan-worker/src/main/resources/sqlmap/ProductPop.xml renamed to titan-worker/src/main/resources/com/diligrp/titan/dao/sqlmap/ProductPop.xml
titan-worker/src/main/resources/sqlmap/Purchase.xml renamed to titan-worker/src/main/resources/com/diligrp/titan/dao/sqlmap/Purchase.xml
titan-worker/src/main/resources/sqlmap/Supply.xml renamed to titan-worker/src/main/resources/com/diligrp/titan/dao/sqlmap/Supply.xml
titan-worker/src/main/resources/sqlmap/Video.xml renamed to titan-worker/src/main/resources/com/diligrp/titan/dao/sqlmap/Video.xml
titan-worker/src/main/resources/sqlmap/sqlmap-config.xml renamed to titan-worker/src/main/resources/com/diligrp/titan/dao/sqlmap/sqlmap-config.xml
@@ -20,12 +20,12 @@ @@ -20,12 +20,12 @@
20 </typeAliases> 20 </typeAliases>
21 21
22 <mappers> 22 <mappers>
23 - <mapper resource="sqlmap/ProductPop.xml" />  
24 - <mapper resource="sqlmap/ProductAuth.xml" />  
25 - <mapper resource="sqlmap/Purchase.xml" />  
26 - <mapper resource="sqlmap/Supply.xml" />  
27 - <mapper resource="sqlmap/Presale.xml" />  
28 - <mapper resource="sqlmap/Video.xml"/> 23 + <mapper resource="com.diligrp.titan.dao.sqlmap/ProductPop.xml" />
  24 + <mapper resource="com.diligrp.titan.dao.sqlmap/ProductAuth.xml" />
  25 + <mapper resource="com.diligrp.titan.dao.sqlmap/Purchase.xml" />
  26 + <mapper resource="com.diligrp.titan.dao.sqlmap/Supply.xml" />
  27 + <mapper resource="com.diligrp.titan.dao.sqlmap/Presale.xml" />
  28 + <mapper resource="com.diligrp.titan.dao.sqlmap/Video.xml"/>
29 </mappers> 29 </mappers>
30 30
31 </configuration> 31 </configuration>
32 \ No newline at end of file 32 \ No newline at end of file
titan-worker/src/main/resources/spring-config-dao.xml
@@ -51,7 +51,7 @@ @@ -51,7 +51,7 @@
51 </bean> 51 </bean>
52 <bean id="sessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean"> 52 <bean id="sessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
53 <property name="dataSource" ref="masterDataSource" /> 53 <property name="dataSource" ref="masterDataSource" />
54 - <property name="configLocation" value="classpath:sqlmap/sqlmap-config.xml" /> 54 + <property name="configLocation" value="classpath:com.diligrp.titan.dao.sqlmap/com.diligrp.titan.dao.sqlmap-config.xml" />
55 </bean> 55 </bean>
56 56
57 <bean id="sqlTemplate" class="org.mybatis.spring.SqlSessionTemplate"> 57 <bean id="sqlTemplate" class="org.mybatis.spring.SqlSessionTemplate">