|
|
@ -29,6 +29,7 @@ import cn.hutool.core.bean.BeanUtil; |
|
|
|
import cn.hutool.core.date.DateUtil; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.sun.org.apache.regexp.internal.RE; |
|
|
|
import com.yxt.anrui.portal.api.dictcommon.DictCommonFeign; |
|
|
|
import com.yxt.anrui.portal.api.sysuser.PrivilegeQuery; |
|
|
|
import com.yxt.anrui.portal.api.sysuser.SysUserFeign; |
|
|
@ -147,18 +148,33 @@ public class ScmSpecialRebateService extends MybatisBaseService<ScmSpecialRebate |
|
|
|
return p; |
|
|
|
} |
|
|
|
|
|
|
|
public void saveOrUpdateDto(ScmSpecialRebateDto dto) { |
|
|
|
public ResultBean saveOrUpdateDto(ScmSpecialRebateDto dto) { |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
String dtoSid = dto.getSid(); |
|
|
|
QueryWrapper<ScmSpecialRebate> qw = new QueryWrapper<>(); |
|
|
|
qw.eq("createOrgSid",dto.getCreateOrgSid()); |
|
|
|
qw.like("createTime",DateUtil.formatDate(new Date())); |
|
|
|
qw.eq("rebateTypeKey",dto.getRebateTypeKey()); |
|
|
|
qw.eq("rebateName",dto.getRebateName()); |
|
|
|
qw.eq("estimateRebate",dto.getEstimateRebate()); |
|
|
|
qw.eq("palceGenDate",dto.getPalceGenDate()); |
|
|
|
qw.eq("purchaseSystemSid",dto.getPurchaseSystemSid()); |
|
|
|
qw.eq("brandSid",dto.getBrandSid()); |
|
|
|
if (StringUtils.isBlank(dtoSid)) { |
|
|
|
int i = baseMapper.checkSave(qw); |
|
|
|
if (i > 0){ |
|
|
|
return rb.setMsg("返利信息已存在"); |
|
|
|
} |
|
|
|
this.insertByDto(dto); |
|
|
|
return; |
|
|
|
return rb.success(); |
|
|
|
} |
|
|
|
if ("是".equals(dto.getIsAdjustment())){ |
|
|
|
dto.setAdjustmentState(1); |
|
|
|
}else { |
|
|
|
dto.setAdjustmentState(2); |
|
|
|
qw.ne("sid",dtoSid); |
|
|
|
int i = baseMapper.checkSave(qw); |
|
|
|
if (i > 0){ |
|
|
|
return rb.setMsg("返利信息已存在"); |
|
|
|
} |
|
|
|
this.updateByDto(dto); |
|
|
|
return rb.success(); |
|
|
|
} |
|
|
|
|
|
|
|
public void insertByDto(ScmSpecialRebateDto dto) { |
|
|
@ -185,14 +201,14 @@ public class ScmSpecialRebateService extends MybatisBaseService<ScmSpecialRebate |
|
|
|
return vo; |
|
|
|
} |
|
|
|
|
|
|
|
public void updateState(String specialRebateSid,Integer state) { |
|
|
|
baseMapper.updateState(specialRebateSid,state); |
|
|
|
public void updateState(String specialRebateSid, Integer state) { |
|
|
|
baseMapper.updateState(specialRebateSid, state); |
|
|
|
} |
|
|
|
|
|
|
|
public PagerVo<ScmSpecialRebateVo> withApplyGetSpecialRebate(PagerQuery<ScmSpecialRebateQuery> pq) { |
|
|
|
ScmSpecialRebateQuery query = pq.getParams(); |
|
|
|
QueryWrapper<ScmSpecialRebate> qw = new QueryWrapper<>(); |
|
|
|
qw.eq("createOrgSid",query.getCreateOrgSid()); |
|
|
|
qw.eq("createOrgSid", query.getCreateOrgSid()); |
|
|
|
if (StringUtils.isNotBlank(query.getBrandName())) { |
|
|
|
qw.like("brandName", query.getBrandName()); |
|
|
|
} |
|
|
@ -446,14 +462,14 @@ public class ScmSpecialRebateService extends MybatisBaseService<ScmSpecialRebate |
|
|
|
qw.like("ssr.rebateName", query.getRebateName()); |
|
|
|
} |
|
|
|
qw.eq("ssr.state", 4); |
|
|
|
qw.eq("ssca.nodeState","已办结"); |
|
|
|
qw.eq("ssca.nodeState", "已办结"); |
|
|
|
String createStartTime = query.getCreateStartTime(); |
|
|
|
String createEndTime = query.getCreateEndTime(); |
|
|
|
qw.apply(StringUtils.isNotBlank(createStartTime), "date_format (ssr.createTime,'%Y-%m-%d') >= date_format('" + createStartTime + "','%Y-%m-%d')"). |
|
|
|
apply(StringUtils.isNotBlank(createEndTime), "date_format (ssr.createTime,'%Y-%m-%d') <= date_format('" + createEndTime + "','%Y-%m-%d')" |
|
|
|
); |
|
|
|
if (query.getSidList().size() > 0){ |
|
|
|
qw.notIn("ssr.sid",query.getSidList()); |
|
|
|
if (query.getSidList().size() > 0) { |
|
|
|
qw.notIn("ssr.sid", query.getSidList()); |
|
|
|
} |
|
|
|
IPage<ScmSpecialRebate> page = PagerUtil.queryToPage(pq); |
|
|
|
IPage<ScmStayDisRebateVo> pagging = baseMapper.stayDisRebate(page, qw); |
|
|
@ -461,10 +477,10 @@ public class ScmSpecialRebateService extends MybatisBaseService<ScmSpecialRebate |
|
|
|
while (iterator.hasNext()) { |
|
|
|
ScmStayDisRebateVo record = iterator.next(); |
|
|
|
int disVehCount = scmSpecialrebateVehsService.getDisVehCount(record.getSid()); |
|
|
|
if ("0".equals(query.getIsPage()) && disVehCount == 0){ |
|
|
|
if ("0".equals(query.getIsPage()) && disVehCount == 0) { |
|
|
|
iterator.remove(); |
|
|
|
continue; |
|
|
|
}else { |
|
|
|
} else { |
|
|
|
record.setDisNum(String.valueOf(disVehCount)); |
|
|
|
} |
|
|
|
} |
|
|
@ -634,10 +650,10 @@ public class ScmSpecialRebateService extends MybatisBaseService<ScmSpecialRebate |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(excelInfo.getCreateTime())) { |
|
|
|
String createTime = ""; |
|
|
|
if (isNumber(excelInfo.getCreateTime())){ |
|
|
|
if (isNumber(excelInfo.getCreateTime())) { |
|
|
|
Date javaDate = new Date((long) ((Double.valueOf(excelInfo.getCreateTime()) - 25569) * 86400 * 1000)); |
|
|
|
createTime = DateUtil.formatDate(javaDate); |
|
|
|
}else { |
|
|
|
} else { |
|
|
|
createTime = excelInfo.getCreateTime(); |
|
|
|
} |
|
|
|
String[] split = createTime.split("-"); |
|
|
@ -683,10 +699,10 @@ public class ScmSpecialRebateService extends MybatisBaseService<ScmSpecialRebate |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(excelInfo.getUploadDate())) { |
|
|
|
String uploadDate = ""; |
|
|
|
if (isNumber(excelInfo.getUploadDate())){ |
|
|
|
if (isNumber(excelInfo.getUploadDate())) { |
|
|
|
Date javaDate = new Date((long) ((Double.valueOf(excelInfo.getUploadDate()) - 25569) * 86400 * 1000)); |
|
|
|
uploadDate = DateUtil.formatDate(javaDate); |
|
|
|
}else { |
|
|
|
} else { |
|
|
|
uploadDate = excelInfo.getUploadDate(); |
|
|
|
} |
|
|
|
String[] split = uploadDate.split("-"); |
|
|
@ -978,10 +994,10 @@ public class ScmSpecialRebateService extends MybatisBaseService<ScmSpecialRebate |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(excelInfo.getCreateTime())) { |
|
|
|
String createTime = ""; |
|
|
|
if (isNumber(excelInfo.getCreateTime())){ |
|
|
|
if (isNumber(excelInfo.getCreateTime())) { |
|
|
|
Date javaDate = new Date((long) ((Double.valueOf(excelInfo.getCreateTime()) - 25569) * 86400 * 1000)); |
|
|
|
createTime = DateUtil.formatDate(javaDate); |
|
|
|
}else { |
|
|
|
} else { |
|
|
|
createTime = excelInfo.getCreateTime(); |
|
|
|
} |
|
|
|
String[] split = createTime.split("-"); |
|
|
@ -1027,10 +1043,10 @@ public class ScmSpecialRebateService extends MybatisBaseService<ScmSpecialRebate |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(excelInfo.getUploadDate())) { |
|
|
|
String uploadDate = ""; |
|
|
|
if (isNumber(excelInfo.getUploadDate())){ |
|
|
|
if (isNumber(excelInfo.getUploadDate())) { |
|
|
|
Date javaDate = new Date((long) ((Double.valueOf(excelInfo.getUploadDate()) - 25569) * 86400 * 1000)); |
|
|
|
uploadDate = DateUtil.formatDate(javaDate); |
|
|
|
}else { |
|
|
|
} else { |
|
|
|
uploadDate = excelInfo.getUploadDate(); |
|
|
|
} |
|
|
|
String[] split = uploadDate.split("-"); |
|
|
@ -1074,10 +1090,10 @@ public class ScmSpecialRebateService extends MybatisBaseService<ScmSpecialRebate |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(excelInfo.getSecondaryUploadDate())) { |
|
|
|
String secondaryUploadDate = ""; |
|
|
|
if (isNumber(excelInfo.getSecondaryUploadDate())){ |
|
|
|
if (isNumber(excelInfo.getSecondaryUploadDate())) { |
|
|
|
Date javaDate = new Date((long) ((Double.valueOf(excelInfo.getSecondaryUploadDate()) - 25569) * 86400 * 1000)); |
|
|
|
secondaryUploadDate = DateUtil.formatDate(javaDate); |
|
|
|
}else { |
|
|
|
} else { |
|
|
|
secondaryUploadDate = excelInfo.getSecondaryUploadDate(); |
|
|
|
} |
|
|
|
String[] split = secondaryUploadDate.split("-"); |
|
|
|