DiliService.java
7.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
package com.diligrp.website.domain;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.Date;
import com.diligrp.website.util.domain.BaseDomain;
import com.google.common.base.Strings;
/**
* <B>Description</B> <br />
* <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br />
* 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br />
* <B>Company</B> 地利集团
* @createTime 2014-6-3 11:33:00
* @author template
*/
public class DiliService extends BaseDomain {
private static final long serialVersionUID = 1L;
/**
* 上架
*/
public static final Integer STATUS_PUTAWAY = 0;
/**
* 下架
*/
public static final Integer STATUS_DOWN = 1;
private static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
/**
* 服务名称
*/
private String name;
/**
* 服务编码
*/
private String code;
/**
* 服务类型;1独立服务,2订单服务,3.通用服务
*/
private Integer type;
/**
* 服务类别;1, 采购, 2, 销售, 3, 通用
*/
private Integer Category;
/**
* 服务介绍
*/
private String remark;
/**
* 上架状态,0上架,1下架
*/
private Integer status;
/**
* 操作人
*/
private Long creator;
/**
* 操作人名
*/
private String creatorName;
/**
* 上架时间
*/
private Timestamp putawayDate;
/**
* 下架时间
*/
private Timestamp downDate;
/**
* 服务图片
*/
private String image;
/**
* 服务图标
*/
private String icon;
/**
* 服务图片
*/
private String serviceImage;
public String getIcon() {
return icon;
}
public void setIcon(String icon) {
this.icon = icon;
}
/**
* 检测并修正状态
* @return
*/
public Boolean checkStatus() {
Timestamp newDate = new Timestamp(new Date().getTime());
Integer st = status;
if (putawayDate == null && downDate == null) {
return false;
}
if (putawayDate == null) {
setStatus(STATUS_DOWN);
return st != status;
// return false;
}
if (downDate == null) {
if (putawayDate.before(newDate)) {
setStatus(STATUS_PUTAWAY);
return st != status;
}
return false;
}
if (downDate.before(newDate) && putawayDate.before(newDate)) {
if (downDate.before(putawayDate)) {
setStatus(STATUS_PUTAWAY);
return st != status;
}
setStatus(STATUS_DOWN);
return st != status;
}
if (downDate.before(newDate)) {
setStatus(STATUS_DOWN);
return st != status;
}
if (putawayDate.before(newDate)) {
setStatus(STATUS_PUTAWAY);
return st != status;
}
return false;
}
public String getDateScope() {
StringBuffer sb = new StringBuffer();
if(putawayDate != null) {
sb.append(sdf.format(putawayDate));
}
sb.append("~");
if (status != null && status.equals(STATUS_DOWN)) {
if (putawayDate != null && downDate != null && downDate.before(putawayDate)) {
} else {
sb.append(sdf.format(downDate));
}
} else if (downDate != null && downDate.after(putawayDate)){
sb.append(sdf.format(downDate));
}
// if (putawayDate == null) {
// sb.append("~");
// if (downDate != null) {
// sb.append(sdf.format(downDate));
// }
// } else {
// if (downDate == null) {
// sb.append(sdf.format(putawayDate));
// sb.append("~");
// } else {
// if (putawayDate.after(downDate)) {
// sb.append(sdf.format(putawayDate));
// sb.append("~");
//// sb.append(sdf.format(downDate));
// } else {
// sb.append(sdf.format(putawayDate));
// sb.append("~");
// sb.append(sdf.format(downDate));
// }
// }
// }
return sb.toString();
}
public void setName (String name){
this.name = name;
}
public String getName(){
return this.name;
}
public void setCode (String code){
this.code = code;
}
public String getCode(){
return this.code;
}
public void setType (Integer type){
this.type = type;
}
public Integer getType(){
return this.type;
}
public void setRemark (String remark){
this.remark = remark;
}
public String getRemark(){
return this.remark;
}
public void setStatus (Integer status){
this.status = status;
}
public Integer getStatus(){
return this.status;
}
public void setCreator (Long creator){
this.creator = creator;
}
public Long getCreator(){
return this.creator;
}
public void setPutawayDate (Timestamp putawayDate){
this.putawayDate = putawayDate;
}
public Timestamp getPutawayDate(){
return this.putawayDate;
}
public Timestamp getDownDate() {
return downDate;
}
public void setDownDate(Timestamp downDate) {
this.downDate = downDate;
}
public String getImage() {
if (!Strings.isNullOrEmpty(serviceImage)) {
return serviceImage;
}
return image;
}
public void setImage(String image) {
this.image = image;
}
public String getServiceImage() {
return serviceImage;
}
public void setServiceImage(String serviceImage) {
this.serviceImage = serviceImage;
}
public Integer getCategory() {
return Category;
}
public void setCategory(Integer category) {
Category = category;
}
public String getCreatorName() {
return creatorName;
}
public void setCreatorName(String creatorName) {
this.creatorName = creatorName;
}
public String toString(){
StringBuffer sb = new StringBuffer();
sb.append("DiliService [");
sb.append("id = ");
sb.append(id);
sb.append(", name = ");
sb.append(name);
sb.append(", code = ");
sb.append(code);
sb.append(", type = ");
sb.append(type);
sb.append(", remark = ");
sb.append(remark);
sb.append(", status = ");
sb.append(status);
sb.append(", creator = ");
sb.append(creator);
sb.append(", putawayDate = ");
sb.append(putawayDate);
sb.append(", downDate = ");
sb.append(downDate);
sb.append(", modified = ");
sb.append(modified);
sb.append(", created = ");
sb.append(created);
sb.append(", image = ");
sb.append(image);
sb.append(", yn = ");
sb.append(yn);
sb.append("]");
return sb.toString();
}
}