...
|
...
|
@@ -86,7 +86,12 @@ public class UnionShareRebateServiceImpl implements IUnionShareRebateService,IBu |
|
|
@Override
|
|
|
public int addSkn(UnionShareRebateBo req){
|
|
|
logger.info("addSkn start.req is {}.",req);
|
|
|
UnionShareRebateSkn rebateSkn = new UnionShareRebateSkn();
|
|
|
UnionShareRebateSkn rebateSkn = unionShareRebateSknMapper.selectBySkn(req.getSkn());
|
|
|
if (rebateSkn != null) {
|
|
|
logger.info("addSkn end.skn exist.req is {}.",req);
|
|
|
return 0;
|
|
|
}
|
|
|
rebateSkn = new UnionShareRebateSkn();
|
|
|
BeanUtils.copyProperties(req,rebateSkn);
|
|
|
if (rebateSkn.getBrand() == null) {
|
|
|
Map<Integer,ProductBo> productBoMap=gerProductInfoMap(Arrays.asList(rebateSkn.getSkn()));
|
...
|
...
|
@@ -117,16 +122,18 @@ public class UnionShareRebateServiceImpl implements IUnionShareRebateService,IBu |
|
|
if (req.getId() == null) {
|
|
|
return addSkn(req);
|
|
|
}
|
|
|
UnionShareRebateSkn rebateSkn = unionShareRebateSknMapper.selectByPrimaryKey(req.getId());
|
|
|
if (rebateSkn == null) {
|
|
|
UnionShareRebateSkn shareRebateSkn = unionShareRebateSknMapper.selectByPrimaryKey(req.getId());
|
|
|
if (shareRebateSkn == null) {
|
|
|
return addSkn(req);
|
|
|
}
|
|
|
UnionShareRebateSkn rebateSkn = new UnionShareRebateSkn();
|
|
|
BeanUtils.copyProperties(req,rebateSkn);
|
|
|
if(!StringUtils.isBlank(req.getRebatePercentStr())){
|
|
|
rebateSkn.setRebate((new BigDecimal(req.getRebatePercentStr())).multiply(new BigDecimal(100)).intValue());
|
|
|
}
|
|
|
rebateSkn.setLastLogId(rebateSkn.getLogId());
|
|
|
int logid = addOptLog(req, rebateSkn.getLogId(), 1, rebateSkn.getId());
|
|
|
rebateSkn.setId(shareRebateSkn.getId());
|
|
|
rebateSkn.setLastLogId(shareRebateSkn.getLogId());
|
|
|
int logid = addOptLog(req, shareRebateSkn.getLogId(), 1, shareRebateSkn.getId());
|
|
|
rebateSkn.setLogId(logid);
|
|
|
rebateSkn.setUpdateTime(DateUtil.getCurrentTimeSeconds());
|
|
|
int result = unionShareRebateSknMapper.updateWithLogid(rebateSkn);
|
...
|
...
|
@@ -188,7 +195,12 @@ public class UnionShareRebateServiceImpl implements IUnionShareRebateService,IBu |
|
|
@Override
|
|
|
public int addBrand(UnionShareRebateBo req){
|
|
|
logger.info("addBrand start.req is {}.",req);
|
|
|
UnionShareRebateBrand rebateBrand = new UnionShareRebateBrand();
|
|
|
UnionShareRebateBrand rebateBrand = unionShareRebateBrandMapper.selectByBrand(req.getBrand());
|
|
|
if (rebateBrand != null) {
|
|
|
logger.info("addBrand end.brand exist.req is {}.",req);
|
|
|
return 0;
|
|
|
}
|
|
|
rebateBrand = new UnionShareRebateBrand();
|
|
|
BeanUtils.copyProperties(req,rebateBrand);
|
|
|
rebateBrand.setRebate((new BigDecimal(req.getRebatePercentStr())).multiply(new BigDecimal(100)).intValue());
|
|
|
int logid = addOptLog(req, 0, 2, req.getBrand());
|
...
|
...
|
@@ -210,16 +222,18 @@ public class UnionShareRebateServiceImpl implements IUnionShareRebateService,IBu |
|
|
if (req.getId() == null) {
|
|
|
return addBrand(req);
|
|
|
}
|
|
|
UnionShareRebateBrand rebateBrand = unionShareRebateBrandMapper.selectByPrimaryKey(req.getId());
|
|
|
if (rebateBrand == null) {
|
|
|
UnionShareRebateBrand shareRebateBrand = unionShareRebateBrandMapper.selectByPrimaryKey(req.getId());
|
|
|
if (shareRebateBrand == null) {
|
|
|
return addBrand(req);
|
|
|
}
|
|
|
UnionShareRebateBrand rebateBrand = new UnionShareRebateBrand();
|
|
|
BeanUtils.copyProperties(req,rebateBrand);
|
|
|
rebateBrand.setLastLogId(rebateBrand.getLogId());
|
|
|
rebateBrand.setId(shareRebateBrand.getId());
|
|
|
rebateBrand.setLastLogId(shareRebateBrand.getLogId());
|
|
|
if(!StringUtils.isBlank(req.getRebatePercentStr())){
|
|
|
rebateBrand.setRebate((new BigDecimal(req.getRebatePercentStr())).multiply(new BigDecimal(100)).intValue());
|
|
|
}
|
|
|
int logid = addOptLog(req, rebateBrand.getLogId(), 2, rebateBrand.getId());
|
|
|
int logid = addOptLog(req, shareRebateBrand.getLogId(), 2, shareRebateBrand.getId());
|
|
|
rebateBrand.setLogId(logid);
|
|
|
rebateBrand.setUpdateTime(DateUtil.getCurrentTimeSecond());
|
|
|
int result = unionShareRebateBrandMapper.updateWithLogid(rebateBrand);
|
...
|
...
|
|