|
@@ -86,7 +86,12 @@ public class UnionShareRebateServiceImpl implements IUnionShareRebateService,IBu |
|
@@ -86,7 +86,12 @@ public class UnionShareRebateServiceImpl implements IUnionShareRebateService,IBu |
86
|
@Override
|
86
|
@Override
|
87
|
public int addSkn(UnionShareRebateBo req){
|
87
|
public int addSkn(UnionShareRebateBo req){
|
88
|
logger.info("addSkn start.req is {}.",req);
|
88
|
logger.info("addSkn start.req is {}.",req);
|
89
|
- UnionShareRebateSkn rebateSkn = new UnionShareRebateSkn();
|
89
|
+ UnionShareRebateSkn rebateSkn = unionShareRebateSknMapper.selectBySkn(req.getSkn());
|
|
|
90
|
+ if (rebateSkn != null) {
|
|
|
91
|
+ logger.info("addSkn end.skn exist.req is {}.",req);
|
|
|
92
|
+ return 0;
|
|
|
93
|
+ }
|
|
|
94
|
+ rebateSkn = new UnionShareRebateSkn();
|
90
|
BeanUtils.copyProperties(req,rebateSkn);
|
95
|
BeanUtils.copyProperties(req,rebateSkn);
|
91
|
if (rebateSkn.getBrand() == null) {
|
96
|
if (rebateSkn.getBrand() == null) {
|
92
|
Map<Integer,ProductBo> productBoMap=gerProductInfoMap(Arrays.asList(rebateSkn.getSkn()));
|
97
|
Map<Integer,ProductBo> productBoMap=gerProductInfoMap(Arrays.asList(rebateSkn.getSkn()));
|
|
@@ -117,16 +122,18 @@ public class UnionShareRebateServiceImpl implements IUnionShareRebateService,IBu |
|
@@ -117,16 +122,18 @@ public class UnionShareRebateServiceImpl implements IUnionShareRebateService,IBu |
117
|
if (req.getId() == null) {
|
122
|
if (req.getId() == null) {
|
118
|
return addSkn(req);
|
123
|
return addSkn(req);
|
119
|
}
|
124
|
}
|
120
|
- UnionShareRebateSkn rebateSkn = unionShareRebateSknMapper.selectByPrimaryKey(req.getId());
|
|
|
121
|
- if (rebateSkn == null) {
|
125
|
+ UnionShareRebateSkn shareRebateSkn = unionShareRebateSknMapper.selectByPrimaryKey(req.getId());
|
|
|
126
|
+ if (shareRebateSkn == null) {
|
122
|
return addSkn(req);
|
127
|
return addSkn(req);
|
123
|
}
|
128
|
}
|
|
|
129
|
+ UnionShareRebateSkn rebateSkn = new UnionShareRebateSkn();
|
124
|
BeanUtils.copyProperties(req,rebateSkn);
|
130
|
BeanUtils.copyProperties(req,rebateSkn);
|
125
|
if(!StringUtils.isBlank(req.getRebatePercentStr())){
|
131
|
if(!StringUtils.isBlank(req.getRebatePercentStr())){
|
126
|
rebateSkn.setRebate((new BigDecimal(req.getRebatePercentStr())).multiply(new BigDecimal(100)).intValue());
|
132
|
rebateSkn.setRebate((new BigDecimal(req.getRebatePercentStr())).multiply(new BigDecimal(100)).intValue());
|
127
|
}
|
133
|
}
|
128
|
- rebateSkn.setLastLogId(rebateSkn.getLogId());
|
|
|
129
|
- int logid = addOptLog(req, rebateSkn.getLogId(), 1, rebateSkn.getId());
|
134
|
+ rebateSkn.setId(shareRebateSkn.getId());
|
|
|
135
|
+ rebateSkn.setLastLogId(shareRebateSkn.getLogId());
|
|
|
136
|
+ int logid = addOptLog(req, shareRebateSkn.getLogId(), 1, shareRebateSkn.getId());
|
130
|
rebateSkn.setLogId(logid);
|
137
|
rebateSkn.setLogId(logid);
|
131
|
rebateSkn.setUpdateTime(DateUtil.getCurrentTimeSeconds());
|
138
|
rebateSkn.setUpdateTime(DateUtil.getCurrentTimeSeconds());
|
132
|
int result = unionShareRebateSknMapper.updateWithLogid(rebateSkn);
|
139
|
int result = unionShareRebateSknMapper.updateWithLogid(rebateSkn);
|
|
@@ -188,7 +195,12 @@ public class UnionShareRebateServiceImpl implements IUnionShareRebateService,IBu |
|
@@ -188,7 +195,12 @@ public class UnionShareRebateServiceImpl implements IUnionShareRebateService,IBu |
188
|
@Override
|
195
|
@Override
|
189
|
public int addBrand(UnionShareRebateBo req){
|
196
|
public int addBrand(UnionShareRebateBo req){
|
190
|
logger.info("addBrand start.req is {}.",req);
|
197
|
logger.info("addBrand start.req is {}.",req);
|
191
|
- UnionShareRebateBrand rebateBrand = new UnionShareRebateBrand();
|
198
|
+ UnionShareRebateBrand rebateBrand = unionShareRebateBrandMapper.selectByBrand(req.getBrand());
|
|
|
199
|
+ if (rebateBrand != null) {
|
|
|
200
|
+ logger.info("addBrand end.brand exist.req is {}.",req);
|
|
|
201
|
+ return 0;
|
|
|
202
|
+ }
|
|
|
203
|
+ rebateBrand = new UnionShareRebateBrand();
|
192
|
BeanUtils.copyProperties(req,rebateBrand);
|
204
|
BeanUtils.copyProperties(req,rebateBrand);
|
193
|
rebateBrand.setRebate((new BigDecimal(req.getRebatePercentStr())).multiply(new BigDecimal(100)).intValue());
|
205
|
rebateBrand.setRebate((new BigDecimal(req.getRebatePercentStr())).multiply(new BigDecimal(100)).intValue());
|
194
|
int logid = addOptLog(req, 0, 2, req.getBrand());
|
206
|
int logid = addOptLog(req, 0, 2, req.getBrand());
|
|
@@ -210,16 +222,18 @@ public class UnionShareRebateServiceImpl implements IUnionShareRebateService,IBu |
|
@@ -210,16 +222,18 @@ public class UnionShareRebateServiceImpl implements IUnionShareRebateService,IBu |
210
|
if (req.getId() == null) {
|
222
|
if (req.getId() == null) {
|
211
|
return addBrand(req);
|
223
|
return addBrand(req);
|
212
|
}
|
224
|
}
|
213
|
- UnionShareRebateBrand rebateBrand = unionShareRebateBrandMapper.selectByPrimaryKey(req.getId());
|
|
|
214
|
- if (rebateBrand == null) {
|
225
|
+ UnionShareRebateBrand shareRebateBrand = unionShareRebateBrandMapper.selectByPrimaryKey(req.getId());
|
|
|
226
|
+ if (shareRebateBrand == null) {
|
215
|
return addBrand(req);
|
227
|
return addBrand(req);
|
216
|
}
|
228
|
}
|
|
|
229
|
+ UnionShareRebateBrand rebateBrand = new UnionShareRebateBrand();
|
217
|
BeanUtils.copyProperties(req,rebateBrand);
|
230
|
BeanUtils.copyProperties(req,rebateBrand);
|
218
|
- rebateBrand.setLastLogId(rebateBrand.getLogId());
|
231
|
+ rebateBrand.setId(shareRebateBrand.getId());
|
|
|
232
|
+ rebateBrand.setLastLogId(shareRebateBrand.getLogId());
|
219
|
if(!StringUtils.isBlank(req.getRebatePercentStr())){
|
233
|
if(!StringUtils.isBlank(req.getRebatePercentStr())){
|
220
|
rebateBrand.setRebate((new BigDecimal(req.getRebatePercentStr())).multiply(new BigDecimal(100)).intValue());
|
234
|
rebateBrand.setRebate((new BigDecimal(req.getRebatePercentStr())).multiply(new BigDecimal(100)).intValue());
|
221
|
}
|
235
|
}
|
222
|
- int logid = addOptLog(req, rebateBrand.getLogId(), 2, rebateBrand.getId());
|
236
|
+ int logid = addOptLog(req, shareRebateBrand.getLogId(), 2, shareRebateBrand.getId());
|
223
|
rebateBrand.setLogId(logid);
|
237
|
rebateBrand.setLogId(logid);
|
224
|
rebateBrand.setUpdateTime(DateUtil.getCurrentTimeSecond());
|
238
|
rebateBrand.setUpdateTime(DateUtil.getCurrentTimeSecond());
|
225
|
int result = unionShareRebateBrandMapper.updateWithLogid(rebateBrand);
|
239
|
int result = unionShareRebateBrandMapper.updateWithLogid(rebateBrand);
|