Commit c873388d8b2fc49895125381b17468c8d77a3809
1 parent
c4b9cba1
初始化工程
Showing
72 changed files
with
4439 additions
and
0 deletions
Too many changes to show.
To preserve performance only 72 of 174 files are displayed.
mobsite-man-dao/pom.xml
0 → 100644
1 | +<?xml version="1.0"?> | |
2 | +<project | |
3 | + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" | |
4 | + xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | |
5 | + <modelVersion>4.0.0</modelVersion> | |
6 | + <parent> | |
7 | + <groupId>com.diligrp.mobsite</groupId> | |
8 | + <artifactId>mobsite-man</artifactId> | |
9 | + <version>0.0.1-SNAPSHOT</version> | |
10 | + </parent> | |
11 | + <artifactId>mobsite-man-dao</artifactId> | |
12 | + <name>mobsite-man-dao</name> | |
13 | + <url>http://maven.apache.org</url> | |
14 | + <properties> | |
15 | + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | |
16 | + </properties> | |
17 | + <dependencies> | |
18 | + <dependency> | |
19 | + <groupId>com.diligrp.mobsite</groupId> | |
20 | + <artifactId>mobsite-man-domain</artifactId> | |
21 | + <version>0.0.1-SNAPSHOT</version> | |
22 | + </dependency> | |
23 | + <dependency> | |
24 | + <groupId>com.diligrp.mobsite</groupId> | |
25 | + <artifactId>mobsite-getway-domain</artifactId> | |
26 | + <version>0.0.1-SNAPSHOT</version> | |
27 | + </dependency> | |
28 | + </dependencies> | |
29 | +</project> | ... | ... |
mobsite-man-dao/src/main/java/com/diligrp/mobsite/man/dao/AppPatchDao.java
0 → 100644
mobsite-man-dao/src/main/java/com/diligrp/mobsite/man/dao/AppVersionDao.java
0 → 100644
1 | +package com.diligrp.mobsite.man.dao; | |
2 | + | |
3 | +import com.diligrp.mobsite.man.domain.AppVersion; | |
4 | +import com.diligrp.website.util.dao.BaseQuery; | |
5 | +import com.diligrp.website.util.dao.IBaseDao; | |
6 | + | |
7 | + | |
8 | +/** | |
9 | + * | |
10 | + * @ClassName: AppVersionDao | |
11 | + * @Description: | |
12 | + * @author zhangshirui | |
13 | + * @date 2014年8月8日 下午2:10:18 | |
14 | + */ | |
15 | +public interface AppVersionDao extends IBaseDao<AppVersion> { | |
16 | + | |
17 | + void unActiveByDeviceType(Integer deviceType); | |
18 | +} | |
0 | 19 | \ No newline at end of file | ... | ... |
mobsite-man-dao/src/main/java/com/diligrp/mobsite/man/dao/DemoDao.java
0 → 100644
1 | +package com.diligrp.mobsite.man.dao; | |
2 | + | |
3 | +import com.diligrp.mobsite.man.domain.DemoDomain; | |
4 | +import com.diligrp.website.util.dao.IBaseDao; | |
5 | + | |
6 | + | |
7 | +/** | |
8 | + * <B>Description</B> TODO <br /> | |
9 | + * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br /> | |
10 | + * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br /> | |
11 | + * <B>Company</B> 地利集团 | |
12 | + * @createTime Aug 5, 2014 4:17:48 PM | |
13 | + * @author wujianjun | |
14 | + */ | |
15 | +public interface DemoDao extends IBaseDao<DemoDomain> { | |
16 | + | |
17 | +} | ... | ... |
mobsite-man-dao/src/main/java/com/diligrp/mobsite/man/dao/FeedbackDao.java
0 → 100644
1 | + | |
2 | +package com.diligrp.mobsite.man.dao; | |
3 | + | |
4 | + | |
5 | +import com.diligrp.mobsite.man.domain.Feedback; | |
6 | +import com.diligrp.website.util.dao.IBaseDao; | |
7 | + | |
8 | + | |
9 | +/** | |
10 | + * <B>Description</B> <br /> | |
11 | + * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br /> | |
12 | + * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br /> | |
13 | + * <B>Company</B> 地利集团 | |
14 | + * @createTime 2014-9-24 16:53:43 | |
15 | + * @author template | |
16 | + */ | |
17 | +public interface FeedbackDao extends IBaseDao<Feedback> { | |
18 | +} | ... | ... |
mobsite-man-dao/src/main/java/com/diligrp/mobsite/man/dao/PromotionDao.java
0 → 100644
1 | + | |
2 | +package com.diligrp.mobsite.man.dao; | |
3 | + | |
4 | + | |
5 | +import com.diligrp.mobsite.man.domain.Promotion; | |
6 | +import com.diligrp.website.util.dao.IBaseDao; | |
7 | + | |
8 | +/** | |
9 | + * <B>Description</B> <br /> | |
10 | + * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br /> | |
11 | + * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br /> | |
12 | + * <B>Company</B> 地利集团 | |
13 | + * @createTime 2014-9-24 16:53:43 | |
14 | + * @author template | |
15 | + */ | |
16 | +public interface PromotionDao extends IBaseDao<Promotion> { | |
17 | +} | ... | ... |
mobsite-man-dao/src/main/java/com/diligrp/mobsite/man/dao/RecipientDao.java
0 → 100644
1 | + | |
2 | +package com.diligrp.mobsite.man.dao; | |
3 | + | |
4 | + | |
5 | +import com.diligrp.mobsite.man.domain.Recipient; | |
6 | +import com.diligrp.website.util.dao.IBaseDao; | |
7 | + | |
8 | +/** | |
9 | + * <B>Description</B> <br /> | |
10 | + * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br /> | |
11 | + * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br /> | |
12 | + * <B>Company</B> 地利集团 | |
13 | + * @createTime 2014-9-24 16:53:44 | |
14 | + * @author template | |
15 | + */ | |
16 | +public interface RecipientDao extends IBaseDao<Recipient> { | |
17 | +} | ... | ... |
mobsite-man-dao/src/main/java/com/diligrp/mobsite/man/dao/RegisterNoMapperDao.java
0 → 100644
1 | + | |
2 | +package com.diligrp.mobsite.man.dao; | |
3 | + | |
4 | + | |
5 | +import com.diligrp.mobsite.getway.domain.RegisterNoMapper; | |
6 | +import com.diligrp.website.util.dao.IBaseDao; | |
7 | + | |
8 | +/** | |
9 | + * <B>Description</B> <br /> | |
10 | + * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br /> | |
11 | + * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br /> | |
12 | + * <B>Company</B> 地利集团 | |
13 | + * @createTime 2014-10-16 10:52:44 | |
14 | + * @author template | |
15 | + */ | |
16 | +public interface RegisterNoMapperDao extends IBaseDao<RegisterNoMapper> { | |
17 | +} | ... | ... |
mobsite-man-dao/src/main/java/com/diligrp/mobsite/man/dao/impl/AppPatchDaoImpl.java
0 → 100644
1 | +package com.diligrp.mobsite.man.dao.impl; | |
2 | + | |
3 | +import org.springframework.stereotype.Repository; | |
4 | + | |
5 | +import com.diligrp.mobsite.man.dao.AppPatchDao; | |
6 | +import com.diligrp.mobsite.man.domain.AppPatch; | |
7 | +import com.diligrp.website.util.dao.impl.BaseDaoImpl; | |
8 | + | |
9 | +@Repository("appPatchDao") | |
10 | +public class AppPatchDaoImpl extends BaseDaoImpl<AppPatch> implements AppPatchDao{ | |
11 | + | |
12 | +} | ... | ... |
mobsite-man-dao/src/main/java/com/diligrp/mobsite/man/dao/impl/AppVersionDaoImpl.java
0 → 100644
1 | +package com.diligrp.mobsite.man.dao.impl; | |
2 | + | |
3 | +import com.diligrp.mobsite.man.dao.AppVersionDao; | |
4 | +import com.diligrp.mobsite.man.domain.AppVersion; | |
5 | +import com.diligrp.website.util.dao.impl.BaseDaoImpl; | |
6 | +import org.springframework.stereotype.Repository; | |
7 | + | |
8 | +/** | |
9 | + * | |
10 | + * @ClassName: AppVersionImpl | |
11 | + * @Description: | |
12 | + * @author zhangshirui | |
13 | + * @date 2014年8月8日 下午4:30:55 | |
14 | + */ | |
15 | +@Repository("appVersionDao") | |
16 | +public class AppVersionDaoImpl extends BaseDaoImpl<AppVersion> implements AppVersionDao { | |
17 | + | |
18 | + @Override | |
19 | + public void unActiveByDeviceType(Integer deviceType) { | |
20 | + getSqlSessionTemplate().update( | |
21 | + this.getClass().getCanonicalName() + ".unActiveByDeviceType",deviceType); | |
22 | + } | |
23 | +} | ... | ... |
mobsite-man-dao/src/main/java/com/diligrp/mobsite/man/dao/impl/DemoDaoImpl.java
0 → 100644
1 | +package com.diligrp.mobsite.man.dao.impl; | |
2 | + | |
3 | +import com.diligrp.mobsite.man.dao.DemoDao; | |
4 | +import com.diligrp.mobsite.man.domain.DemoDomain; | |
5 | +import com.diligrp.website.util.dao.impl.BaseDaoImpl; | |
6 | + | |
7 | + | |
8 | +/** | |
9 | + * <B>Description</B> TODO <br /> | |
10 | + * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br /> | |
11 | + * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br /> | |
12 | + * <B>Company</B> 地利集团 | |
13 | + * @createTime Aug 5, 2014 4:18:09 PM | |
14 | + * @author wujianjun | |
15 | + */ | |
16 | +public class DemoDaoImpl extends BaseDaoImpl<DemoDomain> implements DemoDao { | |
17 | + | |
18 | +} | ... | ... |
mobsite-man-dao/src/main/java/com/diligrp/mobsite/man/dao/impl/FeedbackDaoImpl.java
0 → 100644
1 | +package com.diligrp.mobsite.man.dao.impl; | |
2 | + | |
3 | + | |
4 | +import com.diligrp.mobsite.man.dao.FeedbackDao; | |
5 | +import com.diligrp.mobsite.man.domain.Feedback; | |
6 | +import com.diligrp.website.util.dao.impl.BaseDaoImpl; | |
7 | +import org.springframework.stereotype.Component; | |
8 | + | |
9 | +/** | |
10 | + * <B>Description</B> <br /> | |
11 | + * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br /> | |
12 | + * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br /> | |
13 | + * <B>Company</B> 地利集团 | |
14 | + * | |
15 | + * @author template | |
16 | + * @createTime 2014-9-24 16:53:43 | |
17 | + */ | |
18 | +@Component | |
19 | +public class FeedbackDaoImpl extends BaseDaoImpl<Feedback> implements FeedbackDao { | |
20 | + | |
21 | +} | ... | ... |
mobsite-man-dao/src/main/java/com/diligrp/mobsite/man/dao/impl/PromotionDaoImpl.java
0 → 100644
1 | +package com.diligrp.mobsite.man.dao.impl; | |
2 | + | |
3 | + | |
4 | +import com.diligrp.mobsite.man.dao.PromotionDao; | |
5 | +import com.diligrp.mobsite.man.domain.Promotion; | |
6 | +import com.diligrp.website.util.dao.impl.BaseDaoImpl; | |
7 | +import org.springframework.stereotype.Component; | |
8 | + | |
9 | +/** | |
10 | + * <B>Description</B> <br /> | |
11 | + * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br /> | |
12 | + * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br /> | |
13 | + * <B>Company</B> 地利集团 | |
14 | + * | |
15 | + * @author template | |
16 | + * @createTime 2014-9-24 16:53:43 | |
17 | + */ | |
18 | +@Component | |
19 | +public class PromotionDaoImpl extends BaseDaoImpl<Promotion> implements PromotionDao { | |
20 | + | |
21 | +} | ... | ... |
mobsite-man-dao/src/main/java/com/diligrp/mobsite/man/dao/impl/RecipientDaoImpl.java
0 → 100644
1 | +package com.diligrp.mobsite.man.dao.impl; | |
2 | + | |
3 | + | |
4 | +import com.diligrp.mobsite.man.dao.RecipientDao; | |
5 | +import com.diligrp.mobsite.man.domain.Recipient; | |
6 | +import com.diligrp.website.util.dao.impl.BaseDaoImpl; | |
7 | +import org.springframework.stereotype.Component; | |
8 | + | |
9 | +/** | |
10 | + * <B>Description</B> <br /> | |
11 | + * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br /> | |
12 | + * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br /> | |
13 | + * <B>Company</B> 地利集团 | |
14 | + * | |
15 | + * @author template | |
16 | + * @createTime 2014-9-24 16:53:44 | |
17 | + */ | |
18 | +@Component | |
19 | +public class RecipientDaoImpl extends BaseDaoImpl<Recipient> implements RecipientDao { | |
20 | + | |
21 | +} | ... | ... |
mobsite-man-dao/src/main/java/com/diligrp/mobsite/man/dao/impl/RegisterNoMapperDaoImpl.java
0 → 100644
1 | + | |
2 | +package com.diligrp.mobsite.man.dao.impl; | |
3 | + | |
4 | + | |
5 | +import org.springframework.stereotype.Component; | |
6 | + | |
7 | +import com.diligrp.mobsite.getway.domain.RegisterNoMapper; | |
8 | +import com.diligrp.mobsite.man.dao.RegisterNoMapperDao; | |
9 | +import com.diligrp.website.util.dao.impl.BaseDaoImpl; | |
10 | + | |
11 | +/** | |
12 | + * <B>Description</B> <br /> | |
13 | + * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br /> | |
14 | + * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br /> | |
15 | + * <B>Company</B> 地利集团 | |
16 | + * @createTime 2014-10-16 10:52:44 | |
17 | + * @author template | |
18 | + */ | |
19 | +@Component | |
20 | +public class RegisterNoMapperDaoImpl extends BaseDaoImpl<RegisterNoMapper> implements RegisterNoMapperDao{ | |
21 | + | |
22 | +} | ... | ... |
mobsite-man-domain/pom.xml
0 → 100644
1 | +<?xml version="1.0"?> | |
2 | +<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" | |
3 | + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | |
4 | + <modelVersion>4.0.0</modelVersion> | |
5 | + <parent> | |
6 | + <groupId>com.diligrp.mobsite</groupId> | |
7 | + <artifactId>mobsite-man</artifactId> | |
8 | + <version>0.0.1-SNAPSHOT</version> | |
9 | + </parent> | |
10 | + <artifactId>mobsite-man-domain</artifactId> | |
11 | + <name>mobsite-man-domain</name> | |
12 | + <url>http://maven.apache.org</url> | |
13 | + <properties> | |
14 | + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | |
15 | + </properties> | |
16 | +</project> | ... | ... |
mobsite-man-domain/src/main/java/com/diligrp/mobsite/man/domain/AppPatch.java
0 → 100644
1 | +package com.diligrp.mobsite.man.domain; | |
2 | + | |
3 | +import com.diligrp.website.util.domain.BaseDomain; | |
4 | + | |
5 | +/** | |
6 | + * | |
7 | + * @ClassName: AppPatch | |
8 | + * @Description: | |
9 | + * @author zhangshirui | |
10 | + * @date 2014年8月8日 上午11:34:55 | |
11 | + */ | |
12 | +@SuppressWarnings("serial") | |
13 | +public class AppPatch extends BaseDomain{ | |
14 | + | |
15 | + /** | |
16 | + * 是否强制升级 | |
17 | + * 1 - 可升级,2 - 强制升级 | |
18 | + */ | |
19 | + public static final Integer FORCE_NO = 2; | |
20 | + /** | |
21 | + * 2 - 强制升级 | |
22 | + */ | |
23 | + public static final Integer FORCE_YES = 1; | |
24 | + | |
25 | + /** | |
26 | + * 设备类型 | |
27 | + * 1 - 所有设备,2 - ANDROID,3 - IOS | |
28 | + */ | |
29 | + public static final Integer DEVICE_ALL = 1; | |
30 | + /** | |
31 | + * 2 - ANDROID | |
32 | + */ | |
33 | + public static final Integer DEVICE_ANDROID= 2; | |
34 | + /** | |
35 | + * 3 - IOS | |
36 | + */ | |
37 | + public static final Integer DEVICE_IOS = 3; | |
38 | + | |
39 | + /** | |
40 | + * 起始版本安装包地址 | |
41 | + */ | |
42 | + private String sourceUrl; | |
43 | + /** | |
44 | + * 目标版本安装包地址 | |
45 | + */ | |
46 | + private String desUrl; | |
47 | + /** | |
48 | + * 补丁版本安装包地址 | |
49 | + */ | |
50 | + private String patchUrl; | |
51 | + /** | |
52 | + * 目标版本id | |
53 | + */ | |
54 | + private Long versionDesId; | |
55 | + /** | |
56 | + * 目标版本号 | |
57 | + */ | |
58 | + private String versionDesNo; | |
59 | + /** | |
60 | + * 起始版本id | |
61 | + */ | |
62 | + private Long versionSourceId; | |
63 | + /** | |
64 | + * 起始版本号 | |
65 | + */ | |
66 | + private String versionSourceNo; | |
67 | + /** | |
68 | + * 强制升级标志 | |
69 | + * 是:1,否:2 | |
70 | + */ | |
71 | + private Integer forceFlag; | |
72 | + /** | |
73 | + * 设备类型 | |
74 | + * | |
75 | + */ | |
76 | + private Integer deviceType; | |
77 | + /** | |
78 | + * 系统类型 | |
79 | + */ | |
80 | + private String systemType; | |
81 | + /** | |
82 | + * 增量更新描述 | |
83 | + */ | |
84 | + private String description; | |
85 | + /** | |
86 | + * md5值 | |
87 | + */ | |
88 | + private String md5; | |
89 | + /** | |
90 | + * 创建者 | |
91 | + */ | |
92 | + private Long creatorId; | |
93 | + | |
94 | + | |
95 | + public String getSourceUrl() { | |
96 | + return sourceUrl; | |
97 | + } | |
98 | + | |
99 | + | |
100 | + public void setSourceUrl(String sourceUrl) { | |
101 | + this.sourceUrl = sourceUrl; | |
102 | + } | |
103 | + | |
104 | + | |
105 | + public String getDesUrl() { | |
106 | + return desUrl; | |
107 | + } | |
108 | + | |
109 | + | |
110 | + public void setDesUrl(String desUrl) { | |
111 | + this.desUrl = desUrl; | |
112 | + } | |
113 | + | |
114 | + | |
115 | + public String getPatchUrl() { | |
116 | + return patchUrl; | |
117 | + } | |
118 | + | |
119 | + | |
120 | + public void setPatchUrl(String patchUrl) { | |
121 | + this.patchUrl = patchUrl; | |
122 | + } | |
123 | + | |
124 | + | |
125 | + public Long getVersionDesId() { | |
126 | + return versionDesId; | |
127 | + } | |
128 | + | |
129 | + | |
130 | + public void setVersionDesId(Long versionDesId) { | |
131 | + this.versionDesId = versionDesId; | |
132 | + } | |
133 | + | |
134 | + | |
135 | + public String getVersionDesNo() { | |
136 | + return versionDesNo; | |
137 | + } | |
138 | + | |
139 | + | |
140 | + public void setVersionDesNo(String versionDesNo) { | |
141 | + this.versionDesNo = versionDesNo; | |
142 | + } | |
143 | + | |
144 | + | |
145 | + public Long getVersionSourceId() { | |
146 | + return versionSourceId; | |
147 | + } | |
148 | + | |
149 | + | |
150 | + public void setVersionSourceId(Long versionSourceId) { | |
151 | + this.versionSourceId = versionSourceId; | |
152 | + } | |
153 | + | |
154 | + | |
155 | + public String getVersionSourceNo() { | |
156 | + return versionSourceNo; | |
157 | + } | |
158 | + | |
159 | + | |
160 | + public void setVersionSourceNo(String versionSourceNo) { | |
161 | + this.versionSourceNo = versionSourceNo; | |
162 | + } | |
163 | + | |
164 | + | |
165 | + public Integer getForceFlag() { | |
166 | + return forceFlag; | |
167 | + } | |
168 | + | |
169 | + | |
170 | + public void setForceFlag(Integer forceFlag) { | |
171 | + this.forceFlag = forceFlag; | |
172 | + } | |
173 | + | |
174 | + | |
175 | + public Integer getDeviceType() { | |
176 | + return deviceType; | |
177 | + } | |
178 | + | |
179 | + | |
180 | + public void setDeviceType(Integer deviceType) { | |
181 | + this.deviceType = deviceType; | |
182 | + } | |
183 | + | |
184 | + | |
185 | + public String getSystemType() { | |
186 | + return systemType; | |
187 | + } | |
188 | + | |
189 | + | |
190 | + public void setSystemType(String systemType) { | |
191 | + this.systemType = systemType; | |
192 | + } | |
193 | + | |
194 | + | |
195 | + public String getDescription() { | |
196 | + return description; | |
197 | + } | |
198 | + | |
199 | + | |
200 | + public void setDescription(String description) { | |
201 | + this.description = description; | |
202 | + } | |
203 | + | |
204 | + | |
205 | + public Long getCreatorId() { | |
206 | + return creatorId; | |
207 | + } | |
208 | + | |
209 | + | |
210 | + public void setCreatorId(Long creatorId) { | |
211 | + this.creatorId = creatorId; | |
212 | + } | |
213 | + | |
214 | + | |
215 | + @Override | |
216 | + public String toString() { | |
217 | + StringBuilder builder = new StringBuilder(); | |
218 | + builder.append("AppVersion [sourceUrl="); | |
219 | + builder.append(sourceUrl); | |
220 | + builder.append(", desUrl="); | |
221 | + builder.append(desUrl); | |
222 | + builder.append(", patchUrl="); | |
223 | + builder.append(patchUrl); | |
224 | + builder.append(", versionDesId="); | |
225 | + builder.append(versionDesId); | |
226 | + builder.append(", versionDesNo="); | |
227 | + builder.append(versionDesNo); | |
228 | + builder.append(", versionSourceId="); | |
229 | + builder.append(versionSourceId); | |
230 | + builder.append(", versionSourceNo="); | |
231 | + builder.append(versionSourceNo); | |
232 | + builder.append(", forceFlag="); | |
233 | + builder.append(forceFlag); | |
234 | + builder.append(", deviceType="); | |
235 | + builder.append(deviceType); | |
236 | + builder.append(", systemType="); | |
237 | + builder.append(systemType); | |
238 | + builder.append(", description="); | |
239 | + builder.append(description); | |
240 | + builder.append(", creatorId="); | |
241 | + builder.append(creatorId); | |
242 | + builder.append(", id="); | |
243 | + builder.append(id); | |
244 | + builder.append(", created="); | |
245 | + builder.append(created); | |
246 | + builder.append(", modified="); | |
247 | + builder.append(modified); | |
248 | + builder.append(", yn="); | |
249 | + builder.append(yn); | |
250 | + builder.append("]"); | |
251 | + return builder.toString(); | |
252 | + } | |
253 | + | |
254 | + | |
255 | + | |
256 | + public String getMd5() { | |
257 | + return md5; | |
258 | + } | |
259 | + | |
260 | + | |
261 | + | |
262 | + public void setMd5(String md5) { | |
263 | + this.md5 = md5; | |
264 | + } | |
265 | + | |
266 | +} | ... | ... |
mobsite-man-domain/src/main/java/com/diligrp/mobsite/man/domain/AppVersion.java
0 → 100644
1 | +package com.diligrp.mobsite.man.domain; | |
2 | + | |
3 | +import com.diligrp.mobsite.man.domain.common.Constant; | |
4 | +import com.diligrp.website.util.domain.BaseDomain; | |
5 | + | |
6 | + | |
7 | + | |
8 | +/** | |
9 | + * | |
10 | + * @ClassName: Version | |
11 | + * @Description: | |
12 | + * @author zhangshirui | |
13 | + * @date 2014年8月8日 上午11:34:55 | |
14 | + */ | |
15 | +@SuppressWarnings("serial") | |
16 | +public class AppVersion extends BaseDomain { | |
17 | + | |
18 | + /** | |
19 | + * 是否强制升级 | |
20 | + * 1 - 可升级,2 - 强制升级 | |
21 | + */ | |
22 | + public static final Integer FORCE_NO = 2; | |
23 | + /** | |
24 | + * 2 - 强制升级 | |
25 | + */ | |
26 | + public static final Integer FORCE_YES = 1; | |
27 | + | |
28 | + /** | |
29 | + * 设备类型 | |
30 | + * 1 - 所有设备,2 - ANDROID,3 - IOS | |
31 | + */ | |
32 | + public static final Integer DEVICE_ALL = 1; | |
33 | + /** | |
34 | + * 2 - ANDROID | |
35 | + */ | |
36 | + public static final Integer DEVICE_ANDROID= 2; | |
37 | + /** | |
38 | + * 3 - IOS | |
39 | + */ | |
40 | + public static final Integer DEVICE_IOS = 3; | |
41 | + | |
42 | + /** | |
43 | + * 是否激活 | |
44 | + * 1-激活,2-禁用 | |
45 | + */ | |
46 | + public static final Integer STATUS_ACTIVE = 1; | |
47 | + /** | |
48 | + * 2-禁用 | |
49 | + */ | |
50 | + public static final Integer STATUS_UNACTIVE = 2; | |
51 | + | |
52 | + /** | |
53 | + * 设备类型 | |
54 | + */ | |
55 | + private Integer device_type; | |
56 | + | |
57 | + /** | |
58 | + * 客户端app版本 | |
59 | + */ | |
60 | + private String app_version; | |
61 | + | |
62 | + /** | |
63 | + * 客户端app下载地址 | |
64 | + */ | |
65 | + private String app_url; | |
66 | + | |
67 | + /** | |
68 | + * app描述 | |
69 | + */ | |
70 | + private String description; | |
71 | + | |
72 | + /** | |
73 | + * 是否启用 | |
74 | + * 1.启用 | |
75 | + * 2.禁用 | |
76 | + */ | |
77 | + private Integer status; | |
78 | + | |
79 | + /** | |
80 | + * 是否强制升级 | |
81 | + * 1.是 | |
82 | + * 2.否 | |
83 | + */ | |
84 | + private Integer force_flag; | |
85 | + | |
86 | + /** | |
87 | + * 创建者id | |
88 | + */ | |
89 | + private Long creator_id; | |
90 | + | |
91 | + /** | |
92 | + * 系统类型 | |
93 | + * PNR:pnr-app | |
94 | + * POS:pos机 | |
95 | + * PAY:地利宝 | |
96 | + */ | |
97 | + private String systemType; | |
98 | + /** | |
99 | + * 版本编号 | |
100 | + */ | |
101 | + private Integer versionCode; | |
102 | + | |
103 | + /** | |
104 | + * 是否增量升级 | |
105 | + */ | |
106 | + private Integer patchFlag = Constant.VERSION_PATCH_FLAG_NO; | |
107 | + | |
108 | + | |
109 | + public Integer getDevice_type() { | |
110 | + return device_type; | |
111 | + } | |
112 | + | |
113 | + | |
114 | + | |
115 | + | |
116 | + | |
117 | + public void setDevice_type(Integer device_type) { | |
118 | + this.device_type = device_type; | |
119 | + } | |
120 | + | |
121 | + | |
122 | + | |
123 | + | |
124 | + | |
125 | + public String getApp_version() { | |
126 | + return app_version; | |
127 | + } | |
128 | + | |
129 | + | |
130 | + | |
131 | + | |
132 | + | |
133 | + public void setApp_version(String app_version) { | |
134 | + this.app_version = app_version; | |
135 | + } | |
136 | + | |
137 | + | |
138 | + | |
139 | + | |
140 | + | |
141 | + public String getApp_url() { | |
142 | + return app_url; | |
143 | + } | |
144 | + | |
145 | + | |
146 | + | |
147 | + | |
148 | + | |
149 | + public void setApp_url(String app_url) { | |
150 | + this.app_url = app_url; | |
151 | + } | |
152 | + | |
153 | + | |
154 | + | |
155 | + | |
156 | + | |
157 | + public String getDescription() { | |
158 | + return description; | |
159 | + } | |
160 | + | |
161 | + | |
162 | + | |
163 | + | |
164 | + | |
165 | + public void setDescription(String description) { | |
166 | + this.description = description; | |
167 | + } | |
168 | + | |
169 | + | |
170 | + | |
171 | + | |
172 | + | |
173 | + public Integer getStatus() { | |
174 | + return status; | |
175 | + } | |
176 | + | |
177 | + | |
178 | + | |
179 | + | |
180 | + | |
181 | + public void setStatus(Integer status) { | |
182 | + this.status = status; | |
183 | + } | |
184 | + | |
185 | + | |
186 | + | |
187 | + | |
188 | + | |
189 | + public Integer getForce_flag() { | |
190 | + return force_flag; | |
191 | + } | |
192 | + | |
193 | + | |
194 | + | |
195 | + | |
196 | + | |
197 | + public void setForce_flag(Integer force_flag) { | |
198 | + this.force_flag = force_flag; | |
199 | + } | |
200 | + | |
201 | + | |
202 | + | |
203 | + | |
204 | + | |
205 | + public Long getCreator_id() { | |
206 | + return creator_id; | |
207 | + } | |
208 | + | |
209 | + | |
210 | + | |
211 | + | |
212 | + | |
213 | + public void setCreator_id(Long creator_id) { | |
214 | + this.creator_id = creator_id; | |
215 | + } | |
216 | + | |
217 | + | |
218 | + | |
219 | + | |
220 | + | |
221 | + | |
222 | + /** | |
223 | + * get value of AppVersion.systemType | |
224 | + * @return the systemType | |
225 | + * @createTime 2014年11月24日 下午6:23:15 | |
226 | + * @author zhangshirui | |
227 | + */ | |
228 | + public String getSystemType() { | |
229 | + return systemType; | |
230 | + } | |
231 | + | |
232 | + | |
233 | + | |
234 | + | |
235 | + | |
236 | + | |
237 | + /** | |
238 | + * set value of AppVersion.systemType | |
239 | + * @param systemType the systemType to set | |
240 | + * @createTime 2014年11月24日 下午6:23:16 | |
241 | + * @author zhangshirui | |
242 | + */ | |
243 | + public void setSystemType(String systemType) { | |
244 | + this.systemType = systemType; | |
245 | + } | |
246 | + | |
247 | + @Override | |
248 | + public String toString() { | |
249 | + return null; | |
250 | + } | |
251 | + | |
252 | + public Integer getVersionCode() { | |
253 | + return versionCode; | |
254 | + } | |
255 | + | |
256 | + public void setVersionCode(Integer versionCode) { | |
257 | + this.versionCode = versionCode; | |
258 | + } | |
259 | + | |
260 | + public Integer getPatchFlag() { | |
261 | + return patchFlag; | |
262 | + } | |
263 | + | |
264 | + public void setPatchFlag(Integer patchFlag) { | |
265 | + this.patchFlag = patchFlag; | |
266 | + } | |
267 | + | |
268 | +} | ... | ... |
mobsite-man-domain/src/main/java/com/diligrp/mobsite/man/domain/DemoDomain.java
0 → 100644
1 | +package com.diligrp.mobsite.man.domain; | |
2 | + | |
3 | +import com.diligrp.website.util.domain.BaseDomain; | |
4 | + | |
5 | + | |
6 | +/** | |
7 | + * <B>Description</B> TODO <br /> | |
8 | + * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br /> | |
9 | + * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br /> | |
10 | + * <B>Company</B> 地利集团 | |
11 | + * @createTime Aug 5, 2014 4:19:53 PM | |
12 | + * @author wujianjun | |
13 | + */ | |
14 | +public class DemoDomain extends BaseDomain { | |
15 | + private String name; | |
16 | + | |
17 | + /* (non-Javadoc) | |
18 | + * @see java.lang.Object#toString() | |
19 | + */ | |
20 | + @Override | |
21 | + public String toString() { | |
22 | + return "DemoDomain [name=" + name + ", id=" + id + ", created=" | |
23 | + + created + ", modified=" + modified + ", yn=" + yn + "]"; | |
24 | + } | |
25 | + | |
26 | +} | ... | ... |
mobsite-man-domain/src/main/java/com/diligrp/mobsite/man/domain/Feedback.java
0 → 100644
1 | +package com.diligrp.mobsite.man.domain; | |
2 | + | |
3 | +import com.diligrp.website.util.domain.BaseDomain; | |
4 | + | |
5 | + | |
6 | +/** | |
7 | + * <B>Description</B> <br /> | |
8 | + * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br /> | |
9 | + * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br /> | |
10 | + * <B>Company</B> 地利集团 | |
11 | + * @createTime 2014-9-24 16:53:43 | |
12 | + * @author template | |
13 | + */ | |
14 | +public class Feedback extends BaseDomain { | |
15 | + | |
16 | + /** | |
17 | + * 市场id | |
18 | + */ | |
19 | + private Long marketId; | |
20 | + /** | |
21 | + * 市场名称 | |
22 | + */ | |
23 | + private String marketName; | |
24 | + /** | |
25 | + * 用户登录名 | |
26 | + */ | |
27 | + private String username; | |
28 | + /** | |
29 | + * 用户id | |
30 | + */ | |
31 | + private Long userId; | |
32 | + /** | |
33 | + * android设备:1,ios设备:2 | |
34 | + */ | |
35 | + private Integer deviceType; | |
36 | + /** | |
37 | + * 设备版本 | |
38 | + */ | |
39 | + private String deviceVersion; | |
40 | + /** | |
41 | + * 客户端版本 | |
42 | + */ | |
43 | + private String appVersion; | |
44 | + /** | |
45 | + * 已读:1,未读:2 | |
46 | + */ | |
47 | + private Integer status; | |
48 | + /** | |
49 | + * 反馈内容 | |
50 | + */ | |
51 | + private String content; | |
52 | + /** | |
53 | + * 系统类型 | |
54 | + */ | |
55 | + private String systemType; | |
56 | + | |
57 | + public String getMarketName() { | |
58 | + return marketName; | |
59 | + } | |
60 | + | |
61 | + public void setMarketName(String marketName) { | |
62 | + this.marketName = marketName; | |
63 | + } | |
64 | + | |
65 | + public void setMarketId (Long marketId){ | |
66 | + this.marketId = marketId; | |
67 | + } | |
68 | + public Long getMarketId(){ | |
69 | + return this.marketId; | |
70 | + } | |
71 | + | |
72 | + public void setUsername (String username){ | |
73 | + this.username = username; | |
74 | + } | |
75 | + public String getUsername(){ | |
76 | + return this.username; | |
77 | + } | |
78 | + | |
79 | + public void setUserId (Long userId){ | |
80 | + this.userId = userId; | |
81 | + } | |
82 | + public Long getUserId(){ | |
83 | + return this.userId; | |
84 | + } | |
85 | + | |
86 | + public void setDeviceType (Integer deviceType){ | |
87 | + this.deviceType = deviceType; | |
88 | + } | |
89 | + public Integer getDeviceType(){ | |
90 | + return this.deviceType; | |
91 | + } | |
92 | + | |
93 | + public void setDeviceVersion (String deviceVersion){ | |
94 | + this.deviceVersion = deviceVersion; | |
95 | + } | |
96 | + public String getDeviceVersion(){ | |
97 | + return this.deviceVersion; | |
98 | + } | |
99 | + | |
100 | + public void setAppVersion (String appVersion){ | |
101 | + this.appVersion = appVersion; | |
102 | + } | |
103 | + public String getAppVersion(){ | |
104 | + return this.appVersion; | |
105 | + } | |
106 | + | |
107 | + public void setStatus (Integer status){ | |
108 | + this.status = status; | |
109 | + } | |
110 | + public Integer getStatus(){ | |
111 | + return this.status; | |
112 | + } | |
113 | + | |
114 | + public void setContent (String content){ | |
115 | + this.content = content; | |
116 | + } | |
117 | + public String getContent(){ | |
118 | + return this.content; | |
119 | + } | |
120 | + | |
121 | + public String toString(){ | |
122 | + StringBuffer sb = new StringBuffer(); | |
123 | + sb.append("Feedback ["); | |
124 | + sb.append("id = "); | |
125 | + sb.append(id); | |
126 | + sb.append(", marketId = "); | |
127 | + sb.append(marketId); | |
128 | + sb.append(", username = "); | |
129 | + sb.append(username); | |
130 | + sb.append(", userId = "); | |
131 | + sb.append(userId); | |
132 | + sb.append(", deviceType = "); | |
133 | + sb.append(deviceType); | |
134 | + sb.append(", deviceVersion = "); | |
135 | + sb.append(deviceVersion); | |
136 | + sb.append(", appVersion = "); | |
137 | + sb.append(appVersion); | |
138 | + sb.append(", status = "); | |
139 | + sb.append(status); | |
140 | + sb.append(", content = "); | |
141 | + sb.append(content); | |
142 | + sb.append(", yn = "); | |
143 | + sb.append(yn); | |
144 | + sb.append(", created = "); | |
145 | + sb.append(created); | |
146 | + sb.append(", modified = "); | |
147 | + sb.append(modified); | |
148 | + sb.append("]"); | |
149 | + return sb.toString(); | |
150 | + } | |
151 | + | |
152 | + | |
153 | + /** | |
154 | + * get value of Feedback.systemType | |
155 | + * @return the systemType | |
156 | + * @createTime 2014年11月25日 上午11:22:24 | |
157 | + * @author zhangshirui | |
158 | + */ | |
159 | + public String getSystemType() { | |
160 | + return systemType; | |
161 | + } | |
162 | + | |
163 | + | |
164 | + /** | |
165 | + * set value of Feedback.systemType | |
166 | + * @param systemType the systemType to set | |
167 | + * @createTime 2014年11月25日 上午11:22:24 | |
168 | + * @author zhangshirui | |
169 | + */ | |
170 | + public void setSystemType(String systemType) { | |
171 | + this.systemType = systemType; | |
172 | + } | |
173 | +} | |
0 | 174 | \ No newline at end of file | ... | ... |
mobsite-man-domain/src/main/java/com/diligrp/mobsite/man/domain/Promotion.java
0 → 100644
1 | +package com.diligrp.mobsite.man.domain; | |
2 | + | |
3 | +import java.io.Serializable; | |
4 | +import com.diligrp.website.util.domain.BaseDomain; | |
5 | +import java.util.*; | |
6 | +import java.sql.Timestamp; | |
7 | + | |
8 | + | |
9 | +/** | |
10 | + * <B>Description</B> <br /> | |
11 | + * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br /> | |
12 | + * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br /> | |
13 | + * <B>Company</B> 地利集团 | |
14 | + * @createTime 2014-9-24 16:53:43 | |
15 | + * @author template | |
16 | + */ | |
17 | +public class Promotion extends BaseDomain { | |
18 | + | |
19 | + public static final Integer DEVICE_TYPE_ANDROID = 1; | |
20 | + public static final Integer DEVICE_TYPE_IOS = 2; | |
21 | + public static final Integer DEVICE_TYPE_ALL = 3; | |
22 | + public static final Integer SEND_TYPE_NOW = 1; | |
23 | + public static final Integer SEND_TYPE_SCHEDULE = 2; | |
24 | + public static final Integer SEND_FLAG_SUCCESS = 1; | |
25 | + public static final Integer SEND_FLAG_FAILURE = 2; | |
26 | + | |
27 | + /** | |
28 | + * 市场id | |
29 | + */ | |
30 | + private Long marketId; | |
31 | + /** | |
32 | + * 市场名称 | |
33 | + */ | |
34 | + private String marketName; | |
35 | + /** | |
36 | + * 标题 | |
37 | + */ | |
38 | + private String title; | |
39 | + /** | |
40 | + * 消息内容 | |
41 | + */ | |
42 | + private String content; | |
43 | + /** | |
44 | + * Android:1,Ios:2,所有设备:3 | |
45 | + */ | |
46 | + private Integer deviceType; | |
47 | + /** | |
48 | + * 所有人:1,个人:2 | |
49 | + */ | |
50 | + private Integer receiveCrowd; | |
51 | + /** | |
52 | + * 立即发送:1,指定时间发送:2 | |
53 | + */ | |
54 | + private Integer sendType; | |
55 | + /** | |
56 | + * 发送时间 | |
57 | + */ | |
58 | + private Timestamp sendTime; | |
59 | + /** | |
60 | + * 直接打开应用:1,打开分类搜索列表:2,打开商品详情页:3,打开店铺页:4 | |
61 | + */ | |
62 | + private Integer openType; | |
63 | + /** | |
64 | + * 自定义打开页面url或者列表id | |
65 | + */ | |
66 | + private String openUrl; | |
67 | + /** | |
68 | + * 发送成功:1,失败:2 | |
69 | + */ | |
70 | + private Integer sendFlag; | |
71 | + /** | |
72 | + * 创建人id | |
73 | + */ | |
74 | + private Long creatorId; | |
75 | + /** | |
76 | + * 发送ID | |
77 | + */ | |
78 | + private String sendId; | |
79 | + | |
80 | + /** | |
81 | + * 界面属性 | |
82 | + */ | |
83 | + private List<Long> marketIds; | |
84 | + private List<Integer> deviceTypes; | |
85 | + private String sendTimeString; | |
86 | + | |
87 | + | |
88 | + public String getSendId() { | |
89 | + return sendId; | |
90 | + } | |
91 | + | |
92 | + public void setSendId(String sendId) { | |
93 | + this.sendId = sendId; | |
94 | + } | |
95 | + | |
96 | + public String getSendTimeString() { | |
97 | + return sendTimeString; | |
98 | + } | |
99 | + | |
100 | + public void setSendTimeString(String sendTimeString) { | |
101 | + this.sendTimeString = sendTimeString; | |
102 | + } | |
103 | + | |
104 | + public List<Integer> getDeviceTypes() { | |
105 | + return deviceTypes; | |
106 | + } | |
107 | + | |
108 | + public void setDeviceTypes(List<Integer> deviceTypes) { | |
109 | + this.deviceTypes = deviceTypes; | |
110 | + } | |
111 | + | |
112 | + public List<Long> getMarketIds() { | |
113 | + return marketIds; | |
114 | + } | |
115 | + | |
116 | + public void setMarketIds(List<Long> marketIds) { | |
117 | + this.marketIds = marketIds; | |
118 | + } | |
119 | + | |
120 | + public String getMarketName() { | |
121 | + return marketName; | |
122 | + } | |
123 | + | |
124 | + public void setMarketName(String marketName) { | |
125 | + this.marketName = marketName; | |
126 | + } | |
127 | + | |
128 | + public void setMarketId (Long marketId){ | |
129 | + this.marketId = marketId; | |
130 | + } | |
131 | + public Long getMarketId(){ | |
132 | + return this.marketId; | |
133 | + } | |
134 | + | |
135 | + public void setTitle (String title){ | |
136 | + this.title = title; | |
137 | + } | |
138 | + public String getTitle(){ | |
139 | + return this.title; | |
140 | + } | |
141 | + | |
142 | + public void setContent (String content){ | |
143 | + this.content = content; | |
144 | + } | |
145 | + public String getContent(){ | |
146 | + return this.content; | |
147 | + } | |
148 | + | |
149 | + public void setDeviceType (Integer deviceType){ | |
150 | + this.deviceType = deviceType; | |
151 | + } | |
152 | + public Integer getDeviceType(){ | |
153 | + return this.deviceType; | |
154 | + } | |
155 | + | |
156 | + public void setReceiveCrowd (Integer receiveCrowd){ | |
157 | + this.receiveCrowd = receiveCrowd; | |
158 | + } | |
159 | + public Integer getReceiveCrowd(){ | |
160 | + return this.receiveCrowd; | |
161 | + } | |
162 | + | |
163 | + public void setSendType (Integer sendType){ | |
164 | + this.sendType = sendType; | |
165 | + } | |
166 | + public Integer getSendType(){ | |
167 | + return this.sendType; | |
168 | + } | |
169 | + | |
170 | + public void setSendTime (Timestamp sendTime){ | |
171 | + this.sendTime = sendTime; | |
172 | + } | |
173 | + public Timestamp getSendTime(){ | |
174 | + return this.sendTime; | |
175 | + } | |
176 | + | |
177 | + public void setOpenType (Integer openType){ | |
178 | + this.openType = openType; | |
179 | + } | |
180 | + public Integer getOpenType(){ | |
181 | + return this.openType; | |
182 | + } | |
183 | + | |
184 | + public void setOpenUrl (String openUrl){ | |
185 | + this.openUrl = openUrl; | |
186 | + } | |
187 | + public String getOpenUrl(){ | |
188 | + return this.openUrl; | |
189 | + } | |
190 | + | |
191 | + public void setSendFlag (Integer sendFlag){ | |
192 | + this.sendFlag = sendFlag; | |
193 | + } | |
194 | + public Integer getSendFlag(){ | |
195 | + return this.sendFlag; | |
196 | + } | |
197 | + | |
198 | + public void setCreatorId (Long creatorId){ | |
199 | + this.creatorId = creatorId; | |
200 | + } | |
201 | + public Long getCreatorId(){ | |
202 | + return this.creatorId; | |
203 | + } | |
204 | + | |
205 | + | |
206 | + public String toString(){ | |
207 | + StringBuffer sb = new StringBuffer(); | |
208 | + sb.append("Promotion ["); | |
209 | + sb.append("id = "); | |
210 | + sb.append(id); | |
211 | + sb.append(", marketId = "); | |
212 | + sb.append(marketId); | |
213 | + sb.append(", title = "); | |
214 | + sb.append(title); | |
215 | + sb.append(", content = "); | |
216 | + sb.append(content); | |
217 | + sb.append(", deviceType = "); | |
218 | + sb.append(deviceType); | |
219 | + sb.append(", receiveCrowd = "); | |
220 | + sb.append(receiveCrowd); | |
221 | + sb.append(", sendType = "); | |
222 | + sb.append(sendType); | |
223 | + sb.append(", sendTime = "); | |
224 | + sb.append(sendTime); | |
225 | + sb.append(", openType = "); | |
226 | + sb.append(openType); | |
227 | + sb.append(", openUrl = "); | |
228 | + sb.append(openUrl); | |
229 | + sb.append(", sendFlag = "); | |
230 | + sb.append(sendFlag); | |
231 | + sb.append(", creatorId = "); | |
232 | + sb.append(creatorId); | |
233 | + sb.append(", sendId = "); | |
234 | + sb.append(sendId); | |
235 | + sb.append(", yn = "); | |
236 | + sb.append(yn); | |
237 | + sb.append(", created = "); | |
238 | + sb.append(created); | |
239 | + sb.append(", modified = "); | |
240 | + sb.append(modified); | |
241 | + sb.append("]"); | |
242 | + return sb.toString(); | |
243 | + } | |
244 | +} | |
0 | 245 | \ No newline at end of file | ... | ... |
mobsite-man-domain/src/main/java/com/diligrp/mobsite/man/domain/Recipient.java
0 → 100644
1 | +package com.diligrp.mobsite.man.domain; | |
2 | + | |
3 | +import java.io.Serializable; | |
4 | +import com.diligrp.website.util.domain.BaseDomain; | |
5 | +import java.util.*; | |
6 | +import java.sql.Timestamp; | |
7 | + | |
8 | + | |
9 | +/** | |
10 | + * <B>Description</B> <br /> | |
11 | + * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br /> | |
12 | + * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br /> | |
13 | + * <B>Company</B> 地利集团 | |
14 | + * @createTime 2014-9-24 16:53:44 | |
15 | + * @author template | |
16 | + */ | |
17 | +public class Recipient extends BaseDomain { | |
18 | + | |
19 | + /** | |
20 | + * 推送信息id | |
21 | + */ | |
22 | + private Long pid; | |
23 | + /** | |
24 | + * 用户id | |
25 | + */ | |
26 | + private String userId; | |
27 | + /** | |
28 | + * 用户名 | |
29 | + */ | |
30 | + private String userName; | |
31 | + /** | |
32 | + * 用户客户端号 | |
33 | + */ | |
34 | + private String mobileId; | |
35 | + | |
36 | + public void setPid (Long pid){ | |
37 | + this.pid = pid; | |
38 | + } | |
39 | + public Long getPid(){ | |
40 | + return this.pid; | |
41 | + } | |
42 | + | |
43 | + public void setUserId (String userId){ | |
44 | + this.userId = userId; | |
45 | + } | |
46 | + public String getUserId(){ | |
47 | + return this.userId; | |
48 | + } | |
49 | + | |
50 | + public void setUserName (String userName){ | |
51 | + this.userName = userName; | |
52 | + } | |
53 | + public String getUserName(){ | |
54 | + return this.userName; | |
55 | + } | |
56 | + | |
57 | + public void setMobileId (String mobileId){ | |
58 | + this.mobileId = mobileId; | |
59 | + } | |
60 | + public String getMobileId(){ | |
61 | + return this.mobileId; | |
62 | + } | |
63 | + | |
64 | + public String toString(){ | |
65 | + StringBuffer sb = new StringBuffer(); | |
66 | + sb.append("Recipient ["); | |
67 | + sb.append("id = "); | |
68 | + sb.append(id); | |
69 | + sb.append(", pid = "); | |
70 | + sb.append(pid); | |
71 | + sb.append(", userId = "); | |
72 | + sb.append(userId); | |
73 | + sb.append(", userName = "); | |
74 | + sb.append(userName); | |
75 | + sb.append(", mobileId = "); | |
76 | + sb.append(mobileId); | |
77 | + sb.append(", yn = "); | |
78 | + sb.append(yn); | |
79 | + sb.append(", created = "); | |
80 | + sb.append(created); | |
81 | + sb.append(", modified = "); | |
82 | + sb.append(modified); | |
83 | + sb.append("]"); | |
84 | + return sb.toString(); | |
85 | + } | |
86 | +} | |
0 | 87 | \ No newline at end of file | ... | ... |
mobsite-man-domain/src/main/java/com/diligrp/mobsite/man/domain/SystemTypeEnum.java
0 → 100644
1 | +package com.diligrp.mobsite.man.domain; | |
2 | + | |
3 | +/** | |
4 | + * PNR:pnr-app | |
5 | + * POS:pos机 | |
6 | + * PAY:地利宝 | |
7 | + */ | |
8 | +public enum SystemTypeEnum { | |
9 | + | |
10 | + PNR("pnr"),POS("pos"),PAY("pay"); | |
11 | + | |
12 | + private String value; | |
13 | + | |
14 | + private SystemTypeEnum(String value){ | |
15 | + this.value = value; | |
16 | + } | |
17 | + | |
18 | + public String getValue(){ | |
19 | + return this.value; | |
20 | + } | |
21 | + | |
22 | +} | ... | ... |
mobsite-man-domain/src/main/java/com/diligrp/mobsite/man/domain/common/Constant.java
0 → 100644
1 | +package com.diligrp.mobsite.man.domain.common; | |
2 | + | |
3 | + | |
4 | +/** | |
5 | + * <B>Description</B> 常量类 <br /> | |
6 | + * <B>Copyright</B> Copyright (c) 2015 www.diligrp.com All rights reserved. <br /> | |
7 | + * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br /> | |
8 | + * <B>Company</B> 地利集团 | |
9 | + * @createTime 2015年5月14日 下午1:13:29 | |
10 | + * @author zhangshirui | |
11 | + */ | |
12 | +public class Constant { | |
13 | + | |
14 | + public static final int VERSION_PATCH_FLAG_YES = 1; | |
15 | + public static final int VERSION_PATCH_FLAG_NO = 2; | |
16 | +} | ... | ... |
mobsite-man-domain/src/main/java/com/diligrp/mobsite/man/domain/exception/DiliException.java
0 → 100644
1 | +package com.diligrp.mobsite.man.domain.exception; | |
2 | + | |
3 | +import java.util.Map; | |
4 | + | |
5 | + | |
6 | +/** | |
7 | + * <B>Description</B> <br /> | |
8 | + * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br /> | |
9 | + * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br /> | |
10 | + * <B>Company</B> 地利集团 | |
11 | + * @createTime 2014-9-24 16:53:42 | |
12 | + * @author template | |
13 | + */ | |
14 | +public class DiliException extends Exception { | |
15 | + private Map<?, ?> map = null; | |
16 | + | |
17 | + public DiliException(){} | |
18 | + | |
19 | + public DiliException(String msg){ | |
20 | + super(msg); | |
21 | + } | |
22 | + | |
23 | + public DiliException(String msg, Map<?, ?> map){ | |
24 | + super(msg); | |
25 | + } | |
26 | + | |
27 | + | |
28 | + public Map<?, ?> getMap() { | |
29 | + return map; | |
30 | + } | |
31 | + | |
32 | + public void setMap(Map<?, ?> map) { | |
33 | + this.map = map; | |
34 | + } | |
35 | +} | |
0 | 36 | \ No newline at end of file | ... | ... |
mobsite-man-manager/pom.xml
0 → 100644
1 | +<?xml version="1.0"?> | |
2 | +<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" | |
3 | + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | |
4 | + <modelVersion>4.0.0</modelVersion> | |
5 | + <parent> | |
6 | + <groupId>com.diligrp.mobsite</groupId> | |
7 | + <artifactId>mobsite-man</artifactId> | |
8 | + <version>0.0.1-SNAPSHOT</version> | |
9 | + </parent> | |
10 | + <artifactId>mobsite-man-manager</artifactId> | |
11 | + <name>mobsite-man-manager</name> | |
12 | + <url>http://maven.apache.org</url> | |
13 | + <properties> | |
14 | + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | |
15 | + </properties> | |
16 | + <dependencies> | |
17 | + <dependency> | |
18 | + <groupId>com.diligrp.mobsite</groupId> | |
19 | + <artifactId>mobsite-man-dao</artifactId> | |
20 | + <version>0.0.1-SNAPSHOT</version> | |
21 | + </dependency> | |
22 | + <dependency> | |
23 | + <groupId>com.diligrp.mobsite</groupId> | |
24 | + <artifactId>mobsite-man-domain</artifactId> | |
25 | + <version>0.0.1-SNAPSHOT</version> | |
26 | + </dependency> | |
27 | + <dependency> | |
28 | + <groupId>com.diligrp.mobsite</groupId> | |
29 | + <artifactId>mobsite-man-rpc</artifactId> | |
30 | + <version>0.0.1-SNAPSHOT</version> | |
31 | + </dependency> | |
32 | + <!-- MQ --> | |
33 | + <dependency> | |
34 | + <groupId>org.apache.activemq</groupId> | |
35 | + <artifactId>activemq-spring</artifactId> | |
36 | + <version>5.9.1</version> | |
37 | + </dependency> | |
38 | + </dependencies> | |
39 | +</project> | ... | ... |
mobsite-man-manager/src/main/java/com/diligrp/mobsite/man/manager/AppPatchManager.java
0 → 100644
1 | +package com.diligrp.mobsite.man.manager; | |
2 | + | |
3 | +import java.util.List; | |
4 | + | |
5 | +import com.diligrp.mobsite.man.domain.AppPatch; | |
6 | +import com.diligrp.website.util.dao.BaseQuery; | |
7 | + | |
8 | +public interface AppPatchManager { | |
9 | + boolean save(AppPatch appPatch); | |
10 | + | |
11 | + boolean update(AppPatch appPatch); | |
12 | + | |
13 | + boolean deleteById(Long id); | |
14 | + | |
15 | + AppPatch getById(Long id); | |
16 | + | |
17 | + List<AppPatch> listByCondition(BaseQuery conditions); | |
18 | + | |
19 | + List<AppPatch> listAllByCondition(BaseQuery conditions); | |
20 | + | |
21 | + Integer countByCondition(BaseQuery conditions); | |
22 | +} | ... | ... |
mobsite-man-manager/src/main/java/com/diligrp/mobsite/man/manager/AppVersionManager.java
0 → 100644
1 | +package com.diligrp.mobsite.man.manager; | |
2 | + | |
3 | +import com.diligrp.mobsite.man.domain.AppVersion; | |
4 | +import com.diligrp.website.util.dao.BaseQuery; | |
5 | + | |
6 | +import java.util.List; | |
7 | + | |
8 | +/** | |
9 | + * | |
10 | + * @ClassName: AppVersionManager | |
11 | + * @Description: | |
12 | + * @author zhangshirui | |
13 | + * @date 2014年8月8日 下午4:53:06 | |
14 | + */ | |
15 | +public interface AppVersionManager { | |
16 | + | |
17 | + public boolean save(AppVersion appVersion); | |
18 | + | |
19 | + public boolean update(AppVersion appVersion); | |
20 | + | |
21 | + public boolean deleteById(Long id); | |
22 | + | |
23 | + public AppVersion getById(Long id); | |
24 | + | |
25 | + public List<AppVersion> listByCondition(BaseQuery conditions); | |
26 | + | |
27 | + public List<AppVersion> listAllByCondition(BaseQuery conditions); | |
28 | + | |
29 | + public Integer countByCondition(BaseQuery conditions); | |
30 | + | |
31 | +} | ... | ... |
mobsite-man-manager/src/main/java/com/diligrp/mobsite/man/manager/DemoManager.java
0 → 100644
1 | +package com.diligrp.mobsite.man.manager; | |
2 | + | |
3 | + | |
4 | +/** | |
5 | + * <B>Description</B> TODO <br /> | |
6 | + * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br /> | |
7 | + * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br /> | |
8 | + * <B>Company</B> 地利集团 | |
9 | + * @createTime Aug 5, 2014 4:21:30 PM | |
10 | + * @author wujianjun | |
11 | + */ | |
12 | +public interface DemoManager { | |
13 | + | |
14 | +} | ... | ... |
mobsite-man-manager/src/main/java/com/diligrp/mobsite/man/manager/FeedbackManager.java
0 → 100644
1 | +package com.diligrp.mobsite.man.manager; | |
2 | + | |
3 | +import com.diligrp.mobsite.man.domain.Feedback; | |
4 | +import com.diligrp.website.util.dao.BaseQuery; | |
5 | +import com.diligrp.website.util.web.PageTemplate; | |
6 | + | |
7 | +/** | |
8 | + * <B>Description</B> <br /> | |
9 | + * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br /> | |
10 | + * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br /> | |
11 | + * <B>Company</B> 地利集团 | |
12 | + * @createTime 2014-9-24 16:53:43 | |
13 | + * @author template | |
14 | + */ | |
15 | +public interface FeedbackManager { | |
16 | + | |
17 | + public PageTemplate find(BaseQuery bq); | |
18 | + | |
19 | + public Feedback findOne(Long pk); | |
20 | + | |
21 | + public Boolean save(Feedback feedback); | |
22 | + | |
23 | + public Boolean update(Feedback feedback); | |
24 | + | |
25 | + public Boolean del(Long id); | |
26 | + | |
27 | +} | ... | ... |
mobsite-man-manager/src/main/java/com/diligrp/mobsite/man/manager/PromotionManager.java
0 → 100644
1 | +package com.diligrp.mobsite.man.manager; | |
2 | + | |
3 | +import com.diligrp.mobsite.man.domain.Promotion; | |
4 | +import com.diligrp.website.util.dao.BaseQuery; | |
5 | +import com.diligrp.website.util.web.PageTemplate; | |
6 | + | |
7 | +/** | |
8 | + * <B>Description</B> <br /> | |
9 | + * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br /> | |
10 | + * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br /> | |
11 | + * <B>Company</B> 地利集团 | |
12 | + * | |
13 | + * @author template | |
14 | + * @createTime 2014-9-24 16:53:43 | |
15 | + */ | |
16 | +public interface PromotionManager { | |
17 | + | |
18 | + public PageTemplate find(BaseQuery bq); | |
19 | + | |
20 | + public Promotion findOne(Long pk); | |
21 | + | |
22 | + public Boolean save(Promotion promotion); | |
23 | + | |
24 | + public Boolean update(Promotion promotion); | |
25 | + | |
26 | + public Boolean del(Long id); | |
27 | + | |
28 | +} | ... | ... |
mobsite-man-manager/src/main/java/com/diligrp/mobsite/man/manager/RecipientManager.java
0 → 100644
1 | +package com.diligrp.mobsite.man.manager; | |
2 | + | |
3 | +import com.diligrp.mobsite.man.domain.Recipient; | |
4 | +import com.diligrp.website.util.dao.BaseQuery; | |
5 | +import com.diligrp.website.util.web.PageTemplate; | |
6 | + | |
7 | +/** | |
8 | + * <B>Description</B> <br /> | |
9 | + * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br /> | |
10 | + * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br /> | |
11 | + * <B>Company</B> 地利集团 | |
12 | + * | |
13 | + * @author template | |
14 | + * @createTime 2014-9-24 16:53:44 | |
15 | + */ | |
16 | +public interface RecipientManager { | |
17 | + | |
18 | + public PageTemplate find(BaseQuery bq); | |
19 | + | |
20 | + public Recipient findOne(Long pk); | |
21 | + | |
22 | + public Boolean save(Recipient recipient); | |
23 | + | |
24 | + public Boolean update(Recipient recipient); | |
25 | + | |
26 | + public Boolean del(Long id); | |
27 | + | |
28 | +} | ... | ... |
mobsite-man-manager/src/main/java/com/diligrp/mobsite/man/manager/RegisterNoMapperManager.java
0 → 100644
1 | +package com.diligrp.mobsite.man.manager; | |
2 | + | |
3 | +import com.diligrp.mobsite.getway.domain.RegisterNoMapper; | |
4 | +import com.diligrp.website.util.dao.BaseQuery; | |
5 | +import com.diligrp.website.util.web.PageTemplate; | |
6 | + | |
7 | +import java.util.List; | |
8 | + | |
9 | +/** | |
10 | + * <B>Description</B> <br /> | |
11 | + * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br /> | |
12 | + * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br /> | |
13 | + * <B>Company</B> 地利集团 | |
14 | + * | |
15 | + * @author template | |
16 | + * @createTime 2014-10-16 10:52:44 | |
17 | + */ | |
18 | +public interface RegisterNoMapperManager { | |
19 | + | |
20 | + public PageTemplate find(BaseQuery bq); | |
21 | + | |
22 | + public List<RegisterNoMapper> findByQuery(BaseQuery bq); | |
23 | + | |
24 | + public RegisterNoMapper findOne(Long pk); | |
25 | + | |
26 | + public Boolean save(RegisterNoMapper registerNoMapper); | |
27 | + | |
28 | + public Boolean update(RegisterNoMapper registerNoMapper); | |
29 | + | |
30 | + public Boolean del(Long id); | |
31 | + | |
32 | + void bindRegisterNo(RegisterNoMapper mapper); | |
33 | + | |
34 | + void unBindRegisterNo(RegisterNoMapper mapper); | |
35 | +} | ... | ... |
mobsite-man-manager/src/main/java/com/diligrp/mobsite/man/manager/impl/AppPatchManagerImpl.java
0 → 100644
1 | +package com.diligrp.mobsite.man.manager.impl; | |
2 | + | |
3 | +import java.util.List; | |
4 | + | |
5 | +import org.springframework.beans.factory.annotation.Autowired; | |
6 | +import org.springframework.stereotype.Service; | |
7 | + | |
8 | +import com.diligrp.mobsite.man.dao.AppPatchDao; | |
9 | +import com.diligrp.mobsite.man.domain.AppPatch; | |
10 | +import com.diligrp.mobsite.man.manager.AppPatchManager; | |
11 | +import com.diligrp.website.util.dao.BaseQuery; | |
12 | +import com.diligrp.website.util.security.Validator; | |
13 | + | |
14 | +@Service("appPatchManager") | |
15 | +public class AppPatchManagerImpl implements AppPatchManager { | |
16 | + | |
17 | + @Autowired | |
18 | + private AppPatchDao appPatchDao; | |
19 | + | |
20 | + @Override | |
21 | + public boolean save(AppPatch appPatch) { | |
22 | + // 判断增量是否重复 | |
23 | + List<AppPatch> count = appPatchDao.listAllByCondition( | |
24 | + new BaseQuery().addParam("device_type", appPatch.getDeviceType() + "") | |
25 | + .addParam("version_source_id", appPatch.getVersionSourceId().toString()) | |
26 | + .addParam("version_des_id", appPatch.getVersionDesId().toString())); | |
27 | + if(!Validator.isEmpty(count) && count.size() > 0 ) { | |
28 | + throw new RuntimeException("版本增量包已存在"); | |
29 | + } | |
30 | + | |
31 | + return appPatchDao.save(appPatch); | |
32 | + } | |
33 | + | |
34 | + @Override | |
35 | + public boolean update(AppPatch appPatch) { | |
36 | + // 判断版本号是否重复 | |
37 | + List<AppPatch> count = appPatchDao.listAllByCondition( | |
38 | + new BaseQuery().addParam("device_type", appPatch.getDeviceType() + "") | |
39 | + .addParam("version_source_id", appPatch.getVersionSourceId().toString()) | |
40 | + .addParam("version_des_id", appPatch.getVersionDesId().toString())); | |
41 | + if(!Validator.isEmpty(count) && (count.size() > 1 || !appPatch.getId().equals(count.get(0).getId()))) { | |
42 | + throw new RuntimeException("版本增量包已存在"); | |
43 | + } | |
44 | + return appPatchDao.update(appPatch); | |
45 | + } | |
46 | + | |
47 | + @Override | |
48 | + public boolean deleteById(Long id) { | |
49 | + return appPatchDao.deleteById(id); | |
50 | + } | |
51 | + | |
52 | + @Override | |
53 | + public AppPatch getById(Long id) { | |
54 | + return appPatchDao.getById(id); | |
55 | + } | |
56 | + | |
57 | + @Override | |
58 | + public List<AppPatch> listByCondition(BaseQuery conditions) { | |
59 | + return appPatchDao.listByCondition(conditions); | |
60 | + } | |
61 | + | |
62 | + @Override | |
63 | + public List<AppPatch> listAllByCondition(BaseQuery conditions) { | |
64 | + return appPatchDao.listAllByCondition(conditions); | |
65 | + } | |
66 | + | |
67 | + @Override | |
68 | + public Integer countByCondition(BaseQuery conditions) { | |
69 | + | |
70 | + return appPatchDao.countByCondition(conditions); | |
71 | + } | |
72 | + | |
73 | + | |
74 | +} | ... | ... |
mobsite-man-manager/src/main/java/com/diligrp/mobsite/man/manager/impl/AppVersionManagerImpl.java
0 → 100644
1 | +package com.diligrp.mobsite.man.manager.impl; | |
2 | + | |
3 | +import com.diligrp.mobsite.man.dao.AppVersionDao; | |
4 | +import com.diligrp.mobsite.man.domain.AppVersion; | |
5 | +import com.diligrp.mobsite.man.manager.AppVersionManager; | |
6 | +import com.diligrp.website.util.dao.BaseQuery; | |
7 | +import com.diligrp.website.util.security.Validator; | |
8 | +import org.springframework.stereotype.Service; | |
9 | +import org.springframework.transaction.annotation.Transactional; | |
10 | + | |
11 | +import javax.annotation.Resource; | |
12 | +import java.util.List; | |
13 | + | |
14 | +/** | |
15 | + * | |
16 | + * @ClassName: AppVersionManagerImpl | |
17 | + * @Description: | |
18 | + * @author zhangshirui | |
19 | + * @date 2014年8月8日 下午4:53:59 | |
20 | + */ | |
21 | +@Service("appVersionManager") | |
22 | +public class AppVersionManagerImpl implements AppVersionManager { | |
23 | + | |
24 | + @Resource | |
25 | + private AppVersionDao appVersionDao; | |
26 | + | |
27 | + @Override | |
28 | + @Transactional | |
29 | + public boolean save(AppVersion appVersion) { | |
30 | + // 判断版本号是否重复 | |
31 | + Integer count = appVersionDao.countByCondition( | |
32 | + new BaseQuery().addParam("device_type", appVersion.getDevice_type()+"") | |
33 | + .addParam("versionCode", String.valueOf(appVersion.getVersionCode())) | |
34 | + .addParam("systemType", appVersion.getSystemType())); | |
35 | + if(Validator.isNumber(count+"") && count > 0) { | |
36 | + throw new RuntimeException("该版本号已存在"); | |
37 | + } | |
38 | + // 如果当前为激活状态,则将以前所有数据状态进行重置 | |
39 | + if(AppVersion.STATUS_ACTIVE.equals(appVersion.getStatus())) { | |
40 | + appVersionDao.unActiveByDeviceType(appVersion.getDevice_type()); | |
41 | + } | |
42 | + return appVersionDao.save(appVersion); | |
43 | + } | |
44 | + | |
45 | + @Override | |
46 | + @Transactional | |
47 | + public boolean update(AppVersion appVersion) { | |
48 | + // 判断版本号是否重复 | |
49 | + List<AppVersion> count = appVersionDao.listAllByCondition( | |
50 | + new BaseQuery().addParam("device_type", appVersion.getDevice_type() + "") | |
51 | + .addParam("app_version", appVersion.getApp_version().trim()) | |
52 | + .addParam("systemType", appVersion.getSystemType())); | |
53 | + | |
54 | + // 排除自身 | |
55 | + if(!Validator.isEmpty(count) && (count.size() > 1 || !appVersion.getId().equals(count.get(0).getId()))) { | |
56 | + throw new RuntimeException("版本号已存在"); | |
57 | + } | |
58 | + // 如果当前为激活状态,则将以前所有数据状态进行重置 | |
59 | + if(AppVersion.STATUS_ACTIVE.equals(appVersion.getStatus())) { | |
60 | + appVersionDao.unActiveByDeviceType(appVersion.getDevice_type()); | |
61 | + } | |
62 | + return appVersionDao.update(appVersion); | |
63 | + } | |
64 | + | |
65 | + @Override | |
66 | + public boolean deleteById(Long id) { | |
67 | + return appVersionDao.deleteById(id); | |
68 | + } | |
69 | + | |
70 | + @Override | |
71 | + public AppVersion getById(Long id) { | |
72 | + return appVersionDao.getById(id); | |
73 | + } | |
74 | + | |
75 | + @Override | |
76 | + public List<AppVersion> listByCondition(BaseQuery conditions) { | |
77 | + return appVersionDao.listByCondition(conditions); | |
78 | + } | |
79 | + | |
80 | + @Override | |
81 | + public List<AppVersion> listAllByCondition(BaseQuery conditions) { | |
82 | + return appVersionDao.listAllByCondition(conditions); | |
83 | + } | |
84 | + | |
85 | + @Override | |
86 | + public Integer countByCondition(BaseQuery conditions) { | |
87 | + return appVersionDao.countByCondition(conditions); | |
88 | + } | |
89 | + | |
90 | + | |
91 | +} | ... | ... |
mobsite-man-manager/src/main/java/com/diligrp/mobsite/man/manager/impl/DemoManagerImpl.java
0 → 100644
1 | +package com.diligrp.mobsite.man.manager.impl; | |
2 | + | |
3 | +import com.diligrp.mobsite.man.manager.DemoManager; | |
4 | + | |
5 | + | |
6 | +/** | |
7 | + * <B>Description</B> TODO <br /> | |
8 | + * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br /> | |
9 | + * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br /> | |
10 | + * <B>Company</B> 地利集团 | |
11 | + * @createTime Aug 5, 2014 4:22:13 PM | |
12 | + * @author wujianjun | |
13 | + */ | |
14 | +public class DemoManagerImpl implements DemoManager { | |
15 | + | |
16 | +} | ... | ... |
mobsite-man-manager/src/main/java/com/diligrp/mobsite/man/manager/impl/FeedbackManagerImpl.java
0 → 100644
1 | +package com.diligrp.mobsite.man.manager.impl; | |
2 | + | |
3 | +import com.diligrp.mobsite.man.dao.FeedbackDao; | |
4 | +import com.diligrp.mobsite.man.domain.Feedback; | |
5 | +import com.diligrp.mobsite.man.manager.FeedbackManager; | |
6 | +import com.diligrp.mobsite.man.rpc.ConfigRPC; | |
7 | +import com.diligrp.mobsite.man.rpc.MarketRPC; | |
8 | +import com.diligrp.website.util.dao.BaseQuery; | |
9 | +import com.diligrp.website.util.security.Validator; | |
10 | +import com.diligrp.website.util.web.PageTemplate; | |
11 | +import com.diligrp.website.web.interfaces.domain.output.PickUpPointResp; | |
12 | +import org.slf4j.Logger; | |
13 | +import org.slf4j.LoggerFactory; | |
14 | +import org.springframework.beans.factory.annotation.Autowired; | |
15 | +import org.springframework.stereotype.Component; | |
16 | + | |
17 | +import javax.annotation.Resource; | |
18 | +import java.util.List; | |
19 | + | |
20 | +/** | |
21 | + * <B>Description</B> <br /> | |
22 | + * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br /> | |
23 | + * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br /> | |
24 | + * <B>Company</B> 地利集团 | |
25 | + * | |
26 | + * @author template | |
27 | + * @createTime 2014-9-24 16:53:43 | |
28 | + */ | |
29 | +@Component | |
30 | +public class FeedbackManagerImpl implements FeedbackManager { | |
31 | + private final static Logger LOG = LoggerFactory | |
32 | + .getLogger(FeedbackManagerImpl.class); | |
33 | + | |
34 | + @Autowired | |
35 | + private FeedbackDao feedbackDao; | |
36 | + @Resource | |
37 | + private ConfigRPC configRPC; | |
38 | + | |
39 | + public PageTemplate find(BaseQuery bq) { | |
40 | + List<Feedback> list = feedbackDao.listByCondition(bq); | |
41 | + int totalSize = feedbackDao.countByCondition(bq); | |
42 | +// PickUpPointResp pickupAddress = null; | |
43 | +// for (Feedback feedback : list) { | |
44 | +// pickupAddress = configRPC.getPickupAddress(feedback.getMarketId()); | |
45 | +// feedback.setMarketName(Validator.isNull(pickupAddress) ? "--":pickupAddress.getPickName()); | |
46 | +// } | |
47 | + return PageTemplate.create(bq, totalSize, list); | |
48 | + } | |
49 | + | |
50 | + public Feedback findOne(Long pk) { | |
51 | + return feedbackDao.getById(pk); | |
52 | + } | |
53 | + | |
54 | + public Boolean save(Feedback feedback) { | |
55 | + return feedbackDao.save(feedback); | |
56 | + } | |
57 | + | |
58 | + public Boolean update(Feedback feedback) { | |
59 | + return feedbackDao.update(feedback); | |
60 | + } | |
61 | + | |
62 | + public Boolean del(Long id) { | |
63 | + return feedbackDao.deleteById(id); | |
64 | + } | |
65 | + | |
66 | +} | ... | ... |
mobsite-man-manager/src/main/java/com/diligrp/mobsite/man/manager/impl/PromotionManagerImpl.java
0 → 100644
1 | +package com.diligrp.mobsite.man.manager.impl; | |
2 | + | |
3 | +import com.diligrp.mobsite.man.dao.PromotionDao; | |
4 | +import com.diligrp.mobsite.man.domain.Feedback; | |
5 | +import com.diligrp.mobsite.man.domain.Promotion; | |
6 | +import com.diligrp.mobsite.man.manager.PromotionManager; | |
7 | +import com.diligrp.mobsite.man.rpc.ConfigRPC; | |
8 | +import com.diligrp.website.util.dao.BaseQuery; | |
9 | +import com.diligrp.website.util.security.Validator; | |
10 | +import com.diligrp.website.util.web.PageTemplate; | |
11 | +import com.diligrp.website.web.interfaces.domain.output.PickUpPointResp; | |
12 | +import org.slf4j.Logger; | |
13 | +import org.slf4j.LoggerFactory; | |
14 | +import org.springframework.beans.factory.annotation.Autowired; | |
15 | +import org.springframework.stereotype.Component; | |
16 | +import org.springframework.transaction.annotation.Transactional; | |
17 | + | |
18 | +import javax.annotation.Resource; | |
19 | +import java.util.List; | |
20 | + | |
21 | +/** | |
22 | + * <B>Description</B> <br /> | |
23 | + * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br /> | |
24 | + * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br /> | |
25 | + * <B>Company</B> 地利集团 | |
26 | + * | |
27 | + * @author template | |
28 | + * @createTime 2014-9-24 16:53:43 | |
29 | + */ | |
30 | +@Component | |
31 | +public class PromotionManagerImpl implements PromotionManager { | |
32 | + private final static Logger LOG = LoggerFactory | |
33 | + .getLogger(PromotionManagerImpl.class); | |
34 | + | |
35 | + @Autowired | |
36 | + private PromotionDao promotionDao; | |
37 | + @Resource | |
38 | + private ConfigRPC configRPC; | |
39 | + | |
40 | + public PageTemplate find(BaseQuery bq) { | |
41 | + List<Promotion> list = promotionDao.listByCondition(bq); | |
42 | + int totalSize = promotionDao.countByCondition(bq); | |
43 | + PickUpPointResp pickupAddress = null; | |
44 | + for (Promotion item : list) { | |
45 | + pickupAddress = configRPC.getPickupAddress(item.getMarketId()); | |
46 | + item.setMarketName(Validator.isNull(pickupAddress) ? "--":pickupAddress.getPickName()); | |
47 | + } | |
48 | + return PageTemplate.create(bq, totalSize, list); | |
49 | + } | |
50 | + | |
51 | + public Promotion findOne(Long pk) { | |
52 | + return promotionDao.getById(pk); | |
53 | + } | |
54 | + | |
55 | + public Boolean save(Promotion promotion) { | |
56 | + return promotionDao.save(promotion); | |
57 | + } | |
58 | + | |
59 | + public Boolean update(Promotion promotion) { | |
60 | + return promotionDao.update(promotion); | |
61 | + } | |
62 | + | |
63 | + public Boolean del(Long id) { | |
64 | + return promotionDao.deleteById(id); | |
65 | + } | |
66 | + | |
67 | +} | ... | ... |
mobsite-man-manager/src/main/java/com/diligrp/mobsite/man/manager/impl/RecipientManagerImpl.java
0 → 100644
1 | +package com.diligrp.mobsite.man.manager.impl; | |
2 | + | |
3 | +import com.diligrp.mobsite.man.dao.RecipientDao; | |
4 | +import com.diligrp.mobsite.man.domain.Recipient; | |
5 | +import com.diligrp.mobsite.man.manager.RecipientManager; | |
6 | +import com.diligrp.website.util.dao.BaseQuery; | |
7 | +import com.diligrp.website.util.web.PageTemplate; | |
8 | +import org.slf4j.Logger; | |
9 | +import org.slf4j.LoggerFactory; | |
10 | +import org.springframework.beans.factory.annotation.Autowired; | |
11 | +import org.springframework.stereotype.Component; | |
12 | + | |
13 | +import java.util.List; | |
14 | + | |
15 | +/** | |
16 | + * <B>Description</B> <br /> | |
17 | + * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br /> | |
18 | + * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br /> | |
19 | + * <B>Company</B> 地利集团 | |
20 | + * | |
21 | + * @author template | |
22 | + * @createTime 2014-9-24 16:53:44 | |
23 | + */ | |
24 | +@Component | |
25 | +public class RecipientManagerImpl implements RecipientManager { | |
26 | + private final static Logger LOG = LoggerFactory | |
27 | + .getLogger(RecipientManagerImpl.class); | |
28 | + | |
29 | + @Autowired | |
30 | + private RecipientDao recipientDao; | |
31 | + | |
32 | + public PageTemplate find(BaseQuery bq) { | |
33 | + List<Recipient> list = recipientDao.listByCondition(bq); | |
34 | + int totalSize = recipientDao.countByCondition(bq); | |
35 | + return PageTemplate.create(bq, totalSize, list); | |
36 | + } | |
37 | + | |
38 | + public Recipient findOne(Long pk) { | |
39 | + return recipientDao.getById(pk); | |
40 | + } | |
41 | + | |
42 | + public Boolean save(Recipient recipient) { | |
43 | + return recipientDao.save(recipient); | |
44 | + } | |
45 | + | |
46 | + public Boolean update(Recipient recipient) { | |
47 | + return recipientDao.update(recipient); | |
48 | + } | |
49 | + | |
50 | + public Boolean del(Long id) { | |
51 | + return recipientDao.deleteById(id); | |
52 | + } | |
53 | + | |
54 | +} | ... | ... |
mobsite-man-manager/src/main/java/com/diligrp/mobsite/man/manager/impl/RegisterNoMapperManagerImpl.java
0 → 100644
1 | +package com.diligrp.mobsite.man.manager.impl; | |
2 | + | |
3 | +import com.diligrp.mobsite.getway.domain.RegisterNoMapper; | |
4 | +import com.diligrp.mobsite.man.dao.RegisterNoMapperDao; | |
5 | +import com.diligrp.mobsite.man.manager.RegisterNoMapperManager; | |
6 | +import com.diligrp.website.util.dao.BaseQuery; | |
7 | +import com.diligrp.website.util.security.Validator; | |
8 | +import com.diligrp.website.util.web.PageTemplate; | |
9 | +import org.slf4j.Logger; | |
10 | +import org.slf4j.LoggerFactory; | |
11 | +import org.springframework.beans.factory.annotation.Autowired; | |
12 | +import org.springframework.stereotype.Component; | |
13 | + | |
14 | +import java.util.List; | |
15 | + | |
16 | +/** | |
17 | + * <B>Description</B> <br /> | |
18 | + * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br /> | |
19 | + * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br /> | |
20 | + * <B>Company</B> 地利集团 | |
21 | + * | |
22 | + * @author template | |
23 | + * @createTime 2014-10-16 10:52:44 | |
24 | + */ | |
25 | +@Component | |
26 | +public class RegisterNoMapperManagerImpl implements RegisterNoMapperManager { | |
27 | + private final static Logger LOG = LoggerFactory | |
28 | + .getLogger(RegisterNoMapperManagerImpl.class); | |
29 | + | |
30 | + @Autowired | |
31 | + private RegisterNoMapperDao registerNoMapperDao; | |
32 | + | |
33 | + public PageTemplate find(BaseQuery bq) { | |
34 | + List<RegisterNoMapper> list = registerNoMapperDao.listByCondition(bq); | |
35 | + int totalSize = registerNoMapperDao.countByCondition(bq); | |
36 | + return PageTemplate.create(bq, totalSize, list); | |
37 | + } | |
38 | + | |
39 | + @Override | |
40 | + public List<RegisterNoMapper> findByQuery(BaseQuery bq) { | |
41 | + return registerNoMapperDao.listByCondition(bq); | |
42 | + } | |
43 | + | |
44 | + public RegisterNoMapper findOne(Long pk) { | |
45 | + return registerNoMapperDao.getById(pk); | |
46 | + } | |
47 | + | |
48 | + public Boolean save(RegisterNoMapper registerNoMapper) { | |
49 | + return registerNoMapperDao.save(registerNoMapper); | |
50 | + } | |
51 | + | |
52 | + public Boolean update(RegisterNoMapper registerNoMapper) { | |
53 | + return registerNoMapperDao.update(registerNoMapper); | |
54 | + } | |
55 | + | |
56 | + public Boolean del(Long id) { | |
57 | + return registerNoMapperDao.deleteById(id); | |
58 | + } | |
59 | + | |
60 | + @Override | |
61 | + public void bindRegisterNo(RegisterNoMapper mapper) { | |
62 | + final List<RegisterNoMapper> registerNoMappers = findByQuery(new BaseQuery() | |
63 | + .addParam("userid", mapper.getUserid() + "").addParam("registerNo", mapper.getRegisterNo()) | |
64 | + .addParam("sysFlag", mapper.getSysFlag() + "")); | |
65 | + if (!Validator.isEmpty(registerNoMappers)) { | |
66 | + return; | |
67 | + } | |
68 | + save(mapper); | |
69 | + } | |
70 | + | |
71 | + @Override | |
72 | + public void unBindRegisterNo(RegisterNoMapper mapper) { | |
73 | + final List<RegisterNoMapper> registerNoMappers = findByQuery(new BaseQuery() | |
74 | + .addParam("userid", mapper.getUserid() + "").addParam("registerNo", mapper.getRegisterNo()) | |
75 | + .addParam("sysFlag", mapper.getSysFlag() + "")); | |
76 | + if (!Validator.isEmpty(registerNoMappers)) { | |
77 | + for (RegisterNoMapper registerNoMapper : registerNoMappers) { | |
78 | + del(registerNoMapper.getId()); | |
79 | + } | |
80 | + } | |
81 | + } | |
82 | + | |
83 | +} | ... | ... |
mobsite-man-rpc/pom.xml
0 → 100644
1 | +<?xml version="1.0"?> | |
2 | +<project | |
3 | + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" | |
4 | + xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | |
5 | + <modelVersion>4.0.0</modelVersion> | |
6 | + | |
7 | + <parent> | |
8 | + <groupId>com.diligrp.mobsite</groupId> | |
9 | + <artifactId>mobsite-man</artifactId> | |
10 | + <version>0.0.1-SNAPSHOT</version> | |
11 | + </parent> | |
12 | + <artifactId>mobsite-man-rpc</artifactId> | |
13 | + <name>mobsite-man-rpc</name> | |
14 | + <url>http://maven.apache.org</url> | |
15 | + <properties> | |
16 | + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | |
17 | + </properties> | |
18 | + <dependencies> | |
19 | + <dependency> | |
20 | + <groupId>com.diligrp.mobsite</groupId> | |
21 | + <artifactId>mobsite-man-dao</artifactId> | |
22 | + <version>0.0.1-SNAPSHOT</version> | |
23 | + </dependency> | |
24 | + <dependency> | |
25 | + <groupId>com.diligrp.mobsite</groupId> | |
26 | + <artifactId>mobsite-man-domain</artifactId> | |
27 | + <version>0.0.1-SNAPSHOT</version> | |
28 | + </dependency> | |
29 | + <dependency> | |
30 | + <groupId>commons-httpclient</groupId> | |
31 | + <artifactId>commons-httpclient</artifactId> | |
32 | + <version>2.0</version> | |
33 | + </dependency> | |
34 | + <dependency> | |
35 | + <groupId>org.apache.httpcomponents</groupId> | |
36 | + <artifactId>httpclient</artifactId> | |
37 | + <version>4.3.3</version> | |
38 | + </dependency> | |
39 | + <dependency> | |
40 | + <groupId>com.diligrp.store</groupId> | |
41 | + <artifactId>diligrp-store-sdk</artifactId> | |
42 | + <version>0.0.1-SNAPSHOT</version> | |
43 | + </dependency> | |
44 | + </dependencies> | |
45 | +</project> | ... | ... |
mobsite-man-rpc/src/main/java/com/diligrp/mobsite/man/rpc/ConfigRPC.java
0 → 100644
1 | +package com.diligrp.mobsite.man.rpc; | |
2 | + | |
3 | +import com.diligrp.website.util.domain.Result; | |
4 | +import com.diligrp.website.web.interfaces.domain.output.CityResp; | |
5 | + | |
6 | +import java.util.List; | |
7 | + | |
8 | + | |
9 | +/** | |
10 | + * <B>Description</B> 获取配置的rpc <br /> | |
11 | + * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br /> | |
12 | + * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br /> | |
13 | + * <B>Company</B> 地利集团 | |
14 | + * @createTime May 27, 2014 11:35:25 AM | |
15 | + * @author wujianjun | |
16 | + */ | |
17 | +public interface ConfigRPC { | |
18 | + | |
19 | + Result getStockCycle(); | |
20 | + | |
21 | + Result getPackUpAddress(); | |
22 | + | |
23 | + Result getTermOfValidity(); | |
24 | + | |
25 | + Result getMeasuringUnit(); | |
26 | + | |
27 | + /** | |
28 | + * 获取地利订单服务 | |
29 | + * | |
30 | + * @return | |
31 | + */ | |
32 | + public Result getDiliOrderService(); | |
33 | + | |
34 | + /** | |
35 | + * 获取退款理由 | |
36 | + */ | |
37 | + public Result getRefundOrderReson(); | |
38 | + | |
39 | + /** | |
40 | + * 获取取消理由 | |
41 | + */ | |
42 | + public Result getcancelOrderReson(); | |
43 | + | |
44 | + /** | |
45 | + * 获取地利销售服务 | |
46 | + * @return | |
47 | + */ | |
48 | + public Result getDiliSaleService(); | |
49 | + | |
50 | + /** | |
51 | + * 获取地利采购服务 | |
52 | + * @return | |
53 | + */ | |
54 | + public Result getDiliBuyService(); | |
55 | + | |
56 | + /** | |
57 | + * 根据CODE返回服务详情 | |
58 | + * @param code | |
59 | + * @return | |
60 | + */ | |
61 | + public Result getServiceByCode(String code); | |
62 | + | |
63 | + /** | |
64 | + * 根据CODE返回数据字典 | |
65 | + * @param code | |
66 | + * @return | |
67 | + */ | |
68 | + public Result getDataDictionary(String code); | |
69 | + | |
70 | + List<String> getPrivateDomain(); | |
71 | + | |
72 | + List<CityResp> listAddressById(long addrId); | |
73 | + | |
74 | + List<CityResp> listChildrenAddressById(int parentId); | |
75 | + | |
76 | + /** | |
77 | + * | |
78 | + * 获取客服热线电话 | |
79 | + * @return | |
80 | + * @createTime 2014年7月18日 下午3:27:50 | |
81 | + * @author yangweidong | |
82 | + */ | |
83 | + public String getCustomerPhone(); | |
84 | + | |
85 | + com.diligrp.website.web.interfaces.domain.output.PickUpPointResp getPickupAddress(Long packupId); | |
86 | + | |
87 | + com.diligrp.website.web.interfaces.domain.output.DataDictionaryValueResp getSaleUnitById(Long saleUnitId); | |
88 | +} | ... | ... |
mobsite-man-rpc/src/main/java/com/diligrp/mobsite/man/rpc/MarketRPC.java
0 → 100644
1 | +package com.diligrp.mobsite.man.rpc; | |
2 | + | |
3 | +import com.diligrp.website.web.interfaces.domain.output.PickUpPointResp; | |
4 | + | |
5 | +import java.util.List; | |
6 | + | |
7 | + | |
8 | +/** | |
9 | + * <B>Description</B> 市场 <br /> | |
10 | + * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br /> | |
11 | + * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br /> | |
12 | + * <B>Company</B> 地利集团 | |
13 | + * @createTime 2014年8月21日 下午5:50:28 | |
14 | + * @author zhangshirui | |
15 | + */ | |
16 | +public interface MarketRPC { | |
17 | + | |
18 | + public List<PickUpPointResp> getMarkets(); | |
19 | + | |
20 | + /** | |
21 | + * 根据提货点id查询提货点id | |
22 | + * @param id | |
23 | + * @return | |
24 | + */ | |
25 | + public PickUpPointResp getMarketById(Long id); | |
26 | + | |
27 | +} | ... | ... |
mobsite-man-rpc/src/main/java/com/diligrp/mobsite/man/rpc/SearchRPC.java
0 → 100644
1 | +package com.diligrp.mobsite.man.rpc; | |
2 | + | |
3 | +import java.util.List; | |
4 | + | |
5 | +import com.diligrp.titan.sdk.domain.Category; | |
6 | +import com.diligrp.website.util.dao.BaseQuery; | |
7 | +import com.diligrp.website.util.web.PageTemplate; | |
8 | + | |
9 | +/** | |
10 | + * <B>Description</B> 搜索 <br /> | |
11 | + * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br /> | |
12 | + * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br /> | |
13 | + * <B>Company</B> 地利集团 | |
14 | + * | |
15 | + * @author wujianjun | |
16 | + * @createTime 2014/10/14 11:03 | |
17 | + */ | |
18 | +public interface SearchRPC { | |
19 | + PageTemplate searchShopList(BaseQuery baseQuery); | |
20 | + | |
21 | + PageTemplate searchGoodsList(BaseQuery baseQuery); | |
22 | + | |
23 | + List<Category> searchCategoryList(String categoryName); | |
24 | + | |
25 | + Category getCategoryById(Long id); | |
26 | + | |
27 | +} | ... | ... |
mobsite-man-rpc/src/main/java/com/diligrp/mobsite/man/rpc/StoreRPC.java
0 → 100644
1 | +package com.diligrp.mobsite.man.rpc; | |
2 | + | |
3 | + | |
4 | + | |
5 | +/** | |
6 | + * <B>Description</B> 上传图片rpc <br /> | |
7 | + * <B>Copyright</B> Copyright (c) 2015 www.diligrp.com All rights reserved. <br /> | |
8 | + * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br /> | |
9 | + * <B>Company</B> 地利集团 | |
10 | + * @createTime 2015年3月11日 上午11:09:52 | |
11 | + * @author zhangshirui | |
12 | + */ | |
13 | +public interface StoreRPC { | |
14 | + | |
15 | + String uploadFile(byte[] file,String bucket,String fileType); | |
16 | + | |
17 | +} | ... | ... |
mobsite-man-rpc/src/main/java/com/diligrp/mobsite/man/rpc/impl/ConfigRPCImpl.java
0 → 100644
1 | +package com.diligrp.mobsite.man.rpc.impl; | |
2 | + | |
3 | +import com.diligrp.mobsite.man.rpc.ConfigRPC; | |
4 | +import com.diligrp.website.util.domain.Result; | |
5 | +import com.diligrp.website.util.redis.RedisUtil; | |
6 | +import com.diligrp.website.util.security.Validator; | |
7 | +import com.diligrp.website.web.interfaces.WebsiteClient; | |
8 | +import com.diligrp.website.web.interfaces.domain.input.DiliServiceParam; | |
9 | +import com.diligrp.website.web.interfaces.domain.output.CityResp; | |
10 | +import com.diligrp.website.web.interfaces.domain.output.DataDictionaryResp; | |
11 | +import com.diligrp.website.web.interfaces.domain.output.DiliServiceResp; | |
12 | +import com.diligrp.website.web.interfaces.domain.output.PickUpPointResp; | |
13 | +import com.diligrp.website.web.interfaces.domain.output.SysConfigResp; | |
14 | +import org.springframework.beans.factory.annotation.Autowired; | |
15 | +import org.springframework.stereotype.Service; | |
16 | + | |
17 | +import javax.annotation.Resource; | |
18 | +import java.util.Arrays; | |
19 | +import java.util.List; | |
20 | + | |
21 | +/** | |
22 | + * <B>Description</B> 系统配置RPC客户端实现 <br /> | |
23 | + * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br /> | |
24 | + * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br /> | |
25 | + * <B>Company</B> 地利集团 | |
26 | + * | |
27 | + * @author wujianjun | |
28 | + * @createTime May 27, 2014 11:35:52 AM | |
29 | + */ | |
30 | +@Service | |
31 | +public class ConfigRPCImpl implements ConfigRPC { | |
32 | + | |
33 | + private static final String DIC_PRIVATE_DOMAIN = "PRIVATE_DOMAIN"; | |
34 | + private static final String CLIENT_SERVICE_HOT_LINE = "CLIENT_SERVICE_HOT_LINE"; | |
35 | + private static final String DIC_REORDER_CANCEL_REASON = "DIC_REORDER_CANCEL_REASON"; | |
36 | + private static final String DIC_REORDER_APPLY_REASON = "DIC_REORDER_APPLY_REASON"; | |
37 | + private static final String DIC_MEASURING_UNIT = "DIC_MEASURING_UNIT"; | |
38 | + private static final String DIC_TERM_OF_VALIDITY_SELLER = "DIC_TERM_OF_VALIDITY_SELLER"; | |
39 | + private static final String DIC_PACKUP_ADDRESS = "DIC_PACKUP_ADDRESS"; | |
40 | + private static final String DIC_STOCK_CYCLE = "DIC_STOCK_CYCLE"; | |
41 | + private static final String DIC_DILI_SALE_SERVICE = "DIC_DILI_SALE_SERVICE"; | |
42 | + private static final String DIC_DILI_BUY_SERVICE = "DIC_DILI_BUY_SERVICE"; | |
43 | + private static final String DIC_DILI_ORDER_SERVICE = "DIC_DILI_ORDER_SERVICE"; | |
44 | + private static final int EXPIRE_TIME = 5 * 60; | |
45 | + private static final int CLIENT_SERVICE_HOT_LINE_TIME = 60 * 60 * 24; | |
46 | + @Autowired | |
47 | + private WebsiteClient websiteClient; | |
48 | + @Resource(name = "redisUtils") | |
49 | + private RedisUtil redisUtil; | |
50 | + private String redisStockCycleKey; | |
51 | + private String redisPackupAddrKey; | |
52 | + private String redisTermOfValidityKey; | |
53 | + private String redisMeasuringUnitKey; | |
54 | + private String redisReorderApplyReasonKey; | |
55 | + private String redisReorderCancelReasonKey; | |
56 | + private String redisDiliSaleServiceKey; | |
57 | + private String redisDiliBuyServiceKey; | |
58 | + private String redisPrivateDomainKey; | |
59 | + private String redisDiliOrderServiceKey; | |
60 | + | |
61 | + @Override | |
62 | + public Result getStockCycle() { | |
63 | + if (Validator.isEmpty(redisStockCycleKey)) { | |
64 | + redisStockCycleKey = redisUtil.makeKey(DIC_STOCK_CYCLE, null); | |
65 | + } | |
66 | + DataDictionaryResp data = redisUtil.getObject(redisStockCycleKey, DataDictionaryResp.class); | |
67 | + if (Validator.isNull(data)) { | |
68 | + data = websiteClient.getDataDictionaryService().getDataDictionary(DIC_STOCK_CYCLE); | |
69 | + redisUtil.setObjectByExpire(redisStockCycleKey, data, EXPIRE_TIME); | |
70 | + } | |
71 | + return Result.create(data); | |
72 | + } | |
73 | + | |
74 | + @Override | |
75 | + public Result getPackUpAddress() { | |
76 | + if (Validator.isEmpty(redisPackupAddrKey)) { | |
77 | + redisPackupAddrKey = redisUtil.makeKey(DIC_PACKUP_ADDRESS, null); | |
78 | + } | |
79 | + DataDictionaryResp data = redisUtil.getObject(redisPackupAddrKey, DataDictionaryResp.class); | |
80 | + if (Validator.isNull(data)) { | |
81 | + data = websiteClient.getDataDictionaryService().getDataDictionary(DIC_PACKUP_ADDRESS); | |
82 | + redisUtil.setObjectByExpire(redisPackupAddrKey, data, EXPIRE_TIME); | |
83 | + } | |
84 | + return Result.create(data); | |
85 | + } | |
86 | + | |
87 | + @Override | |
88 | + public Result getTermOfValidity() { | |
89 | + if (Validator.isEmpty(redisTermOfValidityKey)) { | |
90 | + redisTermOfValidityKey = redisUtil.makeKey( | |
91 | + DIC_TERM_OF_VALIDITY_SELLER, null); | |
92 | + } | |
93 | + DataDictionaryResp data = redisUtil.getObject(redisTermOfValidityKey, DataDictionaryResp.class); | |
94 | + if (Validator.isNull(data)) { | |
95 | + data = websiteClient.getDataDictionaryService().getDataDictionary(DIC_TERM_OF_VALIDITY_SELLER); | |
96 | + redisUtil.setObjectByExpire(redisTermOfValidityKey, data, EXPIRE_TIME); | |
97 | + } | |
98 | + return Result.create(data); | |
99 | + } | |
100 | + | |
101 | + @Override | |
102 | + public Result getMeasuringUnit() { | |
103 | + if (Validator.isEmpty(redisMeasuringUnitKey)) { | |
104 | + redisMeasuringUnitKey = redisUtil.makeKey(DIC_MEASURING_UNIT, null); | |
105 | + } | |
106 | + DataDictionaryResp data = redisUtil.getObject(redisMeasuringUnitKey, DataDictionaryResp.class); | |
107 | + if (Validator.isNull(data)) { | |
108 | + data = websiteClient.getDataDictionaryService().getDataDictionary(DIC_MEASURING_UNIT); | |
109 | + redisUtil.setObjectByExpire(redisMeasuringUnitKey, data, EXPIRE_TIME); | |
110 | + } | |
111 | + return Result.create(data); | |
112 | + } | |
113 | + | |
114 | + /** | |
115 | + * 获取地利订单服务 | |
116 | + * | |
117 | + * @return | |
118 | + */ | |
119 | + public Result getDiliOrderService() { | |
120 | + if (Validator.isEmpty(redisDiliOrderServiceKey)) { | |
121 | + redisDiliOrderServiceKey = redisUtil.makeKey( | |
122 | + DIC_DILI_ORDER_SERVICE, null); | |
123 | + } | |
124 | + List<DiliServiceResp> data = redisUtil.getList(redisDiliOrderServiceKey, DiliServiceResp.class); | |
125 | + if (Validator.isEmpty(data)) { | |
126 | + data = websiteClient.getDiliServiceService() | |
127 | + .listDiliService(DiliServiceParam.Status.PUTAWAY, | |
128 | + DiliServiceParam.Type.ORDER, null); | |
129 | + redisUtil.setObjectByExpire(redisDiliOrderServiceKey, data, EXPIRE_TIME); | |
130 | + } | |
131 | + return Result.create(data); | |
132 | + } | |
133 | + | |
134 | + @Override | |
135 | + public Result getRefundOrderReson() { | |
136 | + if (Validator.isEmpty(redisReorderApplyReasonKey)) { | |
137 | + redisReorderApplyReasonKey = redisUtil.makeKey( | |
138 | + DIC_REORDER_APPLY_REASON, null); | |
139 | + } | |
140 | + DataDictionaryResp data = redisUtil.getObject(redisReorderApplyReasonKey, DataDictionaryResp.class); | |
141 | + if (Validator.isNull(data)) { | |
142 | + data = websiteClient.getDataDictionaryService().getDataDictionary(DIC_REORDER_APPLY_REASON); | |
143 | + redisUtil.setObjectByExpire(redisReorderApplyReasonKey, data, EXPIRE_TIME); | |
144 | + } | |
145 | + return Result.create(data); | |
146 | + } | |
147 | + | |
148 | + @Override | |
149 | + public Result getDataDictionary(String code) { | |
150 | + String key = redisUtil.makeKey(code, null); | |
151 | + DataDictionaryResp data = redisUtil.getObject(key, DataDictionaryResp.class); | |
152 | + if (Validator.isNull(data)) { | |
153 | + data = websiteClient.getDataDictionaryService().getDataDictionary(code); | |
154 | + redisUtil.setObjectByExpire(key, data, EXPIRE_TIME); | |
155 | + } | |
156 | + return Result.create(data); | |
157 | + } | |
158 | + | |
159 | + /** | |
160 | + * 获取地利销售服务 | |
161 | + * | |
162 | + * @return | |
163 | + */ | |
164 | + public Result getDiliSaleService() { | |
165 | + if (Validator.isEmpty(redisDiliSaleServiceKey)) { | |
166 | + redisDiliSaleServiceKey = redisUtil.makeKey(DIC_DILI_SALE_SERVICE, | |
167 | + null); | |
168 | + } | |
169 | + List<DiliServiceResp> data = redisUtil.getList(redisDiliSaleServiceKey, DiliServiceResp.class); | |
170 | + if (Validator.isEmpty(data)) { | |
171 | + data = websiteClient.getDiliServiceService() | |
172 | + .listDiliService(DiliServiceParam.Status.PUTAWAY, null, DiliServiceParam.Category.SALE); | |
173 | + redisUtil.setObjectByExpire(redisDiliSaleServiceKey, data, EXPIRE_TIME); | |
174 | + } | |
175 | + return Result.create(data); | |
176 | + } | |
177 | + | |
178 | + /** | |
179 | + * 获取地利采购服务 | |
180 | + * | |
181 | + * @return | |
182 | + */ | |
183 | + public Result getDiliBuyService() { | |
184 | + if (Validator.isEmpty(redisDiliBuyServiceKey)) { | |
185 | + redisDiliBuyServiceKey = redisUtil.makeKey(DIC_DILI_BUY_SERVICE, | |
186 | + null); | |
187 | + } | |
188 | + List<DiliServiceResp> data = redisUtil.getList(redisDiliBuyServiceKey, DiliServiceResp.class); | |
189 | + if (Validator.isEmpty(data)) { | |
190 | + data = websiteClient.getDiliServiceService() | |
191 | + .listDiliService(DiliServiceParam.Status.PUTAWAY, null, DiliServiceParam.Category.PURCHASE); | |
192 | + redisUtil.setObjectByExpire(redisDiliBuyServiceKey, data, EXPIRE_TIME); | |
193 | + } | |
194 | + return Result.create(data); | |
195 | + } | |
196 | + | |
197 | + /** | |
198 | + * 根据CODE返回服务详情 | |
199 | + * | |
200 | + * @param code | |
201 | + * @return | |
202 | + */ | |
203 | + public Result getServiceByCode(String code) { | |
204 | + String redisKey = redisUtil.makeKey("DILI_SERVICE", code); | |
205 | + DiliServiceResp data = redisUtil.getObject(redisKey, DiliServiceResp.class); | |
206 | + if (Validator.isNull(data)) { | |
207 | + data = websiteClient.getDiliServiceService().getDiliServiceByCode(code); | |
208 | + redisUtil.setObjectByExpire(redisKey, data, EXPIRE_TIME); | |
209 | + } | |
210 | + return Result.create(data); | |
211 | + } | |
212 | + | |
213 | + public Result getcancelOrderReson() { | |
214 | + if (Validator.isEmpty(redisReorderCancelReasonKey)) { | |
215 | + redisReorderCancelReasonKey = redisUtil.makeKey( | |
216 | + DIC_REORDER_CANCEL_REASON, null); | |
217 | + } | |
218 | + DataDictionaryResp data = redisUtil.getObject(redisReorderCancelReasonKey, DataDictionaryResp.class); | |
219 | + if (Validator.isNull(data)) { | |
220 | + data = websiteClient.getDataDictionaryService().getDataDictionary(DIC_REORDER_CANCEL_REASON); | |
221 | + redisUtil.setObjectByExpire(redisReorderCancelReasonKey, data, EXPIRE_TIME); | |
222 | + } | |
223 | + return Result.create(data); | |
224 | + } | |
225 | + | |
226 | + @Override | |
227 | + public List<String> getPrivateDomain() { | |
228 | +// if (Validator.isEmpty(redisPrivateDomainKey)) { | |
229 | +// redisPrivateDomainKey = redisUtil.makeKey(DIC_PRIVATE_DOMAIN, null); | |
230 | +// } | |
231 | +// List<String> data = redisUtil.getList(redisPrivateDomainKey, String.class); | |
232 | +// if(!Validator.isEmpty(data)) { | |
233 | +// return data; | |
234 | +// } | |
235 | + SysConfigResp configResp = websiteClient.getSysConfigService().getSysConfig(DIC_PRIVATE_DOMAIN); | |
236 | + if (Validator.isNull(configResp) || Validator.isEmpty(configResp.getValue())) { | |
237 | + return null; | |
238 | + } | |
239 | + List<String> data = Arrays.asList(configResp.getValue().toLowerCase().split(",")); | |
240 | +// redisUtil.setObjectByExpire(redisPrivateDomainKey, data, EXPIRE_TIME); | |
241 | + return data; | |
242 | + } | |
243 | + | |
244 | + @Override | |
245 | + public List<CityResp> listAddressById(long addrId) { | |
246 | + String redisKey = redisUtil.makeKey("DILI_CITY", addrId + ""); | |
247 | + List<CityResp> data = redisUtil.getList(redisKey, CityResp.class); | |
248 | + if (Validator.isEmpty(data)) { | |
249 | + data = websiteClient.getCityService().getParentCityListById(Long.valueOf(addrId).intValue()); | |
250 | + redisUtil.setObjectByExpire(redisKey, data, EXPIRE_TIME); | |
251 | + } | |
252 | + return data; | |
253 | + } | |
254 | + | |
255 | + @Override | |
256 | + public List<CityResp> listChildrenAddressById(int parentId) { | |
257 | + String redisKey = redisUtil.makeKey("DILI_CHILDREN_CITY", parentId + ""); | |
258 | + List<CityResp> data = redisUtil.getList(redisKey, CityResp.class); | |
259 | + if (Validator.isEmpty(data)) { | |
260 | + data = websiteClient.getCityService().getCityListByParent(parentId); | |
261 | + redisUtil.setObjectByExpire(redisKey, data, EXPIRE_TIME); | |
262 | + } | |
263 | + return data; | |
264 | + } | |
265 | + | |
266 | + public String getCustomerPhone() { | |
267 | + if (Validator.isEmpty(redisPrivateDomainKey)) { | |
268 | + redisPrivateDomainKey = redisUtil.makeKey(CLIENT_SERVICE_HOT_LINE + 2, null); | |
269 | + } | |
270 | + String data = redisUtil.getString(redisPrivateDomainKey); | |
271 | + if (!Validator.isEmpty(data)) { | |
272 | + return data; | |
273 | + } | |
274 | + SysConfigResp sysConfigResp = websiteClient.getSysConfigService().getSysConfig("Client_Service_Hot_Line"); | |
275 | + if (Validator.isNull(sysConfigResp) || Validator.isEmpty(sysConfigResp.getValue())) { | |
276 | + return null; | |
277 | + } | |
278 | + data = sysConfigResp.getValue(); | |
279 | + redisUtil.setStringByExpire(redisPrivateDomainKey, data, CLIENT_SERVICE_HOT_LINE_TIME); | |
280 | + return data; | |
281 | + } | |
282 | + | |
283 | + @Override | |
284 | + public PickUpPointResp getPickupAddress(Long packupId) { | |
285 | + String redisPickupAddrKey = redisUtil.makeKey(DIC_PACKUP_ADDRESS + "_item", packupId + ""); | |
286 | + PickUpPointResp data = redisUtil.getObject(redisPickupAddrKey, PickUpPointResp.class); | |
287 | + if (!Validator.isNull(data)) { | |
288 | + return data; | |
289 | + } | |
290 | + data = websiteClient.getPickUpApiService().getPickupById(packupId); | |
291 | + | |
292 | + if (Validator.isNull(data) || data.getCode() != PickUpPointResp.CODE_SUCCESS) { | |
293 | + return null; | |
294 | + } | |
295 | + redisUtil.setObjectByExpire(redisPickupAddrKey, data, CLIENT_SERVICE_HOT_LINE_TIME); | |
296 | + return data; | |
297 | + } | |
298 | + | |
299 | + @Override | |
300 | + public com.diligrp.website.web.interfaces.domain.output.DataDictionaryValueResp getSaleUnitById(Long saleUnitId) { | |
301 | + final Result measuringUnit = getMeasuringUnit(); | |
302 | + DataDictionaryResp resp = (DataDictionaryResp) measuringUnit.getResult(); | |
303 | + if (Validator.isNull(resp)) { | |
304 | + return null; | |
305 | + } | |
306 | + return resp.getValueById(saleUnitId); | |
307 | + } | |
308 | + | |
309 | +} | ... | ... |
mobsite-man-rpc/src/main/java/com/diligrp/mobsite/man/rpc/impl/MarketRPCImpl.java
0 → 100644
1 | +package com.diligrp.mobsite.man.rpc.impl; | |
2 | + | |
3 | +import java.util.List; | |
4 | + | |
5 | +import javax.annotation.Resource; | |
6 | + | |
7 | +import org.apache.log4j.Logger; | |
8 | +import org.springframework.stereotype.Service; | |
9 | + | |
10 | +import com.diligrp.mobsite.man.rpc.MarketRPC; | |
11 | +import com.diligrp.website.web.interfaces.WebsiteClient; | |
12 | +import com.diligrp.website.web.interfaces.domain.input.PickupTypeEnum; | |
13 | +import com.diligrp.website.web.interfaces.domain.output.BaseResp; | |
14 | +import com.diligrp.website.web.interfaces.domain.output.PickUpPointResp; | |
15 | +import com.diligrp.website.web.interfaces.domain.output.ResultResp; | |
16 | + | |
17 | + | |
18 | +/** | |
19 | + * <B>Description</B> 市场列表 <br /> | |
20 | + * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br /> | |
21 | + * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br /> | |
22 | + * <B>Company</B> 地利集团 | |
23 | + * | |
24 | + * @author zhangshirui | |
25 | + * @createTime 2014年8月21日 下午5:52:44 | |
26 | + */ | |
27 | +@Service("marketRPC") | |
28 | +public class MarketRPCImpl implements MarketRPC { | |
29 | + | |
30 | + @Resource | |
31 | + private WebsiteClient websiteClient; | |
32 | + | |
33 | + private static Logger log = Logger.getLogger(MarketRPCImpl.class); | |
34 | + | |
35 | + | |
36 | + @Override | |
37 | + public List<PickUpPointResp> getMarkets() { | |
38 | + | |
39 | + ResultResp<List<PickUpPointResp>> resultResp = null ; | |
40 | + try { | |
41 | + resultResp = websiteClient.getPickUpApiService().getAllPickupInfo(PickupTypeEnum.MARKET); | |
42 | + } catch (Exception e) { | |
43 | + log.error("查询市场接口异常",e); | |
44 | + throw new RuntimeException("查询市场信息失败"); | |
45 | + } | |
46 | + | |
47 | + if (resultResp.getCode() != BaseResp.CODE_SUCCESS) { | |
48 | + throw new RuntimeException("查询市场信息失败"); | |
49 | + } | |
50 | + | |
51 | + return resultResp.getValue(); | |
52 | + } | |
53 | + | |
54 | + @Override | |
55 | + public PickUpPointResp getMarketById(Long id) { | |
56 | + if (log.isInfoEnabled()) { | |
57 | + log.info(String.format("获取市场信息:[marketId=%s]", id)); | |
58 | + } | |
59 | + return websiteClient.getPickUpApiService().getPickupById(id); | |
60 | + } | |
61 | + | |
62 | +} | ... | ... |
mobsite-man-rpc/src/main/java/com/diligrp/mobsite/man/rpc/impl/SearchRPCImpl.java
0 → 100644
1 | +package com.diligrp.mobsite.man.rpc.impl; | |
2 | + | |
3 | +import java.util.List; | |
4 | + | |
5 | +import javax.annotation.Resource; | |
6 | + | |
7 | +import org.apache.log4j.Logger; | |
8 | +import org.springframework.stereotype.Service; | |
9 | + | |
10 | +import com.alibaba.fastjson.JSON; | |
11 | +import com.dili.dd.searcher.datainterface.client.DataServerClient; | |
12 | +import com.dili.dd.searcher.datainterface.domain.BaseOutput; | |
13 | +import com.dili.dd.searcher.datainterface.domain.Pagination; | |
14 | +import com.dili.dd.searcher.datainterface.domain.goods.SearchFactor; | |
15 | +import com.dili.dd.searcher.datainterface.domain.goods.SearchGoodsResult; | |
16 | +import com.dili.dd.searcher.datainterface.domain.store.SearchStoreFactor; | |
17 | +import com.dili.dd.searcher.datainterface.domain.store.StoreSearchResult; | |
18 | +import com.diligrp.mobsite.man.rpc.SearchRPC; | |
19 | +import com.diligrp.titan.sdk.TitanClient; | |
20 | +import com.diligrp.titan.sdk.domain.Category; | |
21 | +import com.diligrp.website.util.dao.BaseQuery; | |
22 | +import com.diligrp.website.util.security.Validator; | |
23 | +import com.diligrp.website.util.web.PageTemplate; | |
24 | + | |
25 | +/** | |
26 | + * <B>Description</B> TODO <br /> | |
27 | + * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br /> | |
28 | + * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br /> | |
29 | + * <B>Company</B> 地利集团 | |
30 | + * | |
31 | + * @author wujianjun | |
32 | + * @createTime 2014/10/14 11:05 | |
33 | + */ | |
34 | +@Service | |
35 | +public class SearchRPCImpl implements SearchRPC { | |
36 | + | |
37 | + @Resource | |
38 | + private DataServerClient dataServerClient; | |
39 | + @Resource | |
40 | + private TitanClient titanClient; | |
41 | + private Logger log = Logger.getLogger(getClass()); | |
42 | + | |
43 | + @Override | |
44 | + public PageTemplate searchShopList(BaseQuery baseQuery) { | |
45 | + SearchStoreFactor args = new SearchStoreFactor(); | |
46 | + final String id = baseQuery.getParam().get("id"); | |
47 | + if (!Validator.isEmpty(id)) { | |
48 | + // 如果输入的ID不是一个数字,则返回无数据 | |
49 | + if(!Validator.isNumber(id)) { | |
50 | + return PageTemplate.create(baseQuery,0,null); | |
51 | + } | |
52 | + args.setStoreId(Long.valueOf(id)); | |
53 | + } | |
54 | + final String name = baseQuery.getParam().get("name"); | |
55 | + if (!Validator.isEmpty(name)) { | |
56 | + args.setStoreName(name); | |
57 | + } | |
58 | + //设置页码 | |
59 | + args.setPagination(new Pagination()); | |
60 | + args.getPagination().setPageSize(20); | |
61 | + args.getPagination().setPageNumber(Validator.isNull(baseQuery.getCurrPage()) ? 1 : baseQuery.getCurrPage()); | |
62 | + | |
63 | + if (log.isInfoEnabled()) { | |
64 | + log.info("开始通过关键字搜索店铺"); | |
65 | + } | |
66 | + BaseOutput<StoreSearchResult> output = dataServerClient.callService(StoreSearchResult.class, "searchStore", JSON.toJSONString(args)); | |
67 | + if (output.getCode() != 200) { | |
68 | + log.error("通过关键字查询店铺失败, [id=" + args.getStoreId() + ",name=" + args.getStoreName() + ",code=" + output.getCode() + ",msg=" + output.getResult() + "]"); | |
69 | + throw new RuntimeException("查询店铺失败[" + output.getCode() + "]"); | |
70 | + } | |
71 | + if (log.isInfoEnabled()) { | |
72 | + log.info(String.format("通过关键字搜索店铺成功.[key=%s]", args.getStoreName())); | |
73 | + } | |
74 | + return PageTemplate.create(baseQuery, output.getData().getPagination().getTotal(), output.getData().getStores()); | |
75 | + } | |
76 | + | |
77 | + @Override | |
78 | + public PageTemplate searchGoodsList(BaseQuery baseQuery) { | |
79 | + SearchFactor args = new SearchFactor(); | |
80 | + final String id = baseQuery.getParam().get("id"); | |
81 | + | |
82 | + if (!Validator.isEmpty(id)) { | |
83 | + // 如果输入的ID不是一个数字,则返回无数据 | |
84 | + if(!Validator.isNumber(id)) { | |
85 | + return PageTemplate.create(baseQuery,0,null); | |
86 | + } | |
87 | + args.setGoodsId(Long.valueOf(id)); | |
88 | + } | |
89 | + final String name = baseQuery.getParam().get("name"); | |
90 | + if (!Validator.isEmpty(name)) { | |
91 | + args.setKey(name); | |
92 | + } | |
93 | + //设置页码 | |
94 | + args.setPagination(new Pagination()); | |
95 | + args.getPagination().setPageSize(20); | |
96 | + args.getPagination().setPageNumber(Validator.isNull(baseQuery.getCurrPage()) ? 1 : baseQuery.getCurrPage()); | |
97 | + BaseOutput<SearchGoodsResult> output = dataServerClient.callService(SearchGoodsResult.class, "searchGoods", JSON.toJSONString(args)); | |
98 | + | |
99 | + if (output.getCode() != 200) { | |
100 | + throw new RuntimeException(String.format("搜索商品列表失败.[id=" + args.getGoodsId() + ",name=" + args.getKey() + ",code=%s, message=%s]", output.getCode(), output.getResult())); | |
101 | + } | |
102 | + | |
103 | + if (log.isInfoEnabled()) { | |
104 | + log.info(String.format("获取商品列表.[id=%s,name=%s,size=%s,pageNum=%s,pageSize=%s]", args.getGoodsId(), args.getKey(), | |
105 | + output.getData().getGoodsList().size(), output.getData().getPagination().getPageNumber(), args.getPagination().getPageSize())); | |
106 | + } | |
107 | + return PageTemplate.create(baseQuery, output.getData().getPagination().getTotal(), output.getData().getGoodsList()); | |
108 | + } | |
109 | + | |
110 | + @Override | |
111 | + public List<Category> searchCategoryList(String categoryName) { | |
112 | + final com.diligrp.titan.sdk.output.BaseOutput<List<Category>> output = titanClient.getCategoryService().searchCategoryInfo(categoryName); | |
113 | + if (output.getCode() != 200) { | |
114 | + throw new RuntimeException(String.format("搜索商品分类列表失败.[name=%s,code=%s, message=%s]", categoryName, output.getCode(), output.getResult())); | |
115 | + } | |
116 | + if (log.isInfoEnabled()) { | |
117 | + log.info(String.format("获取商品分类列表.[name=%s,size=%s]", categoryName, output.getData().size())); | |
118 | + } | |
119 | + return output.getData(); | |
120 | + } | |
121 | + | |
122 | + @Override | |
123 | + public Category getCategoryById(Long id) { | |
124 | + final com.diligrp.titan.sdk.output.BaseOutput<Category> output = titanClient.getCategoryService().getCategoryInfo(id.intValue()); | |
125 | + if (output.getCode() != 200) { | |
126 | + throw new RuntimeException(String.format("通过分类ID查询商品分类失败.[ID=%s,code=%s, message=%s]", id, output.getCode(), output.getResult())); | |
127 | + } | |
128 | + Category category = output.getData(); | |
129 | + if (log.isInfoEnabled()) { | |
130 | + log.info(String.format("通过分类ID查询商品分类成功.[name=%s,ID=%s]", category.getCname(), id)); | |
131 | + } | |
132 | + return category; | |
133 | + } | |
134 | +} | ... | ... |
mobsite-man-rpc/src/main/java/com/diligrp/mobsite/man/rpc/impl/StoreRPCImpl.java
0 → 100644
1 | +package com.diligrp.mobsite.man.rpc.impl; | |
2 | + | |
3 | +import java.io.ByteArrayInputStream; | |
4 | +import java.util.Random; | |
5 | +import java.util.UUID; | |
6 | + | |
7 | +import javax.annotation.Resource; | |
8 | + | |
9 | +import org.springframework.stereotype.Service; | |
10 | + | |
11 | +import com.alibaba.fastjson.JSON; | |
12 | +import com.alibaba.fastjson.JSONObject; | |
13 | +import com.diligrp.mobsite.getway.domain.except.ServiceException; | |
14 | +import com.diligrp.mobsite.man.rpc.StoreRPC; | |
15 | +import com.diligrp.store.api.upload.DiliStoreUpload; | |
16 | + | |
17 | + | |
18 | +/** | |
19 | + * <B>Description</B> 上传图片 <br /> | |
20 | + * <B>Copyright</B> Copyright (c) 2015 www.diligrp.com All rights reserved. <br /> | |
21 | + * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br /> | |
22 | + * <B>Company</B> 地利集团 | |
23 | + * @createTime 2015年3月11日 上午11:14:35 | |
24 | + * @author zhangshirui | |
25 | + */ | |
26 | +@Service | |
27 | +public class StoreRPCImpl implements StoreRPC { | |
28 | + | |
29 | + public static final String BUDGET_NAME_APKPATCH = "apkPatch"; | |
30 | + | |
31 | + | |
32 | + public static final String FILE_TYPE_PATCH = ".patch"; | |
33 | + | |
34 | + @Resource | |
35 | + private DiliStoreUpload apkPatchStore; | |
36 | + | |
37 | + @Override | |
38 | + public String uploadFile(byte[] file,String bucket,String fileType){ | |
39 | + | |
40 | + JSONObject json = null; | |
41 | + try { | |
42 | + String fileName = bucket + UUID.randomUUID() + fileType; | |
43 | + String result = apkPatchStore.handle(new ByteArrayInputStream(file), bucket,fileName); | |
44 | + json = JSON.parseObject(result); | |
45 | + } catch (Exception e) { | |
46 | + throw new RuntimeException("上传文件服务接口挂掉"); | |
47 | + } | |
48 | + boolean flag = json.getBooleanValue("success"); | |
49 | + if (!flag) { | |
50 | + throw new ServiceException(400,json.getString("msg")); | |
51 | + } | |
52 | + String newFileName = json.getString("key"); | |
53 | + | |
54 | + StringBuilder fullUrl = new StringBuilder(); | |
55 | + | |
56 | + Random random=new Random(); | |
57 | + //全地址 | |
58 | + fullUrl.append("http://img") | |
59 | + .append(random.nextInt(10))//0-9服务器 | |
60 | + .append(".nong12.com/") | |
61 | + .append(BUDGET_NAME_APKPATCH) | |
62 | + .append("/") | |
63 | + .append(newFileName); | |
64 | + | |
65 | + return fullUrl.toString(); | |
66 | + } | |
67 | + | |
68 | + | |
69 | +} | ... | ... |
mobsite-man-rpc/src/main/java/com/diligrp/mobsite/man/rpc/utils/HttpClientManager.java
0 → 100644
1 | +package com.diligrp.mobsite.man.rpc.utils; | |
2 | + | |
3 | + | |
4 | +import org.apache.http.conn.ClientConnectionManager; | |
5 | +import org.apache.http.conn.scheme.PlainSocketFactory; | |
6 | +import org.apache.http.conn.scheme.Scheme; | |
7 | +import org.apache.http.conn.scheme.SchemeRegistry; | |
8 | +import org.apache.http.conn.ssl.SSLSocketFactory; | |
9 | +import org.apache.http.impl.client.DefaultHttpClient; | |
10 | +import org.apache.http.impl.client.DefaultHttpRequestRetryHandler; | |
11 | +import org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager; | |
12 | +import org.apache.http.params.BasicHttpParams; | |
13 | +import org.apache.http.params.HttpConnectionParams; | |
14 | +import org.apache.http.params.HttpParams; | |
15 | + | |
16 | +/** | |
17 | + * | |
18 | + * <B>httpClient管理器</B> | |
19 | + * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br /> | |
20 | + * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br /> | |
21 | + * <B>Company</B> 地利集团 | |
22 | + * @createTime 2014年5月12日 下午4:45:38 | |
23 | + * @author mengxf | |
24 | + */ | |
25 | +public class HttpClientManager { | |
26 | + private int timeout; | |
27 | + /** The http params. */ | |
28 | + private static HttpParams httpParams; | |
29 | + /** The connection manager. */ | |
30 | + private static ClientConnectionManager connectionManager; | |
31 | + | |
32 | + public void init() { | |
33 | + httpParams = new BasicHttpParams(); | |
34 | + HttpConnectionParams.setConnectionTimeout(httpParams, timeout); | |
35 | + HttpConnectionParams.setSoTimeout(httpParams, timeout); | |
36 | + SchemeRegistry registry = new SchemeRegistry(); | |
37 | + registry.register(new Scheme("http", 80, PlainSocketFactory | |
38 | + .getSocketFactory())); | |
39 | + registry.register(new Scheme("https", 443, SSLSocketFactory | |
40 | + .getSocketFactory())); | |
41 | + | |
42 | + connectionManager = new ThreadSafeClientConnManager(registry); | |
43 | + } | |
44 | + | |
45 | + public static DefaultHttpClient getHttpClient() { | |
46 | + DefaultHttpClient httpClient = new DefaultHttpClient(connectionManager, | |
47 | + httpParams); | |
48 | + DefaultHttpRequestRetryHandler handler = new DefaultHttpRequestRetryHandler(3,false); | |
49 | + httpClient.setHttpRequestRetryHandler(handler); | |
50 | +// HttpRequestRetryHandler handler = new HttpRequestRetryHandler() { | |
51 | +// | |
52 | +// public boolean retryRequest(IOException exception, | |
53 | +// int executionCount, HttpContext context) { | |
54 | +// if (executionCount >= 2) { | |
55 | +// // Do not retry if over max retry count | |
56 | +// return false; | |
57 | +// } | |
58 | +// if (exception instanceof NoHttpResponseException) { | |
59 | +// // Retry if the server dropped connection on us | |
60 | +// return true; | |
61 | +// } | |
62 | +// if (exception instanceof SSLHandshakeException) { | |
63 | +// // Do not retry on SSL handshake exception | |
64 | +// return false; | |
65 | +// } | |
66 | +// HttpRequest request = (HttpRequest) context | |
67 | +// .getAttribute(ExecutionContext.HTTP_REQUEST); | |
68 | +// boolean idempotent = !(request instanceof HttpEntityEnclosingRequest); | |
69 | +// if (idempotent) { | |
70 | +// // Retry if the request is considered idempotent | |
71 | +// return true; | |
72 | +// } | |
73 | +// return false; | |
74 | +// } | |
75 | +// }; | |
76 | + //去掉重试 | |
77 | + //httpClient.setHttpRequestRetryHandler(handler); | |
78 | + return httpClient; | |
79 | + } | |
80 | + | |
81 | + public void setTimeout(int timeout) { | |
82 | + this.timeout = timeout; | |
83 | + } | |
84 | +} | ... | ... |
mobsite-man-rpc/src/main/java/com/diligrp/mobsite/man/rpc/utils/HttpClientUtil.java
0 → 100644
1 | +package com.diligrp.mobsite.man.rpc.utils; | |
2 | + | |
3 | +import com.diligrp.website.util.web.exception.WebException; | |
4 | +import org.apache.http.HttpEntity; | |
5 | +import org.apache.http.HttpException; | |
6 | +import org.apache.http.HttpResponse; | |
7 | +import org.apache.http.StatusLine; | |
8 | +import org.apache.http.client.HttpClient; | |
9 | +import org.apache.http.client.methods.HttpGet; | |
10 | +import org.apache.http.util.EntityUtils; | |
11 | + | |
12 | +import java.io.IOException; | |
13 | +import java.io.UnsupportedEncodingException; | |
14 | +import java.net.URI; | |
15 | +import java.net.URISyntaxException; | |
16 | +import java.net.URLEncoder; | |
17 | + | |
18 | +/** | |
19 | + * | |
20 | + * <B>HttpClientUtil</B> | |
21 | + * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br /> | |
22 | + * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br /> | |
23 | + * <B>Company</B> 地利集团 | |
24 | + * @createTime 2014年5月12日 下午4:42:26 | |
25 | + * @author mengxf | |
26 | + */ | |
27 | +public class HttpClientUtil { | |
28 | + static HttpClient client = HttpClientManager.getHttpClient(); | |
29 | + /** | |
30 | + * this method is 发送httpGet请求,获取json返回结果 | |
31 | + * @param url | |
32 | + * @param charset | |
33 | + * @return | |
34 | + * @throws WebException | |
35 | + * @throws HttpException | |
36 | + * @throws IOException | |
37 | + * @createTime 2014年5月12日 下午4:42:53 | |
38 | + * @author mengxf | |
39 | + */ | |
40 | + public static String HttpGet(String url, String charset) | |
41 | + throws WebException, HttpException, IOException { | |
42 | + String json = null; | |
43 | + HttpGet httpGet = new HttpGet(); | |
44 | + // 设置参数 | |
45 | + try { | |
46 | + httpGet.setURI(new URI(url)); | |
47 | + } catch (URISyntaxException e) { | |
48 | + throw new HttpException("请求url格式错误:"+e); | |
49 | + } | |
50 | + // 发送请求 | |
51 | + HttpResponse httpResponse = client.execute(httpGet); | |
52 | + // 获取返回的数据 | |
53 | + HttpEntity entity = httpResponse.getEntity(); | |
54 | + byte[] body = EntityUtils.toByteArray(entity); | |
55 | + StatusLine sL = httpResponse.getStatusLine(); | |
56 | + int statusCode = sL.getStatusCode(); | |
57 | + if (statusCode == 200) { | |
58 | + json = new String(body, charset); | |
59 | + EntityUtils.consume(entity); | |
60 | + } else { | |
61 | + throw new HttpException("statusCode="+statusCode); | |
62 | + } | |
63 | + if (org.apache.commons.lang3.StringUtils.isBlank(json)) { | |
64 | + throw new WebException("接口未返回任何数据,请检查条件是否正确!"); | |
65 | + } | |
66 | + return json; | |
67 | + } | |
68 | + | |
69 | + public static String encode(String sour) { | |
70 | + String dest = null; | |
71 | + if (null != sour) { | |
72 | + try { | |
73 | + dest = URLEncoder.encode(sour, "utf-8"); | |
74 | + } catch (UnsupportedEncodingException e) { | |
75 | + } | |
76 | + dest = dest.replaceAll("\\+", "%20"); | |
77 | + } else { | |
78 | + dest = sour; | |
79 | + } | |
80 | + return dest; | |
81 | + } | |
82 | +} | ... | ... |
mobsite-man-rpc/src/main/java/com/diligrp/mobsite/man/rpc/utils/exception/GwException.java
0 → 100644
1 | +package com.diligrp.mobsite.man.rpc.utils.exception; | |
2 | + | |
3 | +public class GwException extends Exception { | |
4 | + | |
5 | + /** | |
6 | + * | |
7 | + */ | |
8 | + private static final long serialVersionUID = -5184523139871434498L; | |
9 | + | |
10 | + public GwException(String msg) { | |
11 | + super(msg); | |
12 | + } | |
13 | + | |
14 | + public GwException(String message, Throwable cause) { | |
15 | + super(message, cause); | |
16 | + } | |
17 | +} | ... | ... |
mobsite-man-rpc/src/main/java/com/diligrp/mobsite/man/rpc/utils/exception/NotFoundException.java
0 → 100644
1 | +package com.diligrp.mobsite.man.rpc.utils.exception; | |
2 | + | |
3 | +/** | |
4 | + * 没有找到资源 | |
5 | + * @author mengxf | |
6 | + * | |
7 | + */ | |
8 | +public class NotFoundException extends Exception { | |
9 | + | |
10 | + private static final long serialVersionUID = -6416547246554870612L; | |
11 | + private static final String msg = "您要找的数据,接口返回为空!"; | |
12 | + | |
13 | + public NotFoundException() { | |
14 | + this(""); | |
15 | + } | |
16 | + | |
17 | + public NotFoundException(String message, Throwable cause) { | |
18 | + super(msg+message, cause); | |
19 | + } | |
20 | + | |
21 | + public NotFoundException(String message) { | |
22 | + super(msg+message); | |
23 | + } | |
24 | + | |
25 | + public NotFoundException(Throwable cause) { | |
26 | + super(cause); | |
27 | + } | |
28 | + | |
29 | +} | ... | ... |
mobsite-man-sdk/pom.xml
0 → 100644
1 | +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |
2 | + <modelVersion>4.0.0</modelVersion> | |
3 | + <groupId>com.diligrp.mobsite</groupId> | |
4 | + <artifactId>mobsite-man-sdk</artifactId> | |
5 | + <version>0.0.1-SNAPSHOT</version> | |
6 | + <properties> | |
7 | + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | |
8 | + </properties> | |
9 | + <build> | |
10 | + <plugins> | |
11 | + <plugin> | |
12 | + <groupId>org.apache.maven.plugins</groupId> | |
13 | + <artifactId>maven-compiler-plugin</artifactId> | |
14 | + <version>3.1</version> | |
15 | + <configuration> | |
16 | + <source>1.7</source> | |
17 | + <target>1.7</target> | |
18 | + <encoding>${project.build.sourceEncoding}</encoding> | |
19 | + </configuration> | |
20 | + </plugin> | |
21 | + <plugin> | |
22 | + <artifactId>maven-source-plugin</artifactId> | |
23 | + <version>2.1</version> | |
24 | + <configuration> | |
25 | + <attach>true</attach> | |
26 | + </configuration> | |
27 | + <executions> | |
28 | + <execution> | |
29 | + <phase>compile</phase> | |
30 | + <goals> | |
31 | + <goal>jar</goal> | |
32 | + </goals> | |
33 | + </execution> | |
34 | + </executions> | |
35 | + </plugin> | |
36 | + </plugins> | |
37 | + </build> | |
38 | + <dependencies> | |
39 | + <dependency> | |
40 | + <groupId>com.diligrp.website</groupId> | |
41 | + <artifactId>diligrp-website-util</artifactId> | |
42 | + <version>0.0.1-SNAPSHOT</version> | |
43 | + </dependency> | |
44 | + <dependency> | |
45 | + <groupId>com.alibaba</groupId> | |
46 | + <artifactId>fastjson</artifactId> | |
47 | + <version>1.1.36</version> | |
48 | + </dependency> | |
49 | + <dependency> | |
50 | + <groupId>log4j</groupId> | |
51 | + <artifactId>log4j</artifactId> | |
52 | + <version>1.2.16</version> | |
53 | + </dependency> | |
54 | + <dependency> | |
55 | + <groupId>org.slf4j</groupId> | |
56 | + <artifactId>slf4j-api</artifactId> | |
57 | + <version>1.6.1</version> | |
58 | + </dependency> | |
59 | + <dependency> | |
60 | + <groupId>org.slf4j</groupId> | |
61 | + <artifactId>slf4j-log4j12</artifactId> | |
62 | + <version>1.6.1</version> | |
63 | + </dependency> | |
64 | + <dependency> | |
65 | + <groupId>org.apache.httpcomponents</groupId> | |
66 | + <artifactId>httpclient</artifactId> | |
67 | + <version>4.3.3</version> | |
68 | + </dependency> | |
69 | + <dependency> | |
70 | + <groupId>junit</groupId> | |
71 | + <artifactId>junit</artifactId> | |
72 | + <version>4.8.2</version> | |
73 | + <scope>test</scope> | |
74 | + </dependency> | |
75 | + <!-- 工具包 --> | |
76 | + <dependency> | |
77 | + <groupId>org.apache.commons</groupId> | |
78 | + <artifactId>commons-lang3</artifactId> | |
79 | + <version>3.3.2</version> | |
80 | + </dependency> | |
81 | + | |
82 | + <dependency> | |
83 | + <groupId>com.google.guava</groupId> | |
84 | + <artifactId>guava</artifactId> | |
85 | + <version>12.0.1</version> | |
86 | + </dependency> | |
87 | + </dependencies> | |
88 | +</project> | |
0 | 89 | \ No newline at end of file | ... | ... |
mobsite-man-sdk/src/main/java/com/diligrp/mobsite/man/sdk/MobsiteGetWaySDK.java
0 → 100644
1 | +package com.diligrp.mobsite.man.sdk; | |
2 | + | |
3 | + | |
4 | +/** | |
5 | + * <B>Description</B> TODO <br /> | |
6 | + * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br /> | |
7 | + * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br /> | |
8 | + * <B>Company</B> 地利集团 | |
9 | + * @createTime Aug 5, 2014 4:42:38 PM | |
10 | + * @author wujianjun | |
11 | + */ | |
12 | +public class MobsiteGetWaySDK { | |
13 | + | |
14 | +} | ... | ... |
mobsite-man-service/pom.xml
0 → 100644
1 | +<?xml version="1.0"?> | |
2 | +<project | |
3 | + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" | |
4 | + xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | |
5 | + <modelVersion>4.0.0</modelVersion> | |
6 | + <parent> | |
7 | + <groupId>com.diligrp.mobsite</groupId> | |
8 | + <artifactId>mobsite-man</artifactId> | |
9 | + <version>0.0.1-SNAPSHOT</version> | |
10 | + </parent> | |
11 | + | |
12 | + <artifactId>mobsite-man-service</artifactId> | |
13 | + <name>mobsite-man-service</name> | |
14 | + <url>http://maven.apache.org</url> | |
15 | + | |
16 | + <properties> | |
17 | + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | |
18 | + </properties> | |
19 | + <dependencies> | |
20 | + <dependency> | |
21 | + <groupId>com.diligrp.mobsite</groupId> | |
22 | + <artifactId>mobsite-man-manager</artifactId> | |
23 | + <version>0.0.1-SNAPSHOT</version> | |
24 | + </dependency> | |
25 | + <dependency> | |
26 | + <groupId>com.diligrp.mobsite</groupId> | |
27 | + <artifactId>mobsite-man-domain</artifactId> | |
28 | + <version>0.0.1-SNAPSHOT</version> | |
29 | + </dependency> | |
30 | + <dependency> | |
31 | + <groupId>com.diligrp.mobsite</groupId> | |
32 | + <artifactId>mobsite-man-rpc</artifactId> | |
33 | + <version>0.0.1-SNAPSHOT</version> | |
34 | + </dependency> | |
35 | + | |
36 | + <!-- 接口依赖 --> | |
37 | + <!--<dependency>--> | |
38 | + <!--<groupId> com.diligrp</groupId>--> | |
39 | + <!--<artifactId> orders-client</artifactId>--> | |
40 | + <!--<version> 1.0-SNAPSHOT</version>--> | |
41 | + <!--</dependency>--> | |
42 | + | |
43 | + <!-- 邮件 --> | |
44 | + <dependency> | |
45 | + <groupId>org.apache.james</groupId> | |
46 | + <artifactId>james-server-smtpserver</artifactId> | |
47 | + <version>3.0-M2</version> | |
48 | + <exclusions> | |
49 | + <exclusion> | |
50 | + <artifactId>netty</artifactId> | |
51 | + <groupId>org.jboss.netty</groupId> | |
52 | + </exclusion> | |
53 | + </exclusions> | |
54 | + </dependency> | |
55 | + <!-- 增量包制作 --> | |
56 | + <dependency> | |
57 | + <groupId>com.nothome</groupId> | |
58 | + <artifactId>javaxdelta</artifactId> | |
59 | + <version>2.0.1</version> | |
60 | + </dependency> | |
61 | + </dependencies> | |
62 | +</project> | ... | ... |
mobsite-man-service/src/main/java/com/diligrp/mobsite/man/service/AppPatchService.java
0 → 100644
1 | +package com.diligrp.mobsite.man.service; | |
2 | + | |
3 | +import java.util.List; | |
4 | + | |
5 | +import com.diligrp.mobsite.man.domain.AppPatch; | |
6 | +import com.diligrp.website.util.dao.BaseQuery; | |
7 | + | |
8 | +/** | |
9 | + * @ClassName: AppPatchService | |
10 | + * @Description: | |
11 | + * @author zhangshirui | |
12 | + * @date 2015年5月20日11:16:40 | |
13 | + */ | |
14 | + | |
15 | + | |
16 | +public interface AppPatchService { | |
17 | + | |
18 | + boolean save(AppPatch appPatch); | |
19 | + | |
20 | + boolean update(AppPatch appPatch); | |
21 | + | |
22 | + boolean deleteById(Long id); | |
23 | + | |
24 | + AppPatch getById(Long id); | |
25 | + | |
26 | + List<AppPatch> listByCondition(BaseQuery conditions); | |
27 | + | |
28 | + List<AppPatch> listAllByCondition(BaseQuery conditions); | |
29 | + | |
30 | + Integer countByCondition(BaseQuery conditions); | |
31 | + | |
32 | +} | ... | ... |
mobsite-man-service/src/main/java/com/diligrp/mobsite/man/service/AppVersionService.java
0 → 100644
1 | +/** | |
2 | + * @Title: appVersionService.java | |
3 | + * @Package:com.diligrp.mobsite.man.service | |
4 | + * @Copyright:地利集团 | |
5 | + * @Description: | |
6 | + * @author:zhangshirui | |
7 | + * @date: 2014年8月8日 下午5:00:27 | |
8 | + * @version: V1.0 | |
9 | + */ | |
10 | +package com.diligrp.mobsite.man.service; | |
11 | + | |
12 | +import com.diligrp.mobsite.man.domain.AppVersion; | |
13 | +import com.diligrp.website.util.dao.BaseQuery; | |
14 | + | |
15 | +import java.util.List; | |
16 | + | |
17 | +/** | |
18 | + * @ClassName: appVersionService | |
19 | + * @Description: | |
20 | + * @author zhangshirui | |
21 | + * @date 2014年8月8日 下午5:00:27 | |
22 | + */ | |
23 | + | |
24 | +public interface AppVersionService { | |
25 | + | |
26 | + public boolean save(AppVersion appVersion); | |
27 | + | |
28 | + public boolean update(AppVersion appVersion); | |
29 | + | |
30 | + public boolean deleteById(Long id); | |
31 | + | |
32 | + public AppVersion getById(Long id); | |
33 | + | |
34 | + public List<AppVersion> listByCondition(BaseQuery conditions); | |
35 | + | |
36 | + public List<AppVersion> listAllByCondition(BaseQuery conditions); | |
37 | + | |
38 | + public Integer countByCondition(BaseQuery conditions); | |
39 | + | |
40 | +} | ... | ... |
mobsite-man-service/src/main/java/com/diligrp/mobsite/man/service/DemoService.java
0 → 100644
1 | +package com.diligrp.mobsite.man.service; | |
2 | + | |
3 | + | |
4 | +/** | |
5 | + * <B>Description</B> TODO <br /> | |
6 | + * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br /> | |
7 | + * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br /> | |
8 | + * <B>Company</B> 地利集团 | |
9 | + * @createTime Aug 5, 2014 4:26:07 PM | |
10 | + * @author wujianjun | |
11 | + */ | |
12 | +public interface DemoService { | |
13 | + | |
14 | +} | ... | ... |
mobsite-man-service/src/main/java/com/diligrp/mobsite/man/service/FeedbackService.java
0 → 100644
1 | +package com.diligrp.mobsite.man.service; | |
2 | + | |
3 | +import com.diligrp.mobsite.man.domain.Feedback; | |
4 | +import com.diligrp.mobsite.man.domain.exception.DiliException; | |
5 | +import com.diligrp.website.util.dao.BaseQuery; | |
6 | +import com.diligrp.website.util.web.PageTemplate; | |
7 | + | |
8 | +import java.util.Map; | |
9 | + | |
10 | +/** | |
11 | + * <B>Description</B> <br /> | |
12 | + * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br /> | |
13 | + * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br /> | |
14 | + * <B>Company</B> 地利集团 | |
15 | + * @createTime 2014-9-24 16:53:43 | |
16 | + * @author template | |
17 | + */ | |
18 | +public interface FeedbackService { | |
19 | + | |
20 | + public Map<?, ?> preSave(Feedback obj) throws DiliException; | |
21 | + | |
22 | + public Feedback findOne(Long pk) throws DiliException ; | |
23 | + | |
24 | + public Boolean save(Feedback feedback) throws DiliException ; | |
25 | + | |
26 | + public PageTemplate find(BaseQuery bq) throws DiliException ; | |
27 | + | |
28 | + public Boolean del(Long id) throws DiliException ; | |
29 | + | |
30 | + public Boolean update(Feedback feedback) throws DiliException ; | |
31 | + | |
32 | + void doRead(Long id) throws DiliException; | |
33 | +} | ... | ... |
mobsite-man-service/src/main/java/com/diligrp/mobsite/man/service/PromotionService.java
0 → 100644
1 | +package com.diligrp.mobsite.man.service; | |
2 | + | |
3 | +import com.diligrp.mobsite.man.domain.Promotion; | |
4 | +import com.diligrp.mobsite.man.domain.exception.DiliException; | |
5 | +import com.diligrp.website.util.dao.BaseQuery; | |
6 | +import com.diligrp.website.util.web.PageTemplate; | |
7 | + | |
8 | +import java.util.Map; | |
9 | + | |
10 | +/** | |
11 | + * <B>Description</B> <br /> | |
12 | + * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br /> | |
13 | + * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br /> | |
14 | + * <B>Company</B> 地利集团 | |
15 | + * @createTime 2014-9-24 16:53:43 | |
16 | + * @author template | |
17 | + */ | |
18 | +public interface PromotionService { | |
19 | + | |
20 | + public Map<?, ?> preSave(Promotion obj) throws DiliException; | |
21 | + | |
22 | + public Promotion findOne(Long pk) throws DiliException ; | |
23 | + | |
24 | + public Boolean save(Promotion promotion) throws DiliException ; | |
25 | + | |
26 | + public PageTemplate find(BaseQuery bq) throws DiliException ; | |
27 | + | |
28 | + public Boolean del(Long id) throws DiliException ; | |
29 | + | |
30 | + public Boolean update(Promotion promotion) throws DiliException ; | |
31 | + | |
32 | + java.util.List<com.diligrp.titan.sdk.domain.Category> getCategory(BaseQuery bq) throws DiliException ; | |
33 | + | |
34 | + PageTemplate getProduct(BaseQuery bq) throws DiliException ; | |
35 | + | |
36 | + PageTemplate getShop(BaseQuery bq) throws DiliException ; | |
37 | +} | ... | ... |
mobsite-man-service/src/main/java/com/diligrp/mobsite/man/service/RecipientService.java
0 → 100644
1 | +package com.diligrp.mobsite.man.service; | |
2 | + | |
3 | +import com.diligrp.mobsite.man.domain.Recipient; | |
4 | +import com.diligrp.mobsite.man.domain.exception.DiliException; | |
5 | +import com.diligrp.website.util.dao.BaseQuery; | |
6 | +import com.diligrp.website.util.web.PageTemplate; | |
7 | + | |
8 | +import java.util.Map; | |
9 | + | |
10 | +/** | |
11 | + * <B>Description</B> <br /> | |
12 | + * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br /> | |
13 | + * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br /> | |
14 | + * <B>Company</B> 地利集团 | |
15 | + * @createTime 2014-9-24 16:53:44 | |
16 | + * @author template | |
17 | + */ | |
18 | +public interface RecipientService { | |
19 | + | |
20 | + public Map<?, ?> preSave(Recipient obj) throws DiliException; | |
21 | + | |
22 | + public Recipient findOne(Long pk) throws DiliException ; | |
23 | + | |
24 | + public Boolean save(Recipient recipient) throws DiliException ; | |
25 | + | |
26 | + public PageTemplate find(BaseQuery bq) throws DiliException ; | |
27 | + | |
28 | + public Boolean del(Long id) throws DiliException ; | |
29 | + | |
30 | + public Boolean update(Recipient recipient) throws DiliException ; | |
31 | + | |
32 | +} | ... | ... |
mobsite-man-service/src/main/java/com/diligrp/mobsite/man/service/RegisterMapperService.java
0 → 100644
1 | +package com.diligrp.mobsite.man.service; | |
2 | + | |
3 | +/** | |
4 | + * <B>Description</B> TODO <br /> | |
5 | + * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br /> | |
6 | + * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br /> | |
7 | + * <B>Company</B> 地利集团 | |
8 | + * | |
9 | + * @author wujianjun | |
10 | + * @createTime 2014/10/30 11:35 | |
11 | + */ | |
12 | +public interface RegisterMapperService { | |
13 | + java.util.Set<String> getRegisterNo(Long userId, Integer sysFlag); | |
14 | +} | ... | ... |
mobsite-man-service/src/main/java/com/diligrp/mobsite/man/service/impl/AppPatchServiceImpl.java
0 → 100644
1 | +package com.diligrp.mobsite.man.service.impl; | |
2 | + | |
3 | +import java.io.InputStream; | |
4 | +import java.util.List; | |
5 | + | |
6 | +import javax.annotation.Resource; | |
7 | + | |
8 | +import org.springframework.beans.factory.annotation.Autowired; | |
9 | +import org.springframework.stereotype.Service; | |
10 | + | |
11 | +import com.diligrp.mobsite.man.domain.AppPatch; | |
12 | +import com.diligrp.mobsite.man.domain.AppVersion; | |
13 | +import com.diligrp.mobsite.man.manager.AppPatchManager; | |
14 | +import com.diligrp.mobsite.man.manager.AppVersionManager; | |
15 | +import com.diligrp.mobsite.man.rpc.StoreRPC; | |
16 | +import com.diligrp.mobsite.man.rpc.impl.StoreRPCImpl; | |
17 | +import com.diligrp.mobsite.man.service.AppPatchService; | |
18 | +import com.diligrp.mobsite.man.service.utils.ApkPatchUtil; | |
19 | +import com.diligrp.website.util.dao.BaseQuery; | |
20 | +import com.diligrp.website.util.security.Validator; | |
21 | + | |
22 | +@Service("appPatchService") | |
23 | +public class AppPatchServiceImpl implements AppPatchService { | |
24 | + | |
25 | + @Autowired | |
26 | + private AppPatchManager appPatchManager; | |
27 | + @Resource | |
28 | + private AppVersionManager appVersionManager; | |
29 | + @Autowired | |
30 | + private StoreRPC storeRPC; | |
31 | + | |
32 | + | |
33 | + @Override | |
34 | + public boolean save(AppPatch appPatch) { | |
35 | + boolean flag = false; | |
36 | + | |
37 | + | |
38 | + //起始版本 | |
39 | + AppVersion sourceVersion = appVersionManager.getById(appPatch.getVersionSourceId()); | |
40 | + //目标版本 | |
41 | + AppVersion desVersion = appVersionManager.getById(appPatch.getVersionDesId()); | |
42 | + | |
43 | + InputStream sourceInputStream = ApkPatchUtil.getFileByte(sourceVersion.getApp_url()); | |
44 | + InputStream desInputStream = ApkPatchUtil.getFileByte(desVersion.getApp_url()); | |
45 | + //生成增量包 | |
46 | + byte[] apkPathByte = ApkPatchUtil.createPatch(sourceInputStream, desInputStream); | |
47 | + //上传到图片服务器 | |
48 | + String patchUrl = storeRPC.uploadFile(apkPathByte, StoreRPCImpl.BUDGET_NAME_APKPATCH, StoreRPCImpl.FILE_TYPE_PATCH); | |
49 | + appPatch.setPatchUrl(patchUrl); | |
50 | + | |
51 | + //生成新包的md5值 | |
52 | + String md5 = ApkPatchUtil.getMD5(ApkPatchUtil.getFileByte(desVersion.getApp_url())); | |
53 | + appPatch.setMd5(md5); | |
54 | + if (Validator.isNull(appPatch.getId())) { | |
55 | + flag = appPatchManager.save(appPatch); | |
56 | + } else { | |
57 | + flag = appPatchManager.update(appPatch); | |
58 | + } | |
59 | + return flag; | |
60 | + } | |
61 | + | |
62 | + @Override | |
63 | + public boolean update(AppPatch appPatch) { | |
64 | + | |
65 | + return appPatchManager.update(appPatch); | |
66 | + } | |
67 | + | |
68 | + @Override | |
69 | + public boolean deleteById(Long id) { | |
70 | + return appPatchManager.deleteById(id); | |
71 | + } | |
72 | + | |
73 | + @Override | |
74 | + public AppPatch getById(Long id) { | |
75 | + return appPatchManager.getById(id); | |
76 | + } | |
77 | + | |
78 | + @Override | |
79 | + public List<AppPatch> listByCondition(BaseQuery conditions) { | |
80 | + return appPatchManager.listByCondition(conditions); | |
81 | + } | |
82 | + | |
83 | + @Override | |
84 | + public List<AppPatch> listAllByCondition(BaseQuery conditions) { | |
85 | + return appPatchManager.listAllByCondition(conditions); | |
86 | + } | |
87 | + | |
88 | + @Override | |
89 | + public Integer countByCondition(BaseQuery conditions) { | |
90 | + return appPatchManager.countByCondition(conditions); | |
91 | + } | |
92 | + | |
93 | +} | ... | ... |
mobsite-man-service/src/main/java/com/diligrp/mobsite/man/service/impl/AppVersionServiceImpl.java
0 → 100644
1 | +package com.diligrp.mobsite.man.service.impl; | |
2 | + | |
3 | +import java.util.List; | |
4 | + | |
5 | +import javax.annotation.Resource; | |
6 | + | |
7 | +import org.springframework.stereotype.Service; | |
8 | + | |
9 | +import com.diligrp.mobsite.man.domain.AppVersion; | |
10 | +import com.diligrp.mobsite.man.manager.AppVersionManager; | |
11 | +import com.diligrp.mobsite.man.service.AppVersionService; | |
12 | +import com.diligrp.website.util.dao.BaseQuery; | |
13 | +import com.diligrp.website.util.security.Validator; | |
14 | + | |
15 | +/** | |
16 | + * | |
17 | + * @ClassName: AppVersionServiceImpl | |
18 | + * @Description: | |
19 | + * @author zhangshirui | |
20 | + * @date 2014年8月8日 下午5:02:28 | |
21 | + */ | |
22 | +@Service("appVersionService") | |
23 | +public class AppVersionServiceImpl implements AppVersionService { | |
24 | + | |
25 | + @Resource | |
26 | + private AppVersionManager appVersionManager; | |
27 | + | |
28 | + @Override | |
29 | + public boolean save(AppVersion appVersion) { | |
30 | + | |
31 | + boolean flag = false; | |
32 | + if(Validator.isNull(appVersion.getId())){ | |
33 | + flag = appVersionManager.save(appVersion); | |
34 | + } | |
35 | + else{ | |
36 | + flag = appVersionManager.update(appVersion); | |
37 | + } | |
38 | + return flag; | |
39 | + } | |
40 | + | |
41 | + @Override | |
42 | + public boolean update(AppVersion appVersion) { | |
43 | + return appVersionManager.update(appVersion); | |
44 | + } | |
45 | + | |
46 | + @Override | |
47 | + public boolean deleteById(Long id) { | |
48 | + return appVersionManager.deleteById(id); | |
49 | + } | |
50 | + | |
51 | + @Override | |
52 | + public AppVersion getById(Long id) { | |
53 | + return appVersionManager.getById(id); | |
54 | + } | |
55 | + | |
56 | + @Override | |
57 | + public List<AppVersion> listByCondition(BaseQuery conditions) { | |
58 | + return appVersionManager.listByCondition(conditions); | |
59 | + } | |
60 | + | |
61 | + @Override | |
62 | + public List<AppVersion> listAllByCondition(BaseQuery conditions) { | |
63 | + return appVersionManager.listAllByCondition(conditions); | |
64 | + } | |
65 | + | |
66 | + @Override | |
67 | + public Integer countByCondition(BaseQuery conditions) { | |
68 | + return appVersionManager.countByCondition(conditions); | |
69 | + } | |
70 | + | |
71 | +} | ... | ... |
mobsite-man-service/src/main/java/com/diligrp/mobsite/man/service/impl/DemoServiceImpl.java
0 → 100644
1 | +package com.diligrp.mobsite.man.service.impl; | |
2 | + | |
3 | +import com.diligrp.mobsite.man.service.DemoService; | |
4 | + | |
5 | + | |
6 | +/** | |
7 | + * <B>Description</B> TODO <br /> | |
8 | + * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br /> | |
9 | + * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br /> | |
10 | + * <B>Company</B> 地利集团 | |
11 | + * @createTime Aug 5, 2014 4:26:27 PM | |
12 | + * @author wujianjun | |
13 | + */ | |
14 | +public class DemoServiceImpl implements DemoService { | |
15 | + | |
16 | +} | ... | ... |
mobsite-man-service/src/main/java/com/diligrp/mobsite/man/service/impl/FeedbackServiceImpl.java
0 → 100644
1 | +package com.diligrp.mobsite.man.service.impl; | |
2 | + | |
3 | +import com.diligrp.mobsite.man.domain.Feedback; | |
4 | +import com.diligrp.mobsite.man.domain.exception.DiliException; | |
5 | +import com.diligrp.mobsite.man.manager.FeedbackManager; | |
6 | +import com.diligrp.mobsite.man.service.FeedbackService; | |
7 | +import com.diligrp.website.util.dao.BaseQuery; | |
8 | +import com.diligrp.website.util.security.Validator; | |
9 | +import com.diligrp.website.util.web.BeanUtils; | |
10 | +import com.diligrp.website.util.web.PageTemplate; | |
11 | +import org.slf4j.Logger; | |
12 | +import org.slf4j.LoggerFactory; | |
13 | +import org.springframework.beans.factory.annotation.Autowired; | |
14 | +import org.springframework.stereotype.Service; | |
15 | + | |
16 | +import java.util.HashMap; | |
17 | +import java.util.Map; | |
18 | + | |
19 | +/** | |
20 | + * <B>Description</B> <br /> | |
21 | + * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br /> | |
22 | + * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br /> | |
23 | + * <B>Company</B> 地利集团 | |
24 | + * @createTime 2014-9-24 16:53:43 | |
25 | + * @author template | |
26 | + */ | |
27 | +@Service | |
28 | +public class FeedbackServiceImpl implements FeedbackService { | |
29 | + private final static Logger LOG = LoggerFactory | |
30 | + .getLogger(FeedbackServiceImpl.class); | |
31 | + | |
32 | + @Autowired | |
33 | + private FeedbackManager feedbackManager; | |
34 | + | |
35 | + public Map<?, ?> preSave(Feedback obj) throws DiliException { | |
36 | + Map map = new HashMap(); | |
37 | + map.put("obj", obj); | |
38 | + if(obj != null && obj.getId() != null){ | |
39 | + Feedback item = findOne(obj.getId()); | |
40 | + if(item != null){ | |
41 | + map.put("obj", item); | |
42 | + return map; | |
43 | + } | |
44 | + } | |
45 | + return map; | |
46 | + } | |
47 | + | |
48 | + public Feedback findOne(Long pk) throws DiliException{ | |
49 | + return feedbackManager.findOne(pk); | |
50 | + } | |
51 | + | |
52 | + public Boolean save(Feedback feedback) throws DiliException { | |
53 | + return feedbackManager.save(feedback); | |
54 | + } | |
55 | + | |
56 | + public Boolean update(Feedback feedback) throws DiliException { | |
57 | + Feedback up = feedbackManager.findOne(feedback.getId()); | |
58 | + if (up == null) { | |
59 | + return false; | |
60 | + } | |
61 | + up = BeanUtils.merge(up, feedback); | |
62 | + return feedbackManager.update(up); | |
63 | + } | |
64 | + | |
65 | + @Override | |
66 | + public void doRead(Long id) throws DiliException { | |
67 | + final Feedback feedback = feedbackManager.findOne(id); | |
68 | + if(Validator.isNull(feedback)) { | |
69 | + throw new DiliException("未找到源数据"); | |
70 | + } | |
71 | + if(feedback.getStatus() == 2) { | |
72 | + feedback.setStatus(1); | |
73 | + feedbackManager.update(feedback); | |
74 | + } | |
75 | + } | |
76 | + | |
77 | + public PageTemplate find(BaseQuery bq) throws DiliException { | |
78 | + return feedbackManager.find(bq); | |
79 | + } | |
80 | + | |
81 | + public Boolean del(Long id) throws DiliException { | |
82 | + return feedbackManager.del(id); | |
83 | + } | |
84 | + | |
85 | +} | ... | ... |
mobsite-man-service/src/main/java/com/diligrp/mobsite/man/service/impl/PromotionServiceImpl.java
0 → 100644
1 | +package com.diligrp.mobsite.man.service.impl; | |
2 | + | |
3 | +import com.diligrp.messageCenter.sdk.MessageProducerClient; | |
4 | +import com.diligrp.mobsite.man.domain.Promotion; | |
5 | +import com.diligrp.mobsite.man.domain.exception.DiliException; | |
6 | +import com.diligrp.mobsite.man.manager.PromotionManager; | |
7 | +import com.diligrp.mobsite.man.rpc.MarketRPC; | |
8 | +import com.diligrp.mobsite.man.rpc.SearchRPC; | |
9 | +import com.diligrp.mobsite.man.service.PromotionService; | |
10 | +import com.diligrp.titan.sdk.domain.Category; | |
11 | +import com.diligrp.website.util.dao.BaseQuery; | |
12 | +import com.diligrp.website.util.security.Validator; | |
13 | +import com.diligrp.website.util.web.BeanUtils; | |
14 | +import com.diligrp.website.util.web.PageTemplate; | |
15 | +import com.diligrp.website.web.interfaces.domain.output.PickUpPointResp; | |
16 | +import org.slf4j.Logger; | |
17 | +import org.slf4j.LoggerFactory; | |
18 | +import org.springframework.beans.factory.annotation.Autowired; | |
19 | +import org.springframework.stereotype.Service; | |
20 | + | |
21 | +import javax.annotation.Resource; | |
22 | +import java.sql.Timestamp; | |
23 | +import java.util.HashMap; | |
24 | +import java.util.List; | |
25 | +import java.util.Map; | |
26 | + | |
27 | +/** | |
28 | + * <B>Description</B> <br /> | |
29 | + * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br /> | |
30 | + * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br /> | |
31 | + * <B>Company</B> 地利集团 | |
32 | + * | |
33 | + * @author template | |
34 | + * @createTime 2014-9-24 16:53:43 | |
35 | + */ | |
36 | +@Service | |
37 | +public class PromotionServiceImpl implements PromotionService { | |
38 | + private final static Logger LOGGER = LoggerFactory | |
39 | + .getLogger(PromotionServiceImpl.class); | |
40 | + | |
41 | + @Autowired | |
42 | + private PromotionManager promotionManager; | |
43 | + @Resource | |
44 | + private MarketRPC marketRPC; | |
45 | + @Resource | |
46 | + private SearchRPC searchRPC; | |
47 | + @Resource | |
48 | + private MessageProducerClient messageProducerClient; | |
49 | + | |
50 | + public Map<?, ?> preSave(Promotion obj) throws DiliException { | |
51 | + Map map = new HashMap(); | |
52 | + map.put("obj", obj); | |
53 | + if (obj != null && obj.getId() != null) { | |
54 | + Promotion item = findOne(obj.getId()); | |
55 | + // 如果消息已经发送,则重发时不带ID到页面,即不允许更新 | |
56 | + if (item.getSendType() == Promotion.SEND_TYPE_NOW) { | |
57 | + item.setId(null); | |
58 | + } else if (item.getSendTime().getTime() <= System.currentTimeMillis()) { | |
59 | + item.setId(null); | |
60 | + } | |
61 | + if (item != null) { | |
62 | + map.put("obj", item); | |
63 | + } | |
64 | + } | |
65 | + // 加载所有的市场信息 | |
66 | + final List<PickUpPointResp> markets = marketRPC.getMarkets(); | |
67 | + map.put("markets", markets); | |
68 | + if (LOGGER.isInfoEnabled()) { | |
69 | + LOGGER.info("共有{}个市场信息", Validator.isEmpty(markets) ? 0 : markets.size()); | |
70 | + } | |
71 | + return map; | |
72 | + } | |
73 | + | |
74 | + public Promotion findOne(Long pk) throws DiliException { | |
75 | + return promotionManager.findOne(pk); | |
76 | + } | |
77 | + | |
78 | + public Boolean save(Promotion promotion) throws DiliException { | |
79 | + if (Validator.isNumber(promotion.getId() + "")) { | |
80 | + return update(promotion); | |
81 | + } | |
82 | + sendMessageToMessageCenter(promotion); | |
83 | + return promotionManager.save(promotion); | |
84 | + } | |
85 | + | |
86 | + /** | |
87 | + * 将消息通过消息中心发出 | |
88 | + * | |
89 | + * @param promotion | |
90 | + */ | |
91 | + private void sendMessageToMessageCenter(Promotion promotion) { | |
92 | + // 调用消息中心进行消息的发送 | |
93 | + //PlatformType[] platFormtype = null; | |
94 | + //if (promotion.getDeviceType() == Promotion.DEVICE_TYPE_ANDROID) { | |
95 | + // platFormtype = new PlatformType[]{PlatformType.ANDROID}; | |
96 | + //} else if (promotion.getDeviceType() == Promotion.DEVICE_TYPE_IOS) { | |
97 | + // platFormtype = new PlatformType[]{PlatformType.IOS}; | |
98 | + //} else { | |
99 | + // platFormtype = new PlatformType[]{PlatformType.ANDROID, PlatformType.IOS}; | |
100 | + //} | |
101 | + //// 设置消息中心发送系统通知的数据对象 | |
102 | + //PushSysNoticeMessage msg = new PushSysNoticeMessage(); | |
103 | + //msg.setTime(System.currentTimeMillis()); | |
104 | + //msg.setTitle(promotion.getTitle()); | |
105 | + //msg.setContent(promotion.getContent()); | |
106 | + //msg.setOpenAction(promotion.getOpenType()); | |
107 | + // | |
108 | + //// 如果打开方式不为打开本应用,则需要传入ID | |
109 | + //if (msg.getOpenAction() != PushSysNoticeMessage.OPEN_ACTION_OPEN_APP) { | |
110 | + // msg.setPageObjId(JSONObject.parseObject(promotion.getOpenUrl()).getString("ID")); | |
111 | + // // 如果为打开分类,则设置分类名称 | |
112 | + // if (msg.getOpenAction() == PushSysNoticeMessage.OPEN_ACTION_OPEN_CATEGORY_PAGE) { | |
113 | + // try { | |
114 | + // Category category = searchRPC.getCategoryById(Long.valueOf(msg.getPageObjId())); | |
115 | + // msg.setCategoryName(category.getCname()); | |
116 | + // } catch (Exception e) { | |
117 | + // msg.setCategoryName("未知"+msg.getPageObjId()); | |
118 | + // LOGGER.error(String.format("获取分类名称失败[id=%s]", msg.getPageObjId()), e); | |
119 | + // } | |
120 | + // } | |
121 | + //} | |
122 | + //final List<Long> marketIds = promotion.getMarketIds(); | |
123 | + //String[] tags = new String[marketIds.size()]; | |
124 | + //for (int i = 0; i < marketIds.size(); i++) { | |
125 | + // tags[i] = String.valueOf(marketIds.get(i)); | |
126 | + //} | |
127 | + //try { | |
128 | + // long sendType = promotion.getSendType() == Promotion.SEND_TYPE_NOW ? 0 : promotion.getSendTime().getTime(); | |
129 | + // String sendId = messageProducerClient.notificationProducer().produceViaTags(platFormtype, | |
130 | + // tags ,PushType.MESSAGE,JSON.toJSONString(msg),sendType); | |
131 | + // | |
132 | + // //包含IOS通知消息的时候,单独发送一次 | |
133 | + // if (promotion.getDeviceType() != Promotion.DEVICE_TYPE_ANDROID) { | |
134 | + // messageProducerClient.notificationProducer().produceViaTags(new PlatformType[]{PlatformType.IOS}, | |
135 | + // tags ,PushType.NOTIFICATION,JSON.toJSONString(msg),sendType); | |
136 | + // } | |
137 | + // | |
138 | + // promotion.setSendFlag(Promotion.SEND_FLAG_SUCCESS); | |
139 | + // // 设置发送ID | |
140 | + // promotion.setSendId(sendId); | |
141 | + //} catch (Exception e) { | |
142 | + // LoggerFactory.getLogger(getClass()).error("发送系统通知消息失败", e); | |
143 | + // promotion.setSendFlag(Promotion.SEND_FLAG_FAILURE); | |
144 | + //} | |
145 | + } | |
146 | + | |
147 | + public Boolean update(Promotion promotion) throws DiliException { | |
148 | + Promotion up = promotionManager.findOne(promotion.getId()); | |
149 | + if (up == null) { | |
150 | + throw new NullPointerException("没有找到源数据"); | |
151 | + } | |
152 | + final Integer sendType = up.getSendType(); | |
153 | + final Timestamp sendTime = up.getSendTime(); | |
154 | + up = BeanUtils.merge(up, promotion); | |
155 | + if (sendType != Promotion.SEND_TYPE_NOW | |
156 | + && sendTime.getTime() > System.currentTimeMillis()) { | |
157 | + // 删除消息 | |
158 | + delMessageById(up.getSendId()); | |
159 | + } | |
160 | + // 进行消息发送 | |
161 | + sendMessageToMessageCenter(up); | |
162 | + return promotionManager.update(up); | |
163 | + } | |
164 | + | |
165 | + /** | |
166 | + * 从消息中心删除消息 | |
167 | + * | |
168 | + * @param sendId sendId | |
169 | + */ | |
170 | + private void delMessageById(String sendId) { | |
171 | + //try { | |
172 | + // messageProducerClient.cancelProducer().cancel(sendId); | |
173 | + //} catch (DiliUtilException e) { | |
174 | + // LoggerFactory.getLogger(getClass()).error(String.format("删除通知消息失败[sendId=%s]", sendId), e); | |
175 | + //} | |
176 | + } | |
177 | + | |
178 | + public PageTemplate find(BaseQuery bq) throws DiliException { | |
179 | + return promotionManager.find(bq); | |
180 | + } | |
181 | + | |
182 | + public Boolean del(Long id) throws DiliException { | |
183 | + Promotion up = promotionManager.findOne(id); | |
184 | + if (up == null) { | |
185 | + throw new NullPointerException("没有找到源数据"); | |
186 | + } | |
187 | + if (up.getSendType() != Promotion.SEND_TYPE_NOW | |
188 | + && up.getSendTime().getTime() > System.currentTimeMillis()) { | |
189 | + // 删除消息 | |
190 | + delMessageById(up.getSendId()); | |
191 | + } | |
192 | + return promotionManager.del(id); | |
193 | + } | |
194 | + | |
195 | + @Override | |
196 | + public List<Category> getCategory(BaseQuery bq) throws DiliException { | |
197 | + String name = bq.getParam().get("name"); | |
198 | + return searchRPC.searchCategoryList(Validator.isNull(name) ? "" : name); | |
199 | + } | |
200 | + | |
201 | + @Override | |
202 | + public PageTemplate getProduct(BaseQuery bq) throws DiliException { | |
203 | + return searchRPC.searchGoodsList(bq); | |
204 | + } | |
205 | + | |
206 | + @Override | |
207 | + public PageTemplate getShop(BaseQuery bq) throws DiliException { | |
208 | + return searchRPC.searchShopList(bq); | |
209 | + } | |
210 | +} | ... | ... |
mobsite-man-service/src/main/java/com/diligrp/mobsite/man/service/impl/RecipientServiceImpl.java
0 → 100644
1 | +package com.diligrp.mobsite.man.service.impl; | |
2 | + | |
3 | +import com.diligrp.mobsite.man.domain.Recipient; | |
4 | +import com.diligrp.mobsite.man.domain.exception.DiliException; | |
5 | +import com.diligrp.mobsite.man.manager.RecipientManager; | |
6 | +import com.diligrp.mobsite.man.service.RecipientService; | |
7 | +import com.diligrp.website.util.dao.BaseQuery; | |
8 | +import com.diligrp.website.util.web.BeanUtils; | |
9 | +import com.diligrp.website.util.web.PageTemplate; | |
10 | +import org.slf4j.Logger; | |
11 | +import org.slf4j.LoggerFactory; | |
12 | +import org.springframework.beans.factory.annotation.Autowired; | |
13 | +import org.springframework.stereotype.Service; | |
14 | + | |
15 | +import java.util.HashMap; | |
16 | +import java.util.Map; | |
17 | + | |
18 | +/** | |
19 | + * <B>Description</B> <br /> | |
20 | + * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br /> | |
21 | + * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br /> | |
22 | + * <B>Company</B> 地利集团 | |
23 | + * @createTime 2014-9-24 16:53:44 | |
24 | + * @author template | |
25 | + */ | |
26 | +@Service | |
27 | +public class RecipientServiceImpl implements RecipientService { | |
28 | + private final static Logger LOG = LoggerFactory | |
29 | + .getLogger(RecipientServiceImpl.class); | |
30 | + | |
31 | + @Autowired | |
32 | + private RecipientManager recipientManager; | |
33 | + | |
34 | + public Map<?, ?> preSave(Recipient obj) throws DiliException { | |
35 | + Map map = new HashMap(); | |
36 | + map.put("obj", obj); | |
37 | + if(obj != null && obj.getId() != null){ | |
38 | + Recipient item = findOne(obj.getId()); | |
39 | + if(item != null){ | |
40 | + map.put("obj", item); | |
41 | + return map; | |
42 | + } | |
43 | + } | |
44 | + return map; | |
45 | + } | |
46 | + | |
47 | + public Recipient findOne(Long pk) throws DiliException{ | |
48 | + return recipientManager.findOne(pk); | |
49 | + } | |
50 | + | |
51 | + public Boolean save(Recipient recipient) throws DiliException { | |
52 | + return recipientManager.save(recipient); | |
53 | + } | |
54 | + | |
55 | + public Boolean update(Recipient recipient) throws DiliException { | |
56 | + Recipient up = recipientManager.findOne(recipient.getId()); | |
57 | + if (up == null) { | |
58 | + return false; | |
59 | + } | |
60 | + up = BeanUtils.merge(up, recipient); | |
61 | + return recipientManager.update(up); | |
62 | + } | |
63 | + | |
64 | + public PageTemplate find(BaseQuery bq) throws DiliException { | |
65 | + return recipientManager.find(bq); | |
66 | + } | |
67 | + | |
68 | + public Boolean del(Long id) throws DiliException { | |
69 | + return recipientManager.del(id); | |
70 | + } | |
71 | + | |
72 | +} | ... | ... |
mobsite-man-service/src/main/java/com/diligrp/mobsite/man/service/impl/RegisterMapperServiceImpl.java
0 → 100644
1 | +package com.diligrp.mobsite.man.service.impl; | |
2 | + | |
3 | +import com.diligrp.mobsite.getway.domain.RegisterNoMapper; | |
4 | +import com.diligrp.mobsite.man.manager.RegisterNoMapperManager; | |
5 | +import com.diligrp.mobsite.man.service.RegisterMapperService; | |
6 | +import com.diligrp.website.util.dao.BaseQuery; | |
7 | +import org.springframework.stereotype.Service; | |
8 | + | |
9 | +import javax.annotation.Resource; | |
10 | +import java.util.HashSet; | |
11 | +import java.util.List; | |
12 | +import java.util.Set; | |
13 | + | |
14 | +/** | |
15 | + * <B>Description</B> TODO <br /> | |
16 | + * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br /> | |
17 | + * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br /> | |
18 | + * <B>Company</B> 地利集团 | |
19 | + * | |
20 | + * @author wujianjun | |
21 | + * @createTime 2014/10/30 11:38 | |
22 | + */ | |
23 | +@Service | |
24 | +public class RegisterMapperServiceImpl implements RegisterMapperService { | |
25 | + | |
26 | + @Resource | |
27 | + private RegisterNoMapperManager registerNoMapperManager; | |
28 | + | |
29 | + @Override | |
30 | + public Set<String> getRegisterNo(Long userId, Integer sysFlag) { | |
31 | + final List<RegisterNoMapper> registerNoMappers = registerNoMapperManager.findByQuery(new BaseQuery() | |
32 | + .addParam("userid", userId + "").addParam("sysFlag", sysFlag + "")); | |
33 | + Set<String> resp = new HashSet<>(registerNoMappers.size()); | |
34 | + for (RegisterNoMapper registerNoMapper : registerNoMappers) { | |
35 | + resp.add(registerNoMapper.getRegisterNo()); | |
36 | + } | |
37 | + return resp; | |
38 | + } | |
39 | +} | ... | ... |
mobsite-man-service/src/main/java/com/diligrp/mobsite/man/service/utils/ApkPatchUtil.java
0 → 100644
1 | +package com.diligrp.mobsite.man.service.utils; | |
2 | + | |
3 | +import java.io.BufferedInputStream; | |
4 | +import java.io.ByteArrayOutputStream; | |
5 | +import java.io.File; | |
6 | +import java.io.FileOutputStream; | |
7 | +import java.io.IOException; | |
8 | +import java.io.InputStream; | |
9 | +import java.net.HttpURLConnection; | |
10 | +import java.net.MalformedURLException; | |
11 | +import java.net.URL; | |
12 | +import java.security.MessageDigest; | |
13 | + | |
14 | +import org.apache.commons.codec.digest.DigestUtils; | |
15 | +import org.apache.commons.io.IOUtils; | |
16 | + | |
17 | +import com.diligrp.website.util.security.Validator; | |
18 | +import com.nothome.delta.Delta; | |
19 | + | |
20 | +public class ApkPatchUtil { | |
21 | + | |
22 | + | |
23 | + private final static char[] hexChar = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', | |
24 | + 'a', 'b', 'c', 'd', 'e', 'f' }; | |
25 | + | |
26 | + private static String toHexString(byte[] b) { | |
27 | + StringBuilder sb = new StringBuilder(b.length * 2); | |
28 | + for (int i = 0; i < b.length; i++) { | |
29 | + sb.append(hexChar[((b[i] & 0xF0) >>> 4)]); | |
30 | + sb.append(hexChar[(b[i] & 0xF)]); | |
31 | + } | |
32 | + return sb.toString(); | |
33 | + } | |
34 | + | |
35 | + /** 获取文件的md5码 */ | |
36 | + public static String getMD5(InputStream fis) { | |
37 | + String str = null; | |
38 | + try { | |
39 | + byte[] buffer = new byte[1024]; | |
40 | + MessageDigest md5 = MessageDigest.getInstance("MD5"); | |
41 | + int numRead = 0; | |
42 | + while ((numRead = fis.read(buffer)) > 0) { | |
43 | + md5.update(buffer, 0, numRead); | |
44 | + } | |
45 | + | |
46 | + str = toHexString(md5.digest()); | |
47 | + } catch (Exception e) { | |
48 | + e.printStackTrace(); | |
49 | + } finally { | |
50 | + if (fis != null) { | |
51 | + try { | |
52 | + fis.close(); | |
53 | + } catch (Exception e) { | |
54 | + } | |
55 | + } | |
56 | + } | |
57 | + | |
58 | + return str; | |
59 | + } | |
60 | + | |
61 | + /** | |
62 | + * 生成增量包 | |
63 | + * @param oldVersion 低版本 | |
64 | + * @param newVersion 高版本 | |
65 | + * @param newApkMd5 | |
66 | + * @return | |
67 | + * @throws IOException | |
68 | + * @createTime 2015年5月13日 下午4:05:31 | |
69 | + * @author zhangshirui | |
70 | + */ | |
71 | + public static byte[] createPatch(final InputStream sourceInputStream, final InputStream desInputStream){ | |
72 | + if (Validator.isNull(sourceInputStream) || Validator.isNull(desInputStream)) { | |
73 | + throw new RuntimeException("APP起始或者目标版本文件不存在"); | |
74 | + } | |
75 | + | |
76 | + byte[] sourceByte = null; | |
77 | + byte[] desByte = null; | |
78 | + try { | |
79 | + sourceByte = IOUtils.toByteArray(sourceInputStream); | |
80 | + desByte = IOUtils.toByteArray(desInputStream); | |
81 | + } catch (IOException e1) { | |
82 | + // TODO Auto-generated catch block | |
83 | + e1.printStackTrace(); | |
84 | + } | |
85 | + | |
86 | + ByteArrayOutputStream patchOutput = new ByteArrayOutputStream(); | |
87 | + // 如果文件过大,就直接中断 | |
88 | + if (sourceByte == null || desByte == null ||sourceByte.length > Integer.MAX_VALUE || desByte.length > Integer.MAX_VALUE | |
89 | + ||sourceByte.length <= 0 || desByte.length <= 0) { | |
90 | + throw new RuntimeException("APP起始或者目标版本文件不合法,请重新配置"); | |
91 | + } | |
92 | + | |
93 | + Delta d = new Delta(); | |
94 | + // sourceFile 低版本apk, targetFile 高版本apk, output 增量包输出流 | |
95 | + try { | |
96 | + d.compute(sourceByte, desByte, patchOutput); | |
97 | + } catch (IOException e) { | |
98 | + e.printStackTrace(); | |
99 | + } | |
100 | + | |
101 | + return patchOutput.toByteArray(); | |
102 | + } | |
103 | + | |
104 | + /** | |
105 | + * | |
106 | + * @param path | |
107 | + * @return | |
108 | + * @createTime 2015年5月22日 下午5:09:04 | |
109 | + * @author zhangshirui | |
110 | + */ | |
111 | + public static InputStream getFileByte(String path){ | |
112 | + if (Validator.isNull(path)) { | |
113 | + return null; | |
114 | + } | |
115 | + URL url = null; | |
116 | + InputStream inputStream =null; | |
117 | + try { | |
118 | + url = new URL(path); | |
119 | + } catch (MalformedURLException e) { | |
120 | + e.printStackTrace(); | |
121 | + } | |
122 | + HttpURLConnection conn = null; | |
123 | + try { | |
124 | + //利用HttpURLConnection对象,我们可以从网络中获取网页数据. | |
125 | + conn = (HttpURLConnection) url.openConnection(); | |
126 | + conn.setDoInput(true); | |
127 | + conn.connect(); | |
128 | + //得到网络返回的输入流 | |
129 | + inputStream = new BufferedInputStream(conn.getInputStream()); | |
130 | + | |
131 | + } catch (IOException e) { | |
132 | + e.printStackTrace(); | |
133 | + if (conn != null) { | |
134 | + conn.disconnect(); | |
135 | + } | |
136 | + } | |
137 | +// //关闭连接 | |
138 | +// if (conn != null) { | |
139 | +// conn.disconnect(); | |
140 | +// } | |
141 | + | |
142 | +// byte[] fileByte = null; | |
143 | +// try { | |
144 | +// fileByte = IOUtils.toByteArray(inputStream); | |
145 | +// } catch (IOException e) { | |
146 | +// e.printStackTrace(); | |
147 | +// } | |
148 | + return inputStream; | |
149 | + } | |
150 | + | |
151 | + public static void saveFile(byte[] data,String fileName){ | |
152 | + if(data != null){ | |
153 | + String filepath ="D:\\test\\" + fileName; | |
154 | + File file = new File(filepath); | |
155 | + if(file.exists()){ | |
156 | + file.delete(); | |
157 | + } | |
158 | + FileOutputStream fos; | |
159 | + try { | |
160 | + fos = new FileOutputStream(file); | |
161 | + fos.write(data,0,data.length); | |
162 | + fos.flush(); | |
163 | + fos.close(); | |
164 | + } catch (Exception e) { | |
165 | + e.printStackTrace(); | |
166 | + } | |
167 | + | |
168 | + } | |
169 | + } | |
170 | + | |
171 | + | |
172 | + public static void main(String[] args) { | |
173 | + InputStream is = getFileByte("http://xiazai.dili7.com/Pos_1.0.4.apk"); | |
174 | + try { | |
175 | + String codeMd5 = DigestUtils.md5Hex(is); | |
176 | + System.out.println("code"+codeMd5); | |
177 | + } catch (IOException e) { | |
178 | + // TODO Auto-generated catch block | |
179 | + e.printStackTrace(); | |
180 | + } | |
181 | +// String md5 = getMD5(is); | |
182 | +// System.out.println("self"+md5); | |
183 | + | |
184 | + } | |
185 | + | |
186 | +} | ... | ... |
mobsite-man-service/src/main/java/com/diligrp/mobsite/man/service/utils/DateUtils.java
0 → 100644
1 | +package com.diligrp.mobsite.man.service.utils; | |
2 | + | |
3 | +import java.text.ParseException; | |
4 | +import java.text.SimpleDateFormat; | |
5 | +import java.util.Calendar; | |
6 | +import java.util.Date; | |
7 | + | |
8 | +/** | |
9 | + * | |
10 | + * <B>Description</B> 日期工具 <br /> | |
11 | + * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br /> | |
12 | + * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br /> | |
13 | + * <B>Company</B> 地利集团 | |
14 | + * @createTime 2014年8月29日 上午11:15:34 | |
15 | + * @author zhangshirui | |
16 | + */ | |
17 | +public class DateUtils { | |
18 | + | |
19 | + public static final String DATE_FORMAT = "yyyy-MM-dd"; | |
20 | + public static final String DATE_FORMAT_ZH = "yyyy年MM月dd日"; | |
21 | + public static final String DATE_FORMAT_HOUR = "yyyy-MM-dd HH"; | |
22 | + public static final String DATE_FORMAT_COMPACT = "yyyyMMdd"; | |
23 | + public static final String DATE_FORMAT_YM = "yyyyMM"; | |
24 | + | |
25 | + public static final String DATE_TIME_FORMAT12 = "yyyy-MM-dd hh:mm:ss"; | |
26 | + public static final String DATE_TIME_FORMAT24 = "yyyy-MM-dd HH:mm:ss"; | |
27 | + public static final String DATE_TIME_FORMAT24_NO_SECOND = "yyyy-MM-dd HH:mm"; | |
28 | + | |
29 | + public static final String DATE_TIME_FORMAT_MILLI = "yyyy-MM-dd HH:mm:ss S"; | |
30 | + | |
31 | + public static final String DATE_FORMAT_ALL = "yyyyMMddHHmmssS"; | |
32 | + | |
33 | + /** | |
34 | + * 日期转为字符串 | |
35 | + * @param date | |
36 | + * @param formatStr | |
37 | + * @param lenient 是否宽松执行,智能补充 | |
38 | + * @return | |
39 | + * @createTime 2014年8月29日 上午11:18:10 | |
40 | + * @author zhangshirui | |
41 | + */ | |
42 | + public static String formateDateLenient(Date date,String formatStr,boolean lenient){ | |
43 | + SimpleDateFormat format = new SimpleDateFormat(formatStr); | |
44 | + format.setLenient(lenient); | |
45 | + return format.format(date); | |
46 | + } | |
47 | + | |
48 | + public static String formateDate12(Date date){ | |
49 | + return formateDate(date,DATE_TIME_FORMAT12); | |
50 | + } | |
51 | + | |
52 | + public static String formateDate24(Date date){ | |
53 | + return formateDate(date,DATE_TIME_FORMAT24); | |
54 | + } | |
55 | + | |
56 | + /** | |
57 | + * 日期转为字符串 | |
58 | + * @param date | |
59 | + * @param formatStr | |
60 | + * @return | |
61 | + * @createTime 2014年8月29日 上午11:19:47 | |
62 | + * @author zhangshirui | |
63 | + */ | |
64 | + public static String formateDate(Date date,String formatStr){ | |
65 | + return formateDateLenient(date,formatStr,true); | |
66 | + } | |
67 | + | |
68 | + /** | |
69 | + * 字符串转为日期 | |
70 | + * @param dateStr | |
71 | + * @param formatStr | |
72 | + * @param lenient 是否宽松执行,智能补充 | |
73 | + * @return | |
74 | + * @throws Exception | |
75 | + * @createTime 2014年8月29日 上午11:20:02 | |
76 | + * @author zhangshirui | |
77 | + */ | |
78 | + public static Date parseDateLenient(String dateStr,String formatStr,boolean lenient) throws Exception{ | |
79 | + SimpleDateFormat format = new SimpleDateFormat(formatStr); | |
80 | + format.setLenient(lenient); | |
81 | + try { | |
82 | + return format.parse(dateStr); | |
83 | + } catch (ParseException e) { | |
84 | + throw new Exception("解析日期出错"); | |
85 | + } | |
86 | + } | |
87 | + | |
88 | + /** | |
89 | + * 字符串转为日期 | |
90 | + * @param dateStr | |
91 | + * @param formatStr | |
92 | + * @return | |
93 | + * @throws Exception | |
94 | + * @createTime 2014年8月29日 上午11:20:35 | |
95 | + * @author zhangshirui | |
96 | + */ | |
97 | + public static Date parseDate(String dateStr,String formatStr ) throws Exception{ | |
98 | + return parseDateLenient(dateStr,formatStr,true); | |
99 | + } | |
100 | + | |
101 | + /** | |
102 | + * 日期字符串转为数字 | |
103 | + * @param paramString | |
104 | + * @return | |
105 | + * @throws Exception | |
106 | + * @createTime 2014年8月29日 上午11:20:54 | |
107 | + * @author zhangshirui | |
108 | + */ | |
109 | + public static Long strDateToNum(String paramString) throws Exception { | |
110 | + if (paramString == null) | |
111 | + return null; | |
112 | + String[] arrayOfString = null; | |
113 | + String str = ""; | |
114 | + if (paramString.indexOf("-") >= 0) { | |
115 | + arrayOfString = paramString.split("-"); | |
116 | + for (int i = 0; i < arrayOfString.length; ++i) | |
117 | + str = str + arrayOfString[i]; | |
118 | + return Long.valueOf(Long.parseLong(str)); | |
119 | + } | |
120 | + return Long.valueOf(Long.parseLong(paramString)); | |
121 | + } | |
122 | + | |
123 | + /** | |
124 | + * 添加小时 | |
125 | + * @param date | |
126 | + * @param paramInt | |
127 | + * @return | |
128 | + * @throws Exception | |
129 | + * @createTime 2014年8月29日 上午11:29:21 | |
130 | + * @author zhangshirui | |
131 | + */ | |
132 | + public static java.util.Date addHours(java.util.Date date, int paramInt){ | |
133 | + Calendar localCalendar = Calendar.getInstance(); | |
134 | + localCalendar.setTime(date); | |
135 | + localCalendar.add(Calendar.HOUR, paramInt); | |
136 | + return localCalendar.getTime(); | |
137 | + } | |
138 | + | |
139 | + /** | |
140 | + * 添加日期 | |
141 | + * @param date | |
142 | + * @param paramInt | |
143 | + * @return | |
144 | + * @throws Exception | |
145 | + * @createTime 2014年8月29日 上午11:29:21 | |
146 | + * @author zhangshirui | |
147 | + */ | |
148 | + public static java.util.Date addDays(java.util.Date date, int paramInt) | |
149 | + { | |
150 | + Calendar localCalendar = Calendar.getInstance(); | |
151 | + localCalendar.setTime(date); | |
152 | + localCalendar.add(Calendar.DATE, paramInt); | |
153 | + return localCalendar.getTime(); | |
154 | + } | |
155 | + | |
156 | + /** | |
157 | + * 添加月 | |
158 | + * @param date | |
159 | + * @param paramInt | |
160 | + * @return | |
161 | + * @createTime 2014年8月29日 上午11:31:50 | |
162 | + * @author zhangshirui | |
163 | + */ | |
164 | + public static java.util.Date addMonths(java.util.Date date, | |
165 | + int paramInt) { | |
166 | + Calendar localCalendar = Calendar.getInstance(); | |
167 | + localCalendar.setTime(date); | |
168 | + localCalendar.add(Calendar.MONTH, paramInt); | |
169 | + return localCalendar.getTime(); | |
170 | + } | |
171 | + | |
172 | + /** | |
173 | + * 日期相减得到相差小时数 | |
174 | + * @return | |
175 | + * @createTime 2015年4月8日 下午3:00:03 | |
176 | + * @author zhangshirui | |
177 | + */ | |
178 | + public static float subDateToHours(java.util.Date reductionDate,java.util.Date minuendDate) { | |
179 | + float subTimes = reductionDate.getTime() -minuendDate.getTime(); | |
180 | + return subTimes/(1000*60*60); | |
181 | + } | |
182 | + | |
183 | + /** | |
184 | + * 日期相减得到相差秒数 | |
185 | + * @return | |
186 | + * @createTime 2015年4月8日 下午3:00:03 | |
187 | + * @author zhangshirui | |
188 | + */ | |
189 | + public static int subDateToSeconds(java.util.Date reductionDate,java.util.Date minuendDate) { | |
190 | + return (int) ((reductionDate.getTime() -minuendDate.getTime())/1000); | |
191 | + } | |
192 | + | |
193 | + public static Date getLastTimeCurrentDay(Date date){ | |
194 | + Calendar calendar = Calendar.getInstance(); | |
195 | + calendar.setTime(date); | |
196 | + calendar.set(calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), calendar.get(Calendar.DATE), 24, 0); | |
197 | + return calendar.getTime(); | |
198 | + } | |
199 | + | |
200 | + public static void main(String[] args) { | |
201 | + long ss = DateUtils.subDateToSeconds(DateUtils.getLastTimeCurrentDay(new Date()), new Date()); | |
202 | + | |
203 | + System.out.println(ss); | |
204 | + } | |
205 | +} | ... | ... |