分销员
This commit is contained in:
parent
5f113d964f
commit
c6f6c79426
File diff suppressed because it is too large
Load Diff
|
@ -654,39 +654,41 @@ public class AliPayController {
|
||||||
orders.setProjectBenefits(artificerPrice);
|
orders.setProjectBenefits(artificerPrice);
|
||||||
|
|
||||||
UserEntity user = userService.selectUserById(orders.getUserId());
|
UserEntity user = userService.selectUserById(orders.getUserId());
|
||||||
|
//经纪人分佣
|
||||||
|
orders.setJjrMoney(BigDecimal.ZERO);
|
||||||
|
orders.setJjrArtificerDeductMoney(BigDecimal.ZERO);
|
||||||
JjrConfig jc = jjrConfigService.getOne(new QueryWrapper<JjrConfig>());
|
JjrConfig jc = jjrConfigService.getOne(new QueryWrapper<JjrConfig>());
|
||||||
if(jc.getIsOpen().equals(1)){
|
if(jc!=null && jc.getIsOpen().equals(1)){
|
||||||
UserEntity jjrUser = userService.queryByInvitationCode(user.getBlJjrCode());
|
UserEntity jjrUser = userService.queryByInvitationCode(user.getBlJjrCode());
|
||||||
JjrApply jjrApply = jjrApplyService.findByUserId(jjrUser.getUserId());
|
if(jjrUser!=null){
|
||||||
if(jjrApply.getStatus().equals(1)){
|
JjrApply jjrApply = jjrApplyService.findByUserId(jjrUser.getUserId());
|
||||||
if(jjrUser!=null && jjrUser.getBlIsJjr() !=null && jjrUser.getBlIsJjr() ==1){
|
if(jjrApply!=null && jjrApply.getStatus().equals(1)){
|
||||||
orders.setJjrUserId(jjrUser.getUserId());
|
if(jjrUser.getBlIsJjr() !=null && jjrUser.getBlIsJjr() ==1){
|
||||||
orders.setJjrUserName(jjrUser.getUserName());
|
orders.setJjrUserId(jjrUser.getUserId());
|
||||||
BigDecimal artificerRate = jc.getArtificerRate();
|
orders.setJjrUserName(jjrUser.getUserName());
|
||||||
BigDecimal agentRate = jc.getAgentRate();
|
BigDecimal artificerRate = jc.getArtificerRate();
|
||||||
BigDecimal jjrRate = BigDecimal.ZERO;
|
BigDecimal agentRate = jc.getAgentRate();
|
||||||
if(jc.getType().equals(1)){
|
BigDecimal jjrRate = BigDecimal.ZERO;
|
||||||
jjrRate = jc.getRate();
|
if(jc.getType().equals(1)){
|
||||||
}else{
|
jjrRate = jc.getRate();
|
||||||
int invitationCn = jjrApplyService.getInvitationCn(user.getBlJjrCode());
|
}else{
|
||||||
List<JjrConfigLevel> list = jjrConfigServiceLevel.findList(null);
|
int invitationCn = jjrApplyService.getInvitationCn(user.getBlJjrCode());
|
||||||
for(int i=0;i<list.size();i++){
|
List<JjrConfigLevel> list = jjrConfigServiceLevel.findList(null);
|
||||||
JjrConfigLevel jjrcl = list.get(i);
|
for(int i=0;i<list.size();i++){
|
||||||
if(invitationCn>jjrcl.getMinNumber() && invitationCn<=jjrcl.getMaxNumber()){
|
JjrConfigLevel jjrcl = list.get(i);
|
||||||
jjrRate = jjrcl.getRate();
|
if(invitationCn>jjrcl.getMinNumber() && invitationCn<=jjrcl.getMaxNumber()){
|
||||||
break;
|
jjrRate = jjrcl.getRate();
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
BigDecimal jjrMoney = subtract.multiply(jjrRate).divide(new BigDecimal(100)).setScale(2,BigDecimal.ROUND_HALF_UP);
|
||||||
|
orders.setJjrMoney(jjrMoney);
|
||||||
|
BigDecimal jjrOneArtificerDeductMoney = jjrMoney.multiply(artificerRate).divide(new BigDecimal(100)).setScale(2,BigDecimal.ROUND_HALF_UP);
|
||||||
|
orders.setJjrArtificerDeductMoney(jjrOneArtificerDeductMoney);
|
||||||
}
|
}
|
||||||
BigDecimal jjrMoney = subtract.multiply(jjrRate).divide(new BigDecimal(100)).setScale(2,BigDecimal.ROUND_HALF_UP);
|
|
||||||
orders.setJjrMoney(jjrMoney);
|
|
||||||
BigDecimal jjrOneArtificerDeductMoney = jjrMoney.multiply(artificerRate).divide(new BigDecimal(100)).setScale(2,BigDecimal.ROUND_HALF_UP);
|
|
||||||
orders.setJjrArtificerDeductMoney(jjrOneArtificerDeductMoney);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else{
|
|
||||||
orders.setJjrMoney(BigDecimal.ZERO);
|
|
||||||
orders.setJjrArtificerDeductMoney(BigDecimal.ZERO);
|
|
||||||
}
|
}
|
||||||
UserEntity artificerUser = userService.selectUserById(artificer.getUserId());
|
UserEntity artificerUser = userService.selectUserById(artificer.getUserId());
|
||||||
BigDecimal shopMoney = BigDecimal.ZERO;
|
BigDecimal shopMoney = BigDecimal.ZERO;
|
||||||
|
@ -716,115 +718,115 @@ public class AliPayController {
|
||||||
// orders.setOneUserMoney(oneUserMoney);
|
// orders.setOneUserMoney(oneUserMoney);
|
||||||
|
|
||||||
//分销商分佣
|
//分销商分佣
|
||||||
|
orders.setFxyOneMoney(BigDecimal.ZERO);
|
||||||
|
orders.setFxyOneArtificerDeductMoney(BigDecimal.ZERO);
|
||||||
|
orders.setFxyTwoMoney(BigDecimal.ZERO);
|
||||||
|
orders.setFxyTwoArtificerDeductMoney(BigDecimal.ZERO);
|
||||||
FxyConfig fc = fxyConfigService.getOne(new QueryWrapper<FxyConfig>());
|
FxyConfig fc = fxyConfigService.getOne(new QueryWrapper<FxyConfig>());
|
||||||
if(fc.getIsOpen().equals(1)){
|
if(fc!=null && fc.getIsOpen().equals(1)){
|
||||||
UserEntity fxyOneUser = userService.queryByInvitationCode(user.getBlFxyCode());
|
UserEntity fxyOneUser = userService.queryByInvitationCode(user.getBlFxyCode());
|
||||||
FxyApply faOne = fxyApplyService.findByUserId(fxyOneUser.getUserId());
|
if(fxyOneUser!=null){
|
||||||
if(faOne.getStatus().equals(1)){
|
FxyApply faOne = fxyApplyService.findByUserId(fxyOneUser.getUserId());
|
||||||
if(fxyOneUser!=null && fxyOneUser.getBlIsFxy() !=null && fxyOneUser.getBlIsFxy() ==1){
|
if(faOne!=null && faOne.getStatus().equals(1)){
|
||||||
boolean isCanFxyFy = false;
|
if(fxyOneUser.getBlIsFxy() !=null && fxyOneUser.getBlIsFxy() ==1){
|
||||||
if(fc.getFxmLimit().equals(2)){
|
boolean isCanFxyFy = false;
|
||||||
int fxmLimitDays = fc.getFxmLimitDays();
|
if(fc.getFxmLimit().equals(2)){
|
||||||
String approveTime = faOne.getApproveTime();
|
int fxmLimitDays = fc.getFxmLimitDays();
|
||||||
Date approveDate = DateUtils.stringToDate(approveTime,DateUtils.DATE_TIME_PATTERN);
|
String approveTime = faOne.getApproveTime();
|
||||||
Calendar calendar = Calendar.getInstance();
|
Date approveDate = DateUtils.stringToDate(approveTime,DateUtils.DATE_TIME_PATTERN);
|
||||||
calendar.setTime(approveDate);
|
Calendar calendar = Calendar.getInstance();
|
||||||
calendar.add(Calendar.DAY_OF_MONTH, fxmLimitDays);
|
calendar.setTime(approveDate);
|
||||||
approveDate = calendar.getTime();
|
calendar.add(Calendar.DAY_OF_MONTH, fxmLimitDays);
|
||||||
Date current = new Date();
|
approveDate = calendar.getTime();
|
||||||
if(approveDate.getTime() > current.getTime()){
|
Date current = new Date();
|
||||||
isCanFxyFy = true;
|
if(approveDate.getTime() > current.getTime()){
|
||||||
}
|
isCanFxyFy = true;
|
||||||
}else{
|
|
||||||
isCanFxyFy = true;
|
|
||||||
}
|
|
||||||
if(isCanFxyFy){
|
|
||||||
orders.setFxyOneUserId(fxyOneUser.getUserId());
|
|
||||||
orders.setFxyOneUserName(fxyOneUser.getUserName());
|
|
||||||
BigDecimal fxyMoney = BigDecimal.ZERO;
|
|
||||||
if(fc.getType().equals(1)){
|
|
||||||
fxyMoney = artificerPrice;
|
|
||||||
}
|
|
||||||
if(fc.getType().equals(2)){
|
|
||||||
fxyMoney = subtract;
|
|
||||||
}
|
|
||||||
BigDecimal artificerRate = fc.getArtificerRate();
|
|
||||||
BigDecimal mostRate = fc.getMostRate();
|
|
||||||
BigDecimal oneRate = fc.getOneRate();
|
|
||||||
BigDecimal oneRecommendRate = fc.getOneRecommendRate();
|
|
||||||
BigDecimal fxyRate = BigDecimal.ZERO;
|
|
||||||
if(oneRate == null || oneRate.compareTo(BigDecimal.ZERO) == 0){
|
|
||||||
fxyRate = oneRecommendRate;
|
|
||||||
if(oneRecommendRate.compareTo(mostRate)> 0){
|
|
||||||
fxyRate = mostRate;
|
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
fxyRate = oneRate;
|
isCanFxyFy = true;
|
||||||
if(oneRate.compareTo(mostRate)> 0){
|
|
||||||
fxyRate = mostRate;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
BigDecimal fxyOneMoney = fxyMoney.multiply(fxyRate).divide(new BigDecimal(100)).setScale(2,BigDecimal.ROUND_HALF_UP);
|
if(isCanFxyFy){
|
||||||
orders.setFxyOneMoney(fxyOneMoney);
|
orders.setFxyOneUserId(fxyOneUser.getUserId());
|
||||||
BigDecimal fxyOneArtificerDeductMoney = fxyOneMoney.multiply(artificerRate).divide(new BigDecimal(100)).setScale(2,BigDecimal.ROUND_HALF_UP);
|
orders.setFxyOneUserName(fxyOneUser.getUserName());
|
||||||
orders.setFxyOneArtificerDeductMoney(fxyOneArtificerDeductMoney);
|
BigDecimal fxyMoney = BigDecimal.ZERO;
|
||||||
if(fxyOneUser.getBlFxyLevel().equals(1)){
|
if(fc.getType().equals(1)){
|
||||||
UserEntity fxyTwoUser = userService.queryByInvitationCode(fxyOneUser.getBlFxyCode());
|
fxyMoney = artificerPrice;
|
||||||
FxyApply faTwo = fxyApplyService.findByUserId(fxyTwoUser.getUserId());
|
}
|
||||||
if(faTwo.getStatus().equals(1)){
|
if(fc.getType().equals(2)){
|
||||||
if(fxyTwoUser!=null && fxyTwoUser.getBlIsFxy() !=null && fxyTwoUser.getBlIsFxy() ==1){
|
fxyMoney = subtract;
|
||||||
isCanFxyFy = false;
|
}
|
||||||
if(fc.getFxmLimit().equals(2)){
|
BigDecimal artificerRate = fc.getArtificerRate();
|
||||||
int fxmLimitDays = fc.getFxmLimitDays();
|
BigDecimal mostRate = fc.getMostRate();
|
||||||
String approveTime = faTwo.getApproveTime();
|
BigDecimal oneRate = fc.getOneRate();
|
||||||
Date approveDate = DateUtils.stringToDate(approveTime,DateUtils.DATE_TIME_PATTERN);
|
BigDecimal oneRecommendRate = fc.getOneRecommendRate();
|
||||||
Calendar calendar = Calendar.getInstance();
|
BigDecimal fxyRate = BigDecimal.ZERO;
|
||||||
calendar.setTime(approveDate);
|
if(oneRate == null || oneRate.compareTo(BigDecimal.ZERO) == 0){
|
||||||
calendar.add(Calendar.DAY_OF_MONTH, fxmLimitDays);
|
fxyRate = oneRecommendRate;
|
||||||
approveDate = calendar.getTime();
|
if(oneRecommendRate.compareTo(mostRate)> 0){
|
||||||
Date current = new Date();
|
fxyRate = mostRate;
|
||||||
if(approveDate.getTime() > current.getTime()){
|
}
|
||||||
isCanFxyFy = true;
|
}else{
|
||||||
}
|
fxyRate = oneRate;
|
||||||
}else{
|
if(oneRate.compareTo(mostRate)> 0){
|
||||||
isCanFxyFy = true;
|
fxyRate = mostRate;
|
||||||
}
|
}
|
||||||
if(isCanFxyFy) {
|
}
|
||||||
orders.setFxyTwoUserId(fxyTwoUser.getUserId());
|
BigDecimal fxyOneMoney = fxyMoney.multiply(fxyRate).divide(new BigDecimal(100)).setScale(2,BigDecimal.ROUND_HALF_UP);
|
||||||
orders.setFxyTwoUserName(fxyTwoUser.getUserName());
|
orders.setFxyOneMoney(fxyOneMoney);
|
||||||
BigDecimal twoRate = fc.getTwoRate();
|
BigDecimal fxyOneArtificerDeductMoney = fxyOneMoney.multiply(artificerRate).divide(new BigDecimal(100)).setScale(2,BigDecimal.ROUND_HALF_UP);
|
||||||
BigDecimal twoRecommendRate = fc.getTwoRecommendRate();
|
orders.setFxyOneArtificerDeductMoney(fxyOneArtificerDeductMoney);
|
||||||
fxyRate = BigDecimal.ZERO;
|
if(fxyOneUser.getBlFxyLevel().equals(1)){
|
||||||
if (twoRate == null || twoRate.compareTo(BigDecimal.ZERO) == 0) {
|
UserEntity fxyTwoUser = userService.queryByInvitationCode(fxyOneUser.getBlFxyCode());
|
||||||
fxyRate = twoRecommendRate;
|
if(fxyTwoUser!=null){
|
||||||
if (twoRecommendRate.compareTo(mostRate) > 0) {
|
FxyApply faTwo = fxyApplyService.findByUserId(fxyTwoUser.getUserId());
|
||||||
fxyRate = mostRate;
|
if(faTwo!=null && faTwo.getStatus().equals(1)){
|
||||||
|
if(fxyTwoUser.getBlIsFxy() !=null && fxyTwoUser.getBlIsFxy() ==1){
|
||||||
|
isCanFxyFy = false;
|
||||||
|
if(fc.getFxmLimit().equals(2)){
|
||||||
|
int fxmLimitDays = fc.getFxmLimitDays();
|
||||||
|
String approveTime = faTwo.getApproveTime();
|
||||||
|
Date approveDate = DateUtils.stringToDate(approveTime,DateUtils.DATE_TIME_PATTERN);
|
||||||
|
Calendar calendar = Calendar.getInstance();
|
||||||
|
calendar.setTime(approveDate);
|
||||||
|
calendar.add(Calendar.DAY_OF_MONTH, fxmLimitDays);
|
||||||
|
approveDate = calendar.getTime();
|
||||||
|
Date current = new Date();
|
||||||
|
if(approveDate.getTime() > current.getTime()){
|
||||||
|
isCanFxyFy = true;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
isCanFxyFy = true;
|
||||||
}
|
}
|
||||||
} else {
|
if(isCanFxyFy) {
|
||||||
fxyRate = twoRate;
|
orders.setFxyTwoUserId(fxyTwoUser.getUserId());
|
||||||
if (twoRate.compareTo(mostRate) > 0) {
|
orders.setFxyTwoUserName(fxyTwoUser.getUserName());
|
||||||
fxyRate = mostRate;
|
BigDecimal twoRate = fc.getTwoRate();
|
||||||
|
BigDecimal twoRecommendRate = fc.getTwoRecommendRate();
|
||||||
|
fxyRate = BigDecimal.ZERO;
|
||||||
|
if (twoRate == null || twoRate.compareTo(BigDecimal.ZERO) == 0) {
|
||||||
|
fxyRate = twoRecommendRate;
|
||||||
|
if (twoRecommendRate.compareTo(mostRate) > 0) {
|
||||||
|
fxyRate = mostRate;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
fxyRate = twoRate;
|
||||||
|
if (twoRate.compareTo(mostRate) > 0) {
|
||||||
|
fxyRate = mostRate;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
BigDecimal fxyTwoMoney = fxyMoney.multiply(fxyRate).divide(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||||
|
orders.setFxyTwoMoney(fxyTwoMoney);
|
||||||
|
BigDecimal fxyTwoArtificerDeductMoney = fxyTwoMoney.multiply(artificerRate).divide(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||||
|
orders.setFxyTwoArtificerDeductMoney(fxyTwoArtificerDeductMoney);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
BigDecimal fxyTwoMoney = fxyMoney.multiply(fxyRate).divide(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
||||||
orders.setFxyTwoMoney(fxyTwoMoney);
|
|
||||||
BigDecimal fxyTwoArtificerDeductMoney = fxyTwoMoney.multiply(artificerRate).divide(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
||||||
orders.setFxyTwoArtificerDeductMoney(fxyTwoArtificerDeductMoney);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else{
|
|
||||||
orders.setFxyTwoMoney(BigDecimal.ZERO);
|
|
||||||
orders.setFxyTwoArtificerDeductMoney(BigDecimal.ZERO);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else{
|
|
||||||
orders.setFxyOneMoney(BigDecimal.ZERO);
|
|
||||||
orders.setFxyOneArtificerDeductMoney(BigDecimal.ZERO);
|
|
||||||
orders.setFxyTwoMoney(BigDecimal.ZERO);
|
|
||||||
orders.setFxyTwoArtificerDeductMoney(BigDecimal.ZERO);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// artificerPrice = artificerPrice.subtract(oneArtificerMoney);
|
// artificerPrice = artificerPrice.subtract(oneArtificerMoney);
|
||||||
|
@ -1759,39 +1761,41 @@ public class AliPayController {
|
||||||
// orders.setOneArtificerMoney(oneArtificerMoney);
|
// orders.setOneArtificerMoney(oneArtificerMoney);
|
||||||
|
|
||||||
UserEntity user = userService.selectUserById(orders.getUserId());
|
UserEntity user = userService.selectUserById(orders.getUserId());
|
||||||
|
//经纪人分佣
|
||||||
|
orders.setJjrMoney(BigDecimal.ZERO);
|
||||||
|
orders.setJjrArtificerDeductMoney(BigDecimal.ZERO);
|
||||||
JjrConfig jc = jjrConfigService.getOne(new QueryWrapper<JjrConfig>());
|
JjrConfig jc = jjrConfigService.getOne(new QueryWrapper<JjrConfig>());
|
||||||
if(jc.getIsOpen().equals(1)){
|
if(jc!=null && jc.getIsOpen().equals(1)){
|
||||||
UserEntity jjrUser = userService.queryByInvitationCode(user.getBlJjrCode());
|
UserEntity jjrUser = userService.queryByInvitationCode(user.getBlJjrCode());
|
||||||
JjrApply jjrApply = jjrApplyService.findByUserId(jjrUser.getUserId());
|
if(jjrUser!=null){
|
||||||
if(jjrApply.getStatus().equals(1)){
|
JjrApply jjrApply = jjrApplyService.findByUserId(jjrUser.getUserId());
|
||||||
if(jjrUser!=null && jjrUser.getBlIsJjr() !=null && jjrUser.getBlIsJjr() ==1){
|
if(jjrApply!=null && jjrApply.getStatus().equals(1)){
|
||||||
orders.setJjrUserId(jjrUser.getUserId());
|
if(jjrUser.getBlIsJjr() !=null && jjrUser.getBlIsJjr() ==1){
|
||||||
orders.setJjrUserName(jjrUser.getUserName());
|
orders.setJjrUserId(jjrUser.getUserId());
|
||||||
BigDecimal artificerRate = jc.getArtificerRate();
|
orders.setJjrUserName(jjrUser.getUserName());
|
||||||
BigDecimal agentRate = jc.getAgentRate();
|
BigDecimal artificerRate = jc.getArtificerRate();
|
||||||
BigDecimal jjrRate = BigDecimal.ZERO;
|
BigDecimal agentRate = jc.getAgentRate();
|
||||||
if(jc.getType().equals(1)){
|
BigDecimal jjrRate = BigDecimal.ZERO;
|
||||||
jjrRate = jc.getRate();
|
if(jc.getType().equals(1)){
|
||||||
}else{
|
jjrRate = jc.getRate();
|
||||||
int invitationCn = jjrApplyService.getInvitationCn(user.getBlJjrCode());
|
}else{
|
||||||
List<JjrConfigLevel> list = jjrConfigServiceLevel.findList(null);
|
int invitationCn = jjrApplyService.getInvitationCn(user.getBlJjrCode());
|
||||||
for(int i=0;i<list.size();i++){
|
List<JjrConfigLevel> list = jjrConfigServiceLevel.findList(null);
|
||||||
JjrConfigLevel jjrcl = list.get(i);
|
for(int i=0;i<list.size();i++){
|
||||||
if(invitationCn>jjrcl.getMinNumber() && invitationCn<=jjrcl.getMaxNumber()){
|
JjrConfigLevel jjrcl = list.get(i);
|
||||||
jjrRate = jjrcl.getRate();
|
if(invitationCn>jjrcl.getMinNumber() && invitationCn<=jjrcl.getMaxNumber()){
|
||||||
break;
|
jjrRate = jjrcl.getRate();
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
BigDecimal jjrMoney = subtract.multiply(jjrRate).divide(new BigDecimal(100)).setScale(2,BigDecimal.ROUND_HALF_UP);
|
||||||
|
orders.setJjrMoney(jjrMoney);
|
||||||
|
BigDecimal jjrOneArtificerDeductMoney = jjrMoney.multiply(artificerRate).divide(new BigDecimal(100)).setScale(2,BigDecimal.ROUND_HALF_UP);
|
||||||
|
orders.setJjrArtificerDeductMoney(jjrOneArtificerDeductMoney);
|
||||||
}
|
}
|
||||||
BigDecimal jjrMoney = subtract.multiply(jjrRate).divide(new BigDecimal(100)).setScale(2,BigDecimal.ROUND_HALF_UP);
|
|
||||||
orders.setJjrMoney(jjrMoney);
|
|
||||||
BigDecimal jjrOneArtificerDeductMoney = jjrMoney.multiply(artificerRate).divide(new BigDecimal(100)).setScale(2,BigDecimal.ROUND_HALF_UP);
|
|
||||||
orders.setJjrArtificerDeductMoney(jjrOneArtificerDeductMoney);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else{
|
|
||||||
orders.setJjrMoney(BigDecimal.ZERO);
|
|
||||||
orders.setJjrArtificerDeductMoney(BigDecimal.ZERO);
|
|
||||||
}
|
}
|
||||||
UserEntity artificerUser = userService.selectUserById(artificer.getUserId());
|
UserEntity artificerUser = userService.selectUserById(artificer.getUserId());
|
||||||
BigDecimal shopMoney = BigDecimal.ZERO;
|
BigDecimal shopMoney = BigDecimal.ZERO;
|
||||||
|
@ -1821,115 +1825,115 @@ public class AliPayController {
|
||||||
// orders.setOneUserMoney(oneUserMoney);
|
// orders.setOneUserMoney(oneUserMoney);
|
||||||
|
|
||||||
//分销商分佣
|
//分销商分佣
|
||||||
|
orders.setFxyOneMoney(BigDecimal.ZERO);
|
||||||
|
orders.setFxyOneArtificerDeductMoney(BigDecimal.ZERO);
|
||||||
|
orders.setFxyTwoMoney(BigDecimal.ZERO);
|
||||||
|
orders.setFxyTwoArtificerDeductMoney(BigDecimal.ZERO);
|
||||||
FxyConfig fc = fxyConfigService.getOne(new QueryWrapper<FxyConfig>());
|
FxyConfig fc = fxyConfigService.getOne(new QueryWrapper<FxyConfig>());
|
||||||
if(fc.getIsOpen().equals(1)){
|
if(fc!=null && fc.getIsOpen().equals(1)){
|
||||||
UserEntity fxyOneUser = userService.queryByInvitationCode(user.getBlFxyCode());
|
UserEntity fxyOneUser = userService.queryByInvitationCode(user.getBlFxyCode());
|
||||||
FxyApply faOne = fxyApplyService.findByUserId(fxyOneUser.getUserId());
|
if(fxyOneUser!=null){
|
||||||
if(faOne.getStatus().equals(1)){
|
FxyApply faOne = fxyApplyService.findByUserId(fxyOneUser.getUserId());
|
||||||
if(fxyOneUser!=null && fxyOneUser.getBlIsFxy() !=null && fxyOneUser.getBlIsFxy() ==1){
|
if(faOne!=null && faOne.getStatus().equals(1)){
|
||||||
boolean isCanFxyFy = false;
|
if(fxyOneUser.getBlIsFxy() !=null && fxyOneUser.getBlIsFxy() ==1){
|
||||||
if(fc.getFxmLimit().equals(2)){
|
boolean isCanFxyFy = false;
|
||||||
int fxmLimitDays = fc.getFxmLimitDays();
|
if(fc.getFxmLimit().equals(2)){
|
||||||
String approveTime = faOne.getApproveTime();
|
int fxmLimitDays = fc.getFxmLimitDays();
|
||||||
Date approveDate = DateUtils.stringToDate(approveTime,DateUtils.DATE_TIME_PATTERN);
|
String approveTime = faOne.getApproveTime();
|
||||||
Calendar calendar = Calendar.getInstance();
|
Date approveDate = DateUtils.stringToDate(approveTime,DateUtils.DATE_TIME_PATTERN);
|
||||||
calendar.setTime(approveDate);
|
Calendar calendar = Calendar.getInstance();
|
||||||
calendar.add(Calendar.DAY_OF_MONTH, fxmLimitDays);
|
calendar.setTime(approveDate);
|
||||||
approveDate = calendar.getTime();
|
calendar.add(Calendar.DAY_OF_MONTH, fxmLimitDays);
|
||||||
Date current = new Date();
|
approveDate = calendar.getTime();
|
||||||
if(approveDate.getTime() > current.getTime()){
|
Date current = new Date();
|
||||||
isCanFxyFy = true;
|
if(approveDate.getTime() > current.getTime()){
|
||||||
}
|
isCanFxyFy = true;
|
||||||
}else{
|
|
||||||
isCanFxyFy = true;
|
|
||||||
}
|
|
||||||
if(isCanFxyFy){
|
|
||||||
orders.setFxyOneUserId(fxyOneUser.getUserId());
|
|
||||||
orders.setFxyOneUserName(fxyOneUser.getUserName());
|
|
||||||
BigDecimal fxyMoney = BigDecimal.ZERO;
|
|
||||||
if(fc.getType().equals(1)){
|
|
||||||
fxyMoney = artificerPrice;
|
|
||||||
}
|
|
||||||
if(fc.getType().equals(2)){
|
|
||||||
fxyMoney = subtract;
|
|
||||||
}
|
|
||||||
BigDecimal artificerRate = fc.getArtificerRate();
|
|
||||||
BigDecimal mostRate = fc.getMostRate();
|
|
||||||
BigDecimal oneRate = fc.getOneRate();
|
|
||||||
BigDecimal oneRecommendRate = fc.getOneRecommendRate();
|
|
||||||
BigDecimal fxyRate = BigDecimal.ZERO;
|
|
||||||
if(oneRate == null || oneRate.compareTo(BigDecimal.ZERO) == 0){
|
|
||||||
fxyRate = oneRecommendRate;
|
|
||||||
if(oneRecommendRate.compareTo(mostRate)> 0){
|
|
||||||
fxyRate = mostRate;
|
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
fxyRate = oneRate;
|
isCanFxyFy = true;
|
||||||
if(oneRate.compareTo(mostRate)> 0){
|
|
||||||
fxyRate = mostRate;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
BigDecimal fxyOneMoney = fxyMoney.multiply(fxyRate).divide(new BigDecimal(100)).setScale(2,BigDecimal.ROUND_HALF_UP);
|
if(isCanFxyFy){
|
||||||
orders.setFxyOneMoney(fxyOneMoney);
|
orders.setFxyOneUserId(fxyOneUser.getUserId());
|
||||||
BigDecimal fxyOneArtificerDeductMoney = fxyOneMoney.multiply(artificerRate).divide(new BigDecimal(100)).setScale(2,BigDecimal.ROUND_HALF_UP);
|
orders.setFxyOneUserName(fxyOneUser.getUserName());
|
||||||
orders.setFxyOneArtificerDeductMoney(fxyOneArtificerDeductMoney);
|
BigDecimal fxyMoney = BigDecimal.ZERO;
|
||||||
if(fxyOneUser.getBlFxyLevel().equals(1)){
|
if(fc.getType().equals(1)){
|
||||||
UserEntity fxyTwoUser = userService.queryByInvitationCode(fxyOneUser.getBlFxyCode());
|
fxyMoney = artificerPrice;
|
||||||
FxyApply faTwo = fxyApplyService.findByUserId(fxyTwoUser.getUserId());
|
}
|
||||||
if(faTwo.getStatus().equals(1)){
|
if(fc.getType().equals(2)){
|
||||||
if(fxyTwoUser!=null && fxyTwoUser.getBlIsFxy() !=null && fxyTwoUser.getBlIsFxy() ==1){
|
fxyMoney = subtract;
|
||||||
isCanFxyFy = false;
|
}
|
||||||
if(fc.getFxmLimit().equals(2)){
|
BigDecimal artificerRate = fc.getArtificerRate();
|
||||||
int fxmLimitDays = fc.getFxmLimitDays();
|
BigDecimal mostRate = fc.getMostRate();
|
||||||
String approveTime = faTwo.getApproveTime();
|
BigDecimal oneRate = fc.getOneRate();
|
||||||
Date approveDate = DateUtils.stringToDate(approveTime,DateUtils.DATE_TIME_PATTERN);
|
BigDecimal oneRecommendRate = fc.getOneRecommendRate();
|
||||||
Calendar calendar = Calendar.getInstance();
|
BigDecimal fxyRate = BigDecimal.ZERO;
|
||||||
calendar.setTime(approveDate);
|
if(oneRate == null || oneRate.compareTo(BigDecimal.ZERO) == 0){
|
||||||
calendar.add(Calendar.DAY_OF_MONTH, fxmLimitDays);
|
fxyRate = oneRecommendRate;
|
||||||
approveDate = calendar.getTime();
|
if(oneRecommendRate.compareTo(mostRate)> 0){
|
||||||
Date current = new Date();
|
fxyRate = mostRate;
|
||||||
if(approveDate.getTime() > current.getTime()){
|
}
|
||||||
isCanFxyFy = true;
|
}else{
|
||||||
}
|
fxyRate = oneRate;
|
||||||
}else{
|
if(oneRate.compareTo(mostRate)> 0){
|
||||||
isCanFxyFy = true;
|
fxyRate = mostRate;
|
||||||
}
|
}
|
||||||
if(isCanFxyFy) {
|
}
|
||||||
orders.setFxyTwoUserId(fxyTwoUser.getUserId());
|
BigDecimal fxyOneMoney = fxyMoney.multiply(fxyRate).divide(new BigDecimal(100)).setScale(2,BigDecimal.ROUND_HALF_UP);
|
||||||
orders.setFxyTwoUserName(fxyTwoUser.getUserName());
|
orders.setFxyOneMoney(fxyOneMoney);
|
||||||
BigDecimal twoRate = fc.getTwoRate();
|
BigDecimal fxyOneArtificerDeductMoney = fxyOneMoney.multiply(artificerRate).divide(new BigDecimal(100)).setScale(2,BigDecimal.ROUND_HALF_UP);
|
||||||
BigDecimal twoRecommendRate = fc.getTwoRecommendRate();
|
orders.setFxyOneArtificerDeductMoney(fxyOneArtificerDeductMoney);
|
||||||
fxyRate = BigDecimal.ZERO;
|
if(fxyOneUser.getBlFxyLevel().equals(1)){
|
||||||
if (twoRate == null || twoRate.compareTo(BigDecimal.ZERO) == 0) {
|
UserEntity fxyTwoUser = userService.queryByInvitationCode(fxyOneUser.getBlFxyCode());
|
||||||
fxyRate = twoRecommendRate;
|
if(fxyTwoUser!=null){
|
||||||
if (twoRecommendRate.compareTo(mostRate) > 0) {
|
FxyApply faTwo = fxyApplyService.findByUserId(fxyTwoUser.getUserId());
|
||||||
fxyRate = mostRate;
|
if(faTwo!=null && faTwo.getStatus().equals(1)){
|
||||||
|
if(fxyTwoUser.getBlIsFxy() !=null && fxyTwoUser.getBlIsFxy() ==1){
|
||||||
|
isCanFxyFy = false;
|
||||||
|
if(fc.getFxmLimit().equals(2)){
|
||||||
|
int fxmLimitDays = fc.getFxmLimitDays();
|
||||||
|
String approveTime = faTwo.getApproveTime();
|
||||||
|
Date approveDate = DateUtils.stringToDate(approveTime,DateUtils.DATE_TIME_PATTERN);
|
||||||
|
Calendar calendar = Calendar.getInstance();
|
||||||
|
calendar.setTime(approveDate);
|
||||||
|
calendar.add(Calendar.DAY_OF_MONTH, fxmLimitDays);
|
||||||
|
approveDate = calendar.getTime();
|
||||||
|
Date current = new Date();
|
||||||
|
if(approveDate.getTime() > current.getTime()){
|
||||||
|
isCanFxyFy = true;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
isCanFxyFy = true;
|
||||||
}
|
}
|
||||||
} else {
|
if(isCanFxyFy) {
|
||||||
fxyRate = twoRate;
|
orders.setFxyTwoUserId(fxyTwoUser.getUserId());
|
||||||
if (twoRate.compareTo(mostRate) > 0) {
|
orders.setFxyTwoUserName(fxyTwoUser.getUserName());
|
||||||
fxyRate = mostRate;
|
BigDecimal twoRate = fc.getTwoRate();
|
||||||
|
BigDecimal twoRecommendRate = fc.getTwoRecommendRate();
|
||||||
|
fxyRate = BigDecimal.ZERO;
|
||||||
|
if (twoRate == null || twoRate.compareTo(BigDecimal.ZERO) == 0) {
|
||||||
|
fxyRate = twoRecommendRate;
|
||||||
|
if (twoRecommendRate.compareTo(mostRate) > 0) {
|
||||||
|
fxyRate = mostRate;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
fxyRate = twoRate;
|
||||||
|
if (twoRate.compareTo(mostRate) > 0) {
|
||||||
|
fxyRate = mostRate;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
BigDecimal fxyTwoMoney = fxyMoney.multiply(fxyRate).divide(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||||
|
orders.setFxyTwoMoney(fxyTwoMoney);
|
||||||
|
BigDecimal fxyTwoArtificerDeductMoney = fxyTwoMoney.multiply(artificerRate).divide(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||||
|
orders.setFxyTwoArtificerDeductMoney(fxyTwoArtificerDeductMoney);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
BigDecimal fxyTwoMoney = fxyMoney.multiply(fxyRate).divide(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
||||||
orders.setFxyTwoMoney(fxyTwoMoney);
|
|
||||||
BigDecimal fxyTwoArtificerDeductMoney = fxyTwoMoney.multiply(artificerRate).divide(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
||||||
orders.setFxyTwoArtificerDeductMoney(fxyTwoArtificerDeductMoney);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else{
|
|
||||||
orders.setFxyTwoMoney(BigDecimal.ZERO);
|
|
||||||
orders.setFxyTwoArtificerDeductMoney(BigDecimal.ZERO);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else{
|
|
||||||
orders.setFxyOneMoney(BigDecimal.ZERO);
|
|
||||||
orders.setFxyOneArtificerDeductMoney(BigDecimal.ZERO);
|
|
||||||
orders.setFxyTwoMoney(BigDecimal.ZERO);
|
|
||||||
orders.setFxyTwoArtificerDeductMoney(BigDecimal.ZERO);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// artificerPrice = artificerPrice.subtract(oneArtificerMoney);
|
// artificerPrice = artificerPrice.subtract(oneArtificerMoney);
|
||||||
|
@ -2351,39 +2355,41 @@ public class AliPayController {
|
||||||
// orders.setOneArtificerMoney(oneArtificerMoney);
|
// orders.setOneArtificerMoney(oneArtificerMoney);
|
||||||
|
|
||||||
UserEntity user = userService.selectUserById(orders.getUserId());
|
UserEntity user = userService.selectUserById(orders.getUserId());
|
||||||
|
//经纪人分佣
|
||||||
|
orders.setJjrMoney(BigDecimal.ZERO);
|
||||||
|
orders.setJjrArtificerDeductMoney(BigDecimal.ZERO);
|
||||||
JjrConfig jc = jjrConfigService.getOne(new QueryWrapper<JjrConfig>());
|
JjrConfig jc = jjrConfigService.getOne(new QueryWrapper<JjrConfig>());
|
||||||
if(jc.getIsOpen().equals(1)){
|
if(jc!=null && jc.getIsOpen().equals(1)){
|
||||||
UserEntity jjrUser = userService.queryByInvitationCode(user.getBlJjrCode());
|
UserEntity jjrUser = userService.queryByInvitationCode(user.getBlJjrCode());
|
||||||
JjrApply jjrApply = jjrApplyService.findByUserId(jjrUser.getUserId());
|
if(jjrUser!=null){
|
||||||
if(jjrApply.getStatus().equals(1)){
|
JjrApply jjrApply = jjrApplyService.findByUserId(jjrUser.getUserId());
|
||||||
if(jjrUser!=null && jjrUser.getBlIsJjr() !=null && jjrUser.getBlIsJjr() ==1){
|
if(jjrApply!=null && jjrApply.getStatus().equals(1)){
|
||||||
orders.setJjrUserId(jjrUser.getUserId());
|
if(jjrUser.getBlIsJjr() !=null && jjrUser.getBlIsJjr() ==1){
|
||||||
orders.setJjrUserName(jjrUser.getUserName());
|
orders.setJjrUserId(jjrUser.getUserId());
|
||||||
BigDecimal artificerRate = jc.getArtificerRate();
|
orders.setJjrUserName(jjrUser.getUserName());
|
||||||
BigDecimal agentRate = jc.getAgentRate();
|
BigDecimal artificerRate = jc.getArtificerRate();
|
||||||
BigDecimal jjrRate = BigDecimal.ZERO;
|
BigDecimal agentRate = jc.getAgentRate();
|
||||||
if(jc.getType().equals(1)){
|
BigDecimal jjrRate = BigDecimal.ZERO;
|
||||||
jjrRate = jc.getRate();
|
if(jc.getType().equals(1)){
|
||||||
}else{
|
jjrRate = jc.getRate();
|
||||||
int invitationCn = jjrApplyService.getInvitationCn(user.getBlJjrCode());
|
}else{
|
||||||
List<JjrConfigLevel> list = jjrConfigServiceLevel.findList(null);
|
int invitationCn = jjrApplyService.getInvitationCn(user.getBlJjrCode());
|
||||||
for(int i=0;i<list.size();i++){
|
List<JjrConfigLevel> list = jjrConfigServiceLevel.findList(null);
|
||||||
JjrConfigLevel jjrcl = list.get(i);
|
for(int i=0;i<list.size();i++){
|
||||||
if(invitationCn>jjrcl.getMinNumber() && invitationCn<=jjrcl.getMaxNumber()){
|
JjrConfigLevel jjrcl = list.get(i);
|
||||||
jjrRate = jjrcl.getRate();
|
if(invitationCn>jjrcl.getMinNumber() && invitationCn<=jjrcl.getMaxNumber()){
|
||||||
break;
|
jjrRate = jjrcl.getRate();
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
BigDecimal jjrMoney = subtract.multiply(jjrRate).divide(new BigDecimal(100)).setScale(2,BigDecimal.ROUND_HALF_UP);
|
||||||
|
orders.setJjrMoney(jjrMoney);
|
||||||
|
BigDecimal jjrOneArtificerDeductMoney = jjrMoney.multiply(artificerRate).divide(new BigDecimal(100)).setScale(2,BigDecimal.ROUND_HALF_UP);
|
||||||
|
orders.setJjrArtificerDeductMoney(jjrOneArtificerDeductMoney);
|
||||||
}
|
}
|
||||||
BigDecimal jjrMoney = subtract.multiply(jjrRate).divide(new BigDecimal(100)).setScale(2,BigDecimal.ROUND_HALF_UP);
|
|
||||||
orders.setJjrMoney(jjrMoney);
|
|
||||||
BigDecimal jjrOneArtificerDeductMoney = jjrMoney.multiply(artificerRate).divide(new BigDecimal(100)).setScale(2,BigDecimal.ROUND_HALF_UP);
|
|
||||||
orders.setJjrArtificerDeductMoney(jjrOneArtificerDeductMoney);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else{
|
|
||||||
orders.setJjrMoney(BigDecimal.ZERO);
|
|
||||||
orders.setJjrArtificerDeductMoney(BigDecimal.ZERO);
|
|
||||||
}
|
}
|
||||||
UserEntity artificerUser = userService.selectUserById(artificer.getUserId());
|
UserEntity artificerUser = userService.selectUserById(artificer.getUserId());
|
||||||
BigDecimal shopMoney = BigDecimal.ZERO;
|
BigDecimal shopMoney = BigDecimal.ZERO;
|
||||||
|
@ -2413,115 +2419,115 @@ public class AliPayController {
|
||||||
// orders.setOneUserMoney(oneUserMoney);
|
// orders.setOneUserMoney(oneUserMoney);
|
||||||
|
|
||||||
//分销商分佣
|
//分销商分佣
|
||||||
|
orders.setFxyOneMoney(BigDecimal.ZERO);
|
||||||
|
orders.setFxyOneArtificerDeductMoney(BigDecimal.ZERO);
|
||||||
|
orders.setFxyTwoMoney(BigDecimal.ZERO);
|
||||||
|
orders.setFxyTwoArtificerDeductMoney(BigDecimal.ZERO);
|
||||||
FxyConfig fc = fxyConfigService.getOne(new QueryWrapper<FxyConfig>());
|
FxyConfig fc = fxyConfigService.getOne(new QueryWrapper<FxyConfig>());
|
||||||
if(fc.getIsOpen().equals(1)){
|
if(fc!=null && fc.getIsOpen().equals(1)){
|
||||||
UserEntity fxyOneUser = userService.queryByInvitationCode(user.getBlFxyCode());
|
UserEntity fxyOneUser = userService.queryByInvitationCode(user.getBlFxyCode());
|
||||||
FxyApply faOne = fxyApplyService.findByUserId(fxyOneUser.getUserId());
|
if(fxyOneUser!=null){
|
||||||
if(faOne.getStatus().equals(1)){
|
FxyApply faOne = fxyApplyService.findByUserId(fxyOneUser.getUserId());
|
||||||
if(fxyOneUser!=null && fxyOneUser.getBlIsFxy() !=null && fxyOneUser.getBlIsFxy() ==1){
|
if(faOne!=null && faOne.getStatus().equals(1)){
|
||||||
boolean isCanFxyFy = false;
|
if(fxyOneUser.getBlIsFxy() !=null && fxyOneUser.getBlIsFxy() ==1){
|
||||||
if(fc.getFxmLimit().equals(2)){
|
boolean isCanFxyFy = false;
|
||||||
int fxmLimitDays = fc.getFxmLimitDays();
|
if(fc.getFxmLimit().equals(2)){
|
||||||
String approveTime = faOne.getApproveTime();
|
int fxmLimitDays = fc.getFxmLimitDays();
|
||||||
Date approveDate = DateUtils.stringToDate(approveTime,DateUtils.DATE_TIME_PATTERN);
|
String approveTime = faOne.getApproveTime();
|
||||||
Calendar calendar = Calendar.getInstance();
|
Date approveDate = DateUtils.stringToDate(approveTime,DateUtils.DATE_TIME_PATTERN);
|
||||||
calendar.setTime(approveDate);
|
Calendar calendar = Calendar.getInstance();
|
||||||
calendar.add(Calendar.DAY_OF_MONTH, fxmLimitDays);
|
calendar.setTime(approveDate);
|
||||||
approveDate = calendar.getTime();
|
calendar.add(Calendar.DAY_OF_MONTH, fxmLimitDays);
|
||||||
Date current = new Date();
|
approveDate = calendar.getTime();
|
||||||
if(approveDate.getTime() > current.getTime()){
|
Date current = new Date();
|
||||||
isCanFxyFy = true;
|
if(approveDate.getTime() > current.getTime()){
|
||||||
}
|
isCanFxyFy = true;
|
||||||
}else{
|
|
||||||
isCanFxyFy = true;
|
|
||||||
}
|
|
||||||
if(isCanFxyFy){
|
|
||||||
orders.setFxyOneUserId(fxyOneUser.getUserId());
|
|
||||||
orders.setFxyOneUserName(fxyOneUser.getUserName());
|
|
||||||
BigDecimal fxyMoney = BigDecimal.ZERO;
|
|
||||||
if(fc.getType().equals(1)){
|
|
||||||
fxyMoney = artificerPrice;
|
|
||||||
}
|
|
||||||
if(fc.getType().equals(2)){
|
|
||||||
fxyMoney = subtract;
|
|
||||||
}
|
|
||||||
BigDecimal artificerRate = fc.getArtificerRate();
|
|
||||||
BigDecimal mostRate = fc.getMostRate();
|
|
||||||
BigDecimal oneRate = fc.getOneRate();
|
|
||||||
BigDecimal oneRecommendRate = fc.getOneRecommendRate();
|
|
||||||
BigDecimal fxyRate = BigDecimal.ZERO;
|
|
||||||
if(oneRate == null || oneRate.compareTo(BigDecimal.ZERO) == 0){
|
|
||||||
fxyRate = oneRecommendRate;
|
|
||||||
if(oneRecommendRate.compareTo(mostRate)> 0){
|
|
||||||
fxyRate = mostRate;
|
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
fxyRate = oneRate;
|
isCanFxyFy = true;
|
||||||
if(oneRate.compareTo(mostRate)> 0){
|
|
||||||
fxyRate = mostRate;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
BigDecimal fxyOneMoney = fxyMoney.multiply(fxyRate).divide(new BigDecimal(100)).setScale(2,BigDecimal.ROUND_HALF_UP);
|
if(isCanFxyFy){
|
||||||
orders.setFxyOneMoney(fxyOneMoney);
|
orders.setFxyOneUserId(fxyOneUser.getUserId());
|
||||||
BigDecimal fxyOneArtificerDeductMoney = fxyOneMoney.multiply(artificerRate).divide(new BigDecimal(100)).setScale(2,BigDecimal.ROUND_HALF_UP);
|
orders.setFxyOneUserName(fxyOneUser.getUserName());
|
||||||
orders.setFxyOneArtificerDeductMoney(fxyOneArtificerDeductMoney);
|
BigDecimal fxyMoney = BigDecimal.ZERO;
|
||||||
if(fxyOneUser.getBlFxyLevel().equals(1)){
|
if(fc.getType().equals(1)){
|
||||||
UserEntity fxyTwoUser = userService.queryByInvitationCode(fxyOneUser.getBlFxyCode());
|
fxyMoney = artificerPrice;
|
||||||
FxyApply faTwo = fxyApplyService.findByUserId(fxyTwoUser.getUserId());
|
}
|
||||||
if(faTwo.getStatus().equals(1)){
|
if(fc.getType().equals(2)){
|
||||||
if(fxyTwoUser!=null && fxyTwoUser.getBlIsFxy() !=null && fxyTwoUser.getBlIsFxy() ==1){
|
fxyMoney = subtract;
|
||||||
isCanFxyFy = false;
|
}
|
||||||
if(fc.getFxmLimit().equals(2)){
|
BigDecimal artificerRate = fc.getArtificerRate();
|
||||||
int fxmLimitDays = fc.getFxmLimitDays();
|
BigDecimal mostRate = fc.getMostRate();
|
||||||
String approveTime = faTwo.getApproveTime();
|
BigDecimal oneRate = fc.getOneRate();
|
||||||
Date approveDate = DateUtils.stringToDate(approveTime,DateUtils.DATE_TIME_PATTERN);
|
BigDecimal oneRecommendRate = fc.getOneRecommendRate();
|
||||||
Calendar calendar = Calendar.getInstance();
|
BigDecimal fxyRate = BigDecimal.ZERO;
|
||||||
calendar.setTime(approveDate);
|
if(oneRate == null || oneRate.compareTo(BigDecimal.ZERO) == 0){
|
||||||
calendar.add(Calendar.DAY_OF_MONTH, fxmLimitDays);
|
fxyRate = oneRecommendRate;
|
||||||
approveDate = calendar.getTime();
|
if(oneRecommendRate.compareTo(mostRate)> 0){
|
||||||
Date current = new Date();
|
fxyRate = mostRate;
|
||||||
if(approveDate.getTime() > current.getTime()){
|
}
|
||||||
isCanFxyFy = true;
|
}else{
|
||||||
}
|
fxyRate = oneRate;
|
||||||
}else{
|
if(oneRate.compareTo(mostRate)> 0){
|
||||||
isCanFxyFy = true;
|
fxyRate = mostRate;
|
||||||
}
|
}
|
||||||
if(isCanFxyFy) {
|
}
|
||||||
orders.setFxyTwoUserId(fxyTwoUser.getUserId());
|
BigDecimal fxyOneMoney = fxyMoney.multiply(fxyRate).divide(new BigDecimal(100)).setScale(2,BigDecimal.ROUND_HALF_UP);
|
||||||
orders.setFxyTwoUserName(fxyTwoUser.getUserName());
|
orders.setFxyOneMoney(fxyOneMoney);
|
||||||
BigDecimal twoRate = fc.getTwoRate();
|
BigDecimal fxyOneArtificerDeductMoney = fxyOneMoney.multiply(artificerRate).divide(new BigDecimal(100)).setScale(2,BigDecimal.ROUND_HALF_UP);
|
||||||
BigDecimal twoRecommendRate = fc.getTwoRecommendRate();
|
orders.setFxyOneArtificerDeductMoney(fxyOneArtificerDeductMoney);
|
||||||
fxyRate = BigDecimal.ZERO;
|
if(fxyOneUser.getBlFxyLevel().equals(1)){
|
||||||
if (twoRate == null || twoRate.compareTo(BigDecimal.ZERO) == 0) {
|
UserEntity fxyTwoUser = userService.queryByInvitationCode(fxyOneUser.getBlFxyCode());
|
||||||
fxyRate = twoRecommendRate;
|
if(fxyTwoUser!=null){
|
||||||
if (twoRecommendRate.compareTo(mostRate) > 0) {
|
FxyApply faTwo = fxyApplyService.findByUserId(fxyTwoUser.getUserId());
|
||||||
fxyRate = mostRate;
|
if(faTwo!=null && faTwo.getStatus().equals(1)){
|
||||||
|
if(fxyTwoUser.getBlIsFxy() !=null && fxyTwoUser.getBlIsFxy() ==1){
|
||||||
|
isCanFxyFy = false;
|
||||||
|
if(fc.getFxmLimit().equals(2)){
|
||||||
|
int fxmLimitDays = fc.getFxmLimitDays();
|
||||||
|
String approveTime = faTwo.getApproveTime();
|
||||||
|
Date approveDate = DateUtils.stringToDate(approveTime,DateUtils.DATE_TIME_PATTERN);
|
||||||
|
Calendar calendar = Calendar.getInstance();
|
||||||
|
calendar.setTime(approveDate);
|
||||||
|
calendar.add(Calendar.DAY_OF_MONTH, fxmLimitDays);
|
||||||
|
approveDate = calendar.getTime();
|
||||||
|
Date current = new Date();
|
||||||
|
if(approveDate.getTime() > current.getTime()){
|
||||||
|
isCanFxyFy = true;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
isCanFxyFy = true;
|
||||||
}
|
}
|
||||||
} else {
|
if(isCanFxyFy) {
|
||||||
fxyRate = twoRate;
|
orders.setFxyTwoUserId(fxyTwoUser.getUserId());
|
||||||
if (twoRate.compareTo(mostRate) > 0) {
|
orders.setFxyTwoUserName(fxyTwoUser.getUserName());
|
||||||
fxyRate = mostRate;
|
BigDecimal twoRate = fc.getTwoRate();
|
||||||
|
BigDecimal twoRecommendRate = fc.getTwoRecommendRate();
|
||||||
|
fxyRate = BigDecimal.ZERO;
|
||||||
|
if (twoRate == null || twoRate.compareTo(BigDecimal.ZERO) == 0) {
|
||||||
|
fxyRate = twoRecommendRate;
|
||||||
|
if (twoRecommendRate.compareTo(mostRate) > 0) {
|
||||||
|
fxyRate = mostRate;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
fxyRate = twoRate;
|
||||||
|
if (twoRate.compareTo(mostRate) > 0) {
|
||||||
|
fxyRate = mostRate;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
BigDecimal fxyTwoMoney = fxyMoney.multiply(fxyRate).divide(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||||
|
orders.setFxyTwoMoney(fxyTwoMoney);
|
||||||
|
BigDecimal fxyTwoArtificerDeductMoney = fxyTwoMoney.multiply(artificerRate).divide(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||||
|
orders.setFxyTwoArtificerDeductMoney(fxyTwoArtificerDeductMoney);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
BigDecimal fxyTwoMoney = fxyMoney.multiply(fxyRate).divide(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
||||||
orders.setFxyTwoMoney(fxyTwoMoney);
|
|
||||||
BigDecimal fxyTwoArtificerDeductMoney = fxyTwoMoney.multiply(artificerRate).divide(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
||||||
orders.setFxyTwoArtificerDeductMoney(fxyTwoArtificerDeductMoney);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else{
|
|
||||||
orders.setFxyTwoMoney(BigDecimal.ZERO);
|
|
||||||
orders.setFxyTwoArtificerDeductMoney(BigDecimal.ZERO);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else{
|
|
||||||
orders.setFxyOneMoney(BigDecimal.ZERO);
|
|
||||||
orders.setFxyOneArtificerDeductMoney(BigDecimal.ZERO);
|
|
||||||
orders.setFxyTwoMoney(BigDecimal.ZERO);
|
|
||||||
orders.setFxyTwoArtificerDeductMoney(BigDecimal.ZERO);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// artificerPrice = artificerPrice.subtract(oneArtificerMoney);
|
// artificerPrice = artificerPrice.subtract(oneArtificerMoney);
|
||||||
|
|
|
@ -898,39 +898,41 @@ public class WxServiceImpl implements WxService {
|
||||||
orders.setProjectBenefits(artificerPrice);
|
orders.setProjectBenefits(artificerPrice);
|
||||||
|
|
||||||
UserEntity user = userService.selectUserById(orders.getUserId());
|
UserEntity user = userService.selectUserById(orders.getUserId());
|
||||||
|
//经纪人分佣
|
||||||
|
orders.setJjrMoney(BigDecimal.ZERO);
|
||||||
|
orders.setJjrArtificerDeductMoney(BigDecimal.ZERO);
|
||||||
JjrConfig jc = jjrConfigService.getOne(new QueryWrapper<JjrConfig>());
|
JjrConfig jc = jjrConfigService.getOne(new QueryWrapper<JjrConfig>());
|
||||||
if(jc.getIsOpen().equals(1)){
|
if(jc!=null && jc.getIsOpen().equals(1)){
|
||||||
UserEntity jjrUser = userService.queryByInvitationCode(user.getBlJjrCode());
|
UserEntity jjrUser = userService.queryByInvitationCode(user.getBlJjrCode());
|
||||||
JjrApply jjrApply = jjrApplyService.findByUserId(jjrUser.getUserId());
|
if(jjrUser!=null){
|
||||||
if(jjrApply.getStatus().equals(1)){
|
JjrApply jjrApply = jjrApplyService.findByUserId(jjrUser.getUserId());
|
||||||
if(jjrUser!=null && jjrUser.getBlIsJjr() !=null && jjrUser.getBlIsJjr() ==1){
|
if(jjrApply!=null && jjrApply.getStatus().equals(1)){
|
||||||
orders.setJjrUserId(jjrUser.getUserId());
|
if(jjrUser!=null && jjrUser.getBlIsJjr() !=null && jjrUser.getBlIsJjr() ==1){
|
||||||
orders.setJjrUserName(jjrUser.getUserName());
|
orders.setJjrUserId(jjrUser.getUserId());
|
||||||
BigDecimal artificerRate = jc.getArtificerRate();
|
orders.setJjrUserName(jjrUser.getUserName());
|
||||||
BigDecimal agentRate = jc.getAgentRate();
|
BigDecimal artificerRate = jc.getArtificerRate();
|
||||||
BigDecimal jjrRate = BigDecimal.ZERO;
|
BigDecimal agentRate = jc.getAgentRate();
|
||||||
if(jc.getType().equals(1)){
|
BigDecimal jjrRate = BigDecimal.ZERO;
|
||||||
jjrRate = jc.getRate();
|
if(jc.getType().equals(1)){
|
||||||
}else{
|
jjrRate = jc.getRate();
|
||||||
int invitationCn = jjrApplyService.getInvitationCn(user.getBlJjrCode());
|
}else{
|
||||||
List<JjrConfigLevel> list = jjrConfigServiceLevel.findList(null);
|
int invitationCn = jjrApplyService.getInvitationCn(user.getBlJjrCode());
|
||||||
for(int i=0;i<list.size();i++){
|
List<JjrConfigLevel> list = jjrConfigServiceLevel.findList(null);
|
||||||
JjrConfigLevel jjrcl = list.get(i);
|
for(int i=0;i<list.size();i++){
|
||||||
if(invitationCn>jjrcl.getMinNumber() && invitationCn<=jjrcl.getMaxNumber()){
|
JjrConfigLevel jjrcl = list.get(i);
|
||||||
jjrRate = jjrcl.getRate();
|
if(invitationCn>jjrcl.getMinNumber() && invitationCn<=jjrcl.getMaxNumber()){
|
||||||
break;
|
jjrRate = jjrcl.getRate();
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
BigDecimal jjrMoney = subtract.multiply(jjrRate).divide(new BigDecimal(100)).setScale(2,BigDecimal.ROUND_HALF_UP);
|
||||||
|
orders.setJjrMoney(jjrMoney);
|
||||||
|
BigDecimal jjrOneArtificerDeductMoney = jjrMoney.multiply(artificerRate).divide(new BigDecimal(100)).setScale(2,BigDecimal.ROUND_HALF_UP);
|
||||||
|
orders.setJjrArtificerDeductMoney(jjrOneArtificerDeductMoney);
|
||||||
}
|
}
|
||||||
BigDecimal jjrMoney = subtract.multiply(jjrRate).divide(new BigDecimal(100)).setScale(2,BigDecimal.ROUND_HALF_UP);
|
|
||||||
orders.setJjrMoney(jjrMoney);
|
|
||||||
BigDecimal jjrOneArtificerDeductMoney = jjrMoney.multiply(artificerRate).divide(new BigDecimal(100)).setScale(2,BigDecimal.ROUND_HALF_UP);
|
|
||||||
orders.setJjrArtificerDeductMoney(jjrOneArtificerDeductMoney);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else{
|
|
||||||
orders.setJjrMoney(BigDecimal.ZERO);
|
|
||||||
orders.setJjrArtificerDeductMoney(BigDecimal.ZERO);
|
|
||||||
}
|
}
|
||||||
UserEntity artificerUser = userService.selectUserById(artificer.getUserId());
|
UserEntity artificerUser = userService.selectUserById(artificer.getUserId());
|
||||||
BigDecimal shopMoney = BigDecimal.ZERO;
|
BigDecimal shopMoney = BigDecimal.ZERO;
|
||||||
|
@ -960,115 +962,115 @@ public class WxServiceImpl implements WxService {
|
||||||
// orders.setOneUserMoney(oneUserMoney);
|
// orders.setOneUserMoney(oneUserMoney);
|
||||||
|
|
||||||
//分销商分佣
|
//分销商分佣
|
||||||
|
orders.setFxyOneMoney(BigDecimal.ZERO);
|
||||||
|
orders.setFxyOneArtificerDeductMoney(BigDecimal.ZERO);
|
||||||
|
orders.setFxyTwoMoney(BigDecimal.ZERO);
|
||||||
|
orders.setFxyTwoArtificerDeductMoney(BigDecimal.ZERO);
|
||||||
FxyConfig fc = fxyConfigService.getOne(new QueryWrapper<FxyConfig>());
|
FxyConfig fc = fxyConfigService.getOne(new QueryWrapper<FxyConfig>());
|
||||||
if(fc.getIsOpen().equals(1)){
|
if(fc!=null && fc.getIsOpen().equals(1)){
|
||||||
UserEntity fxyOneUser = userService.queryByInvitationCode(user.getBlFxyCode());
|
UserEntity fxyOneUser = userService.queryByInvitationCode(user.getBlFxyCode());
|
||||||
FxyApply faOne = fxyApplyService.findByUserId(fxyOneUser.getUserId());
|
if(fxyOneUser!=null){
|
||||||
if(faOne.getStatus().equals(1)){
|
FxyApply faOne = fxyApplyService.findByUserId(fxyOneUser.getUserId());
|
||||||
if(fxyOneUser!=null && fxyOneUser.getBlIsFxy() !=null && fxyOneUser.getBlIsFxy() ==1){
|
if(faOne!=null && faOne.getStatus().equals(1)){
|
||||||
boolean isCanFxyFy = false;
|
if(fxyOneUser.getBlIsFxy() !=null && fxyOneUser.getBlIsFxy() ==1){
|
||||||
if(fc.getFxmLimit().equals(2)){
|
boolean isCanFxyFy = false;
|
||||||
int fxmLimitDays = fc.getFxmLimitDays();
|
if(fc.getFxmLimit().equals(2)){
|
||||||
String approveTime = faOne.getApproveTime();
|
int fxmLimitDays = fc.getFxmLimitDays();
|
||||||
Date approveDate = DateUtils.stringToDate(approveTime,DateUtils.DATE_TIME_PATTERN);
|
String approveTime = faOne.getApproveTime();
|
||||||
Calendar calendar = Calendar.getInstance();
|
Date approveDate = DateUtils.stringToDate(approveTime,DateUtils.DATE_TIME_PATTERN);
|
||||||
calendar.setTime(approveDate);
|
Calendar calendar = Calendar.getInstance();
|
||||||
calendar.add(Calendar.DAY_OF_MONTH, fxmLimitDays);
|
calendar.setTime(approveDate);
|
||||||
approveDate = calendar.getTime();
|
calendar.add(Calendar.DAY_OF_MONTH, fxmLimitDays);
|
||||||
Date current = new Date();
|
approveDate = calendar.getTime();
|
||||||
if(approveDate.getTime() > current.getTime()){
|
Date current = new Date();
|
||||||
isCanFxyFy = true;
|
if(approveDate.getTime() > current.getTime()){
|
||||||
}
|
isCanFxyFy = true;
|
||||||
}else{
|
|
||||||
isCanFxyFy = true;
|
|
||||||
}
|
|
||||||
if(isCanFxyFy){
|
|
||||||
orders.setFxyOneUserId(fxyOneUser.getUserId());
|
|
||||||
orders.setFxyOneUserName(fxyOneUser.getUserName());
|
|
||||||
BigDecimal fxyMoney = BigDecimal.ZERO;
|
|
||||||
if(fc.getType().equals(1)){
|
|
||||||
fxyMoney = artificerPrice;
|
|
||||||
}
|
|
||||||
if(fc.getType().equals(2)){
|
|
||||||
fxyMoney = subtract;
|
|
||||||
}
|
|
||||||
BigDecimal artificerRate = fc.getArtificerRate();
|
|
||||||
BigDecimal mostRate = fc.getMostRate();
|
|
||||||
BigDecimal oneRate = fc.getOneRate();
|
|
||||||
BigDecimal oneRecommendRate = fc.getOneRecommendRate();
|
|
||||||
BigDecimal fxyRate = BigDecimal.ZERO;
|
|
||||||
if(oneRate == null || oneRate.compareTo(BigDecimal.ZERO) == 0){
|
|
||||||
fxyRate = oneRecommendRate;
|
|
||||||
if(oneRecommendRate.compareTo(mostRate)> 0){
|
|
||||||
fxyRate = mostRate;
|
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
fxyRate = oneRate;
|
isCanFxyFy = true;
|
||||||
if(oneRate.compareTo(mostRate)> 0){
|
|
||||||
fxyRate = mostRate;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
BigDecimal fxyOneMoney = fxyMoney.multiply(fxyRate).divide(new BigDecimal(100)).setScale(2,BigDecimal.ROUND_HALF_UP);
|
if(isCanFxyFy){
|
||||||
orders.setFxyOneMoney(fxyOneMoney);
|
orders.setFxyOneUserId(fxyOneUser.getUserId());
|
||||||
BigDecimal fxyOneArtificerDeductMoney = fxyOneMoney.multiply(artificerRate).divide(new BigDecimal(100)).setScale(2,BigDecimal.ROUND_HALF_UP);
|
orders.setFxyOneUserName(fxyOneUser.getUserName());
|
||||||
orders.setFxyOneArtificerDeductMoney(fxyOneArtificerDeductMoney);
|
BigDecimal fxyMoney = BigDecimal.ZERO;
|
||||||
if(fxyOneUser.getBlFxyLevel().equals(1)){
|
if(fc.getType().equals(1)){
|
||||||
UserEntity fxyTwoUser = userService.queryByInvitationCode(fxyOneUser.getBlFxyCode());
|
fxyMoney = artificerPrice;
|
||||||
FxyApply faTwo = fxyApplyService.findByUserId(fxyTwoUser.getUserId());
|
}
|
||||||
if(faTwo.getStatus().equals(1)){
|
if(fc.getType().equals(2)){
|
||||||
if(fxyTwoUser!=null && fxyTwoUser.getBlIsFxy() !=null && fxyTwoUser.getBlIsFxy() ==1){
|
fxyMoney = subtract;
|
||||||
isCanFxyFy = false;
|
}
|
||||||
if(fc.getFxmLimit().equals(2)){
|
BigDecimal artificerRate = fc.getArtificerRate();
|
||||||
int fxmLimitDays = fc.getFxmLimitDays();
|
BigDecimal mostRate = fc.getMostRate();
|
||||||
String approveTime = faTwo.getApproveTime();
|
BigDecimal oneRate = fc.getOneRate();
|
||||||
Date approveDate = DateUtils.stringToDate(approveTime,DateUtils.DATE_TIME_PATTERN);
|
BigDecimal oneRecommendRate = fc.getOneRecommendRate();
|
||||||
Calendar calendar = Calendar.getInstance();
|
BigDecimal fxyRate = BigDecimal.ZERO;
|
||||||
calendar.setTime(approveDate);
|
if(oneRate == null || oneRate.compareTo(BigDecimal.ZERO) == 0){
|
||||||
calendar.add(Calendar.DAY_OF_MONTH, fxmLimitDays);
|
fxyRate = oneRecommendRate;
|
||||||
approveDate = calendar.getTime();
|
if(oneRecommendRate.compareTo(mostRate)> 0){
|
||||||
Date current = new Date();
|
fxyRate = mostRate;
|
||||||
if(approveDate.getTime() > current.getTime()){
|
}
|
||||||
isCanFxyFy = true;
|
}else{
|
||||||
}
|
fxyRate = oneRate;
|
||||||
}else{
|
if(oneRate.compareTo(mostRate)> 0){
|
||||||
isCanFxyFy = true;
|
fxyRate = mostRate;
|
||||||
}
|
}
|
||||||
if(isCanFxyFy) {
|
}
|
||||||
orders.setFxyTwoUserId(fxyTwoUser.getUserId());
|
BigDecimal fxyOneMoney = fxyMoney.multiply(fxyRate).divide(new BigDecimal(100)).setScale(2,BigDecimal.ROUND_HALF_UP);
|
||||||
orders.setFxyTwoUserName(fxyTwoUser.getUserName());
|
orders.setFxyOneMoney(fxyOneMoney);
|
||||||
BigDecimal twoRate = fc.getTwoRate();
|
BigDecimal fxyOneArtificerDeductMoney = fxyOneMoney.multiply(artificerRate).divide(new BigDecimal(100)).setScale(2,BigDecimal.ROUND_HALF_UP);
|
||||||
BigDecimal twoRecommendRate = fc.getTwoRecommendRate();
|
orders.setFxyOneArtificerDeductMoney(fxyOneArtificerDeductMoney);
|
||||||
fxyRate = BigDecimal.ZERO;
|
if(fxyOneUser.getBlFxyLevel().equals(1)){
|
||||||
if (twoRate == null || twoRate.compareTo(BigDecimal.ZERO) == 0) {
|
UserEntity fxyTwoUser = userService.queryByInvitationCode(fxyOneUser.getBlFxyCode());
|
||||||
fxyRate = twoRecommendRate;
|
if(fxyTwoUser!=null){
|
||||||
if (twoRecommendRate.compareTo(mostRate) > 0) {
|
FxyApply faTwo = fxyApplyService.findByUserId(fxyTwoUser.getUserId());
|
||||||
fxyRate = mostRate;
|
if(faTwo!=null && faTwo.getStatus().equals(1)){
|
||||||
|
if(fxyTwoUser.getBlIsFxy() !=null && fxyTwoUser.getBlIsFxy() ==1){
|
||||||
|
isCanFxyFy = false;
|
||||||
|
if(fc.getFxmLimit().equals(2)){
|
||||||
|
int fxmLimitDays = fc.getFxmLimitDays();
|
||||||
|
String approveTime = faTwo.getApproveTime();
|
||||||
|
Date approveDate = DateUtils.stringToDate(approveTime,DateUtils.DATE_TIME_PATTERN);
|
||||||
|
Calendar calendar = Calendar.getInstance();
|
||||||
|
calendar.setTime(approveDate);
|
||||||
|
calendar.add(Calendar.DAY_OF_MONTH, fxmLimitDays);
|
||||||
|
approveDate = calendar.getTime();
|
||||||
|
Date current = new Date();
|
||||||
|
if(approveDate.getTime() > current.getTime()){
|
||||||
|
isCanFxyFy = true;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
isCanFxyFy = true;
|
||||||
}
|
}
|
||||||
} else {
|
if(isCanFxyFy) {
|
||||||
fxyRate = twoRate;
|
orders.setFxyTwoUserId(fxyTwoUser.getUserId());
|
||||||
if (twoRate.compareTo(mostRate) > 0) {
|
orders.setFxyTwoUserName(fxyTwoUser.getUserName());
|
||||||
fxyRate = mostRate;
|
BigDecimal twoRate = fc.getTwoRate();
|
||||||
|
BigDecimal twoRecommendRate = fc.getTwoRecommendRate();
|
||||||
|
fxyRate = BigDecimal.ZERO;
|
||||||
|
if (twoRate == null || twoRate.compareTo(BigDecimal.ZERO) == 0) {
|
||||||
|
fxyRate = twoRecommendRate;
|
||||||
|
if (twoRecommendRate.compareTo(mostRate) > 0) {
|
||||||
|
fxyRate = mostRate;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
fxyRate = twoRate;
|
||||||
|
if (twoRate.compareTo(mostRate) > 0) {
|
||||||
|
fxyRate = mostRate;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
BigDecimal fxyTwoMoney = fxyMoney.multiply(fxyRate).divide(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||||
|
orders.setFxyTwoMoney(fxyTwoMoney);
|
||||||
|
BigDecimal fxyTwoArtificerDeductMoney = fxyTwoMoney.multiply(artificerRate).divide(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||||
|
orders.setFxyTwoArtificerDeductMoney(fxyTwoArtificerDeductMoney);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
BigDecimal fxyTwoMoney = fxyMoney.multiply(fxyRate).divide(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
||||||
orders.setFxyTwoMoney(fxyTwoMoney);
|
|
||||||
BigDecimal fxyTwoArtificerDeductMoney = fxyTwoMoney.multiply(artificerRate).divide(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
||||||
orders.setFxyTwoArtificerDeductMoney(fxyTwoArtificerDeductMoney);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else{
|
|
||||||
orders.setFxyTwoMoney(BigDecimal.ZERO);
|
|
||||||
orders.setFxyTwoArtificerDeductMoney(BigDecimal.ZERO);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else{
|
|
||||||
orders.setFxyOneMoney(BigDecimal.ZERO);
|
|
||||||
orders.setFxyOneArtificerDeductMoney(BigDecimal.ZERO);
|
|
||||||
orders.setFxyTwoMoney(BigDecimal.ZERO);
|
|
||||||
orders.setFxyTwoArtificerDeductMoney(BigDecimal.ZERO);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// artificerPrice = artificerPrice.subtract(oneArtificerMoney);
|
// artificerPrice = artificerPrice.subtract(oneArtificerMoney);
|
||||||
|
@ -1680,39 +1682,41 @@ public class WxServiceImpl implements WxService {
|
||||||
orders.setProjectBenefits(artificerPrice);
|
orders.setProjectBenefits(artificerPrice);
|
||||||
|
|
||||||
UserEntity user = userService.selectUserById(orders.getUserId());
|
UserEntity user = userService.selectUserById(orders.getUserId());
|
||||||
|
//经纪人分佣
|
||||||
|
orders.setJjrMoney(BigDecimal.ZERO);
|
||||||
|
orders.setJjrArtificerDeductMoney(BigDecimal.ZERO);
|
||||||
JjrConfig jc = jjrConfigService.getOne(new QueryWrapper<JjrConfig>());
|
JjrConfig jc = jjrConfigService.getOne(new QueryWrapper<JjrConfig>());
|
||||||
if(jc.getIsOpen().equals(1)){
|
if(jc!=null && jc.getIsOpen().equals(1)){
|
||||||
UserEntity jjrUser = userService.queryByInvitationCode(user.getBlJjrCode());
|
UserEntity jjrUser = userService.queryByInvitationCode(user.getBlJjrCode());
|
||||||
JjrApply jjrApply = jjrApplyService.findByUserId(jjrUser.getUserId());
|
if(jjrUser!=null){
|
||||||
if(jjrApply.getStatus().equals(1)){
|
JjrApply jjrApply = jjrApplyService.findByUserId(jjrUser.getUserId());
|
||||||
if(jjrUser!=null && jjrUser.getBlIsJjr() !=null && jjrUser.getBlIsJjr() ==1){
|
if(jjrApply!=null && jjrApply.getStatus().equals(1)){
|
||||||
orders.setJjrUserId(jjrUser.getUserId());
|
if( jjrUser.getBlIsJjr() !=null && jjrUser.getBlIsJjr() ==1){
|
||||||
orders.setJjrUserName(jjrUser.getUserName());
|
orders.setJjrUserId(jjrUser.getUserId());
|
||||||
BigDecimal artificerRate = jc.getArtificerRate();
|
orders.setJjrUserName(jjrUser.getUserName());
|
||||||
BigDecimal agentRate = jc.getAgentRate();
|
BigDecimal artificerRate = jc.getArtificerRate();
|
||||||
BigDecimal jjrRate = BigDecimal.ZERO;
|
BigDecimal agentRate = jc.getAgentRate();
|
||||||
if(jc.getType().equals(1)){
|
BigDecimal jjrRate = BigDecimal.ZERO;
|
||||||
jjrRate = jc.getRate();
|
if(jc.getType().equals(1)){
|
||||||
}else{
|
jjrRate = jc.getRate();
|
||||||
int invitationCn = jjrApplyService.getInvitationCn(user.getBlJjrCode());
|
}else{
|
||||||
List<JjrConfigLevel> list = jjrConfigServiceLevel.findList(null);
|
int invitationCn = jjrApplyService.getInvitationCn(user.getBlJjrCode());
|
||||||
for(int i=0;i<list.size();i++){
|
List<JjrConfigLevel> list = jjrConfigServiceLevel.findList(null);
|
||||||
JjrConfigLevel jjrcl = list.get(i);
|
for(int i=0;i<list.size();i++){
|
||||||
if(invitationCn>jjrcl.getMinNumber() && invitationCn<=jjrcl.getMaxNumber()){
|
JjrConfigLevel jjrcl = list.get(i);
|
||||||
jjrRate = jjrcl.getRate();
|
if(invitationCn>jjrcl.getMinNumber() && invitationCn<=jjrcl.getMaxNumber()){
|
||||||
break;
|
jjrRate = jjrcl.getRate();
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
BigDecimal jjrMoney = subtract.multiply(jjrRate).divide(new BigDecimal(100)).setScale(2,BigDecimal.ROUND_HALF_UP);
|
||||||
|
orders.setJjrMoney(jjrMoney);
|
||||||
|
BigDecimal jjrOneArtificerDeductMoney = jjrMoney.multiply(artificerRate).divide(new BigDecimal(100)).setScale(2,BigDecimal.ROUND_HALF_UP);
|
||||||
|
orders.setJjrArtificerDeductMoney(jjrOneArtificerDeductMoney);
|
||||||
}
|
}
|
||||||
BigDecimal jjrMoney = subtract.multiply(jjrRate).divide(new BigDecimal(100)).setScale(2,BigDecimal.ROUND_HALF_UP);
|
|
||||||
orders.setJjrMoney(jjrMoney);
|
|
||||||
BigDecimal jjrOneArtificerDeductMoney = jjrMoney.multiply(artificerRate).divide(new BigDecimal(100)).setScale(2,BigDecimal.ROUND_HALF_UP);
|
|
||||||
orders.setJjrArtificerDeductMoney(jjrOneArtificerDeductMoney);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else{
|
|
||||||
orders.setJjrMoney(BigDecimal.ZERO);
|
|
||||||
orders.setJjrArtificerDeductMoney(BigDecimal.ZERO);
|
|
||||||
}
|
}
|
||||||
UserEntity artificerUser = userService.selectUserById(artificer.getUserId());
|
UserEntity artificerUser = userService.selectUserById(artificer.getUserId());
|
||||||
BigDecimal shopMoney = BigDecimal.ZERO;
|
BigDecimal shopMoney = BigDecimal.ZERO;
|
||||||
|
@ -1742,115 +1746,115 @@ public class WxServiceImpl implements WxService {
|
||||||
// orders.setOneUserMoney(oneUserMoney);
|
// orders.setOneUserMoney(oneUserMoney);
|
||||||
|
|
||||||
//分销商分佣
|
//分销商分佣
|
||||||
|
orders.setFxyOneMoney(BigDecimal.ZERO);
|
||||||
|
orders.setFxyOneArtificerDeductMoney(BigDecimal.ZERO);
|
||||||
|
orders.setFxyTwoMoney(BigDecimal.ZERO);
|
||||||
|
orders.setFxyTwoArtificerDeductMoney(BigDecimal.ZERO);
|
||||||
FxyConfig fc = fxyConfigService.getOne(new QueryWrapper<FxyConfig>());
|
FxyConfig fc = fxyConfigService.getOne(new QueryWrapper<FxyConfig>());
|
||||||
if(fc.getIsOpen().equals(1)){
|
if(fc!=null && fc.getIsOpen().equals(1)){
|
||||||
UserEntity fxyOneUser = userService.queryByInvitationCode(user.getBlFxyCode());
|
UserEntity fxyOneUser = userService.queryByInvitationCode(user.getBlFxyCode());
|
||||||
FxyApply faOne = fxyApplyService.findByUserId(fxyOneUser.getUserId());
|
if(fxyOneUser!=null){
|
||||||
if(faOne.getStatus().equals(1)){
|
FxyApply faOne = fxyApplyService.findByUserId(fxyOneUser.getUserId());
|
||||||
if(fxyOneUser!=null && fxyOneUser.getBlIsFxy() !=null && fxyOneUser.getBlIsFxy() ==1){
|
if(faOne!=null && faOne.getStatus().equals(1)){
|
||||||
boolean isCanFxyFy = false;
|
if(fxyOneUser.getBlIsFxy() !=null && fxyOneUser.getBlIsFxy() ==1){
|
||||||
if(fc.getFxmLimit().equals(2)){
|
boolean isCanFxyFy = false;
|
||||||
int fxmLimitDays = fc.getFxmLimitDays();
|
if(fc.getFxmLimit().equals(2)){
|
||||||
String approveTime = faOne.getApproveTime();
|
int fxmLimitDays = fc.getFxmLimitDays();
|
||||||
Date approveDate = DateUtils.stringToDate(approveTime,DateUtils.DATE_TIME_PATTERN);
|
String approveTime = faOne.getApproveTime();
|
||||||
Calendar calendar = Calendar.getInstance();
|
Date approveDate = DateUtils.stringToDate(approveTime,DateUtils.DATE_TIME_PATTERN);
|
||||||
calendar.setTime(approveDate);
|
Calendar calendar = Calendar.getInstance();
|
||||||
calendar.add(Calendar.DAY_OF_MONTH, fxmLimitDays);
|
calendar.setTime(approveDate);
|
||||||
approveDate = calendar.getTime();
|
calendar.add(Calendar.DAY_OF_MONTH, fxmLimitDays);
|
||||||
Date current = new Date();
|
approveDate = calendar.getTime();
|
||||||
if(approveDate.getTime() > current.getTime()){
|
Date current = new Date();
|
||||||
isCanFxyFy = true;
|
if(approveDate.getTime() > current.getTime()){
|
||||||
}
|
isCanFxyFy = true;
|
||||||
}else{
|
|
||||||
isCanFxyFy = true;
|
|
||||||
}
|
|
||||||
if(isCanFxyFy){
|
|
||||||
orders.setFxyOneUserId(fxyOneUser.getUserId());
|
|
||||||
orders.setFxyOneUserName(fxyOneUser.getUserName());
|
|
||||||
BigDecimal fxyMoney = BigDecimal.ZERO;
|
|
||||||
if(fc.getType().equals(1)){
|
|
||||||
fxyMoney = artificerPrice;
|
|
||||||
}
|
|
||||||
if(fc.getType().equals(2)){
|
|
||||||
fxyMoney = subtract;
|
|
||||||
}
|
|
||||||
BigDecimal artificerRate = fc.getArtificerRate();
|
|
||||||
BigDecimal mostRate = fc.getMostRate();
|
|
||||||
BigDecimal oneRate = fc.getOneRate();
|
|
||||||
BigDecimal oneRecommendRate = fc.getOneRecommendRate();
|
|
||||||
BigDecimal fxyRate = BigDecimal.ZERO;
|
|
||||||
if(oneRate == null || oneRate.compareTo(BigDecimal.ZERO) == 0){
|
|
||||||
fxyRate = oneRecommendRate;
|
|
||||||
if(oneRecommendRate.compareTo(mostRate)> 0){
|
|
||||||
fxyRate = mostRate;
|
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
fxyRate = oneRate;
|
isCanFxyFy = true;
|
||||||
if(oneRate.compareTo(mostRate)> 0){
|
|
||||||
fxyRate = mostRate;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
BigDecimal fxyOneMoney = fxyMoney.multiply(fxyRate).divide(new BigDecimal(100)).setScale(2,BigDecimal.ROUND_HALF_UP);
|
if(isCanFxyFy){
|
||||||
orders.setFxyOneMoney(fxyOneMoney);
|
orders.setFxyOneUserId(fxyOneUser.getUserId());
|
||||||
BigDecimal fxyOneArtificerDeductMoney = fxyOneMoney.multiply(artificerRate).divide(new BigDecimal(100)).setScale(2,BigDecimal.ROUND_HALF_UP);
|
orders.setFxyOneUserName(fxyOneUser.getUserName());
|
||||||
orders.setFxyOneArtificerDeductMoney(fxyOneArtificerDeductMoney);
|
BigDecimal fxyMoney = BigDecimal.ZERO;
|
||||||
if(fxyOneUser.getBlFxyLevel().equals(1)){
|
if(fc.getType().equals(1)){
|
||||||
UserEntity fxyTwoUser = userService.queryByInvitationCode(fxyOneUser.getBlFxyCode());
|
fxyMoney = artificerPrice;
|
||||||
FxyApply faTwo = fxyApplyService.findByUserId(fxyTwoUser.getUserId());
|
}
|
||||||
if(faTwo.getStatus().equals(1)){
|
if(fc.getType().equals(2)){
|
||||||
if(fxyTwoUser!=null && fxyTwoUser.getBlIsFxy() !=null && fxyTwoUser.getBlIsFxy() ==1){
|
fxyMoney = subtract;
|
||||||
isCanFxyFy = false;
|
}
|
||||||
if(fc.getFxmLimit().equals(2)){
|
BigDecimal artificerRate = fc.getArtificerRate();
|
||||||
int fxmLimitDays = fc.getFxmLimitDays();
|
BigDecimal mostRate = fc.getMostRate();
|
||||||
String approveTime = faTwo.getApproveTime();
|
BigDecimal oneRate = fc.getOneRate();
|
||||||
Date approveDate = DateUtils.stringToDate(approveTime,DateUtils.DATE_TIME_PATTERN);
|
BigDecimal oneRecommendRate = fc.getOneRecommendRate();
|
||||||
Calendar calendar = Calendar.getInstance();
|
BigDecimal fxyRate = BigDecimal.ZERO;
|
||||||
calendar.setTime(approveDate);
|
if(oneRate == null || oneRate.compareTo(BigDecimal.ZERO) == 0){
|
||||||
calendar.add(Calendar.DAY_OF_MONTH, fxmLimitDays);
|
fxyRate = oneRecommendRate;
|
||||||
approveDate = calendar.getTime();
|
if(oneRecommendRate.compareTo(mostRate)> 0){
|
||||||
Date current = new Date();
|
fxyRate = mostRate;
|
||||||
if(approveDate.getTime() > current.getTime()){
|
}
|
||||||
isCanFxyFy = true;
|
}else{
|
||||||
}
|
fxyRate = oneRate;
|
||||||
}else{
|
if(oneRate.compareTo(mostRate)> 0){
|
||||||
isCanFxyFy = true;
|
fxyRate = mostRate;
|
||||||
}
|
}
|
||||||
if(isCanFxyFy) {
|
}
|
||||||
orders.setFxyTwoUserId(fxyTwoUser.getUserId());
|
BigDecimal fxyOneMoney = fxyMoney.multiply(fxyRate).divide(new BigDecimal(100)).setScale(2,BigDecimal.ROUND_HALF_UP);
|
||||||
orders.setFxyTwoUserName(fxyTwoUser.getUserName());
|
orders.setFxyOneMoney(fxyOneMoney);
|
||||||
BigDecimal twoRate = fc.getTwoRate();
|
BigDecimal fxyOneArtificerDeductMoney = fxyOneMoney.multiply(artificerRate).divide(new BigDecimal(100)).setScale(2,BigDecimal.ROUND_HALF_UP);
|
||||||
BigDecimal twoRecommendRate = fc.getTwoRecommendRate();
|
orders.setFxyOneArtificerDeductMoney(fxyOneArtificerDeductMoney);
|
||||||
fxyRate = BigDecimal.ZERO;
|
if(fxyOneUser.getBlFxyLevel().equals(1)){
|
||||||
if (twoRate == null || twoRate.compareTo(BigDecimal.ZERO) == 0) {
|
UserEntity fxyTwoUser = userService.queryByInvitationCode(fxyOneUser.getBlFxyCode());
|
||||||
fxyRate = twoRecommendRate;
|
if(fxyTwoUser!=null){
|
||||||
if (twoRecommendRate.compareTo(mostRate) > 0) {
|
FxyApply faTwo = fxyApplyService.findByUserId(fxyTwoUser.getUserId());
|
||||||
fxyRate = mostRate;
|
if(faTwo!=null && faTwo.getStatus().equals(1)){
|
||||||
|
if(fxyTwoUser.getBlIsFxy() !=null && fxyTwoUser.getBlIsFxy() ==1){
|
||||||
|
isCanFxyFy = false;
|
||||||
|
if(fc.getFxmLimit().equals(2)){
|
||||||
|
int fxmLimitDays = fc.getFxmLimitDays();
|
||||||
|
String approveTime = faTwo.getApproveTime();
|
||||||
|
Date approveDate = DateUtils.stringToDate(approveTime,DateUtils.DATE_TIME_PATTERN);
|
||||||
|
Calendar calendar = Calendar.getInstance();
|
||||||
|
calendar.setTime(approveDate);
|
||||||
|
calendar.add(Calendar.DAY_OF_MONTH, fxmLimitDays);
|
||||||
|
approveDate = calendar.getTime();
|
||||||
|
Date current = new Date();
|
||||||
|
if(approveDate.getTime() > current.getTime()){
|
||||||
|
isCanFxyFy = true;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
isCanFxyFy = true;
|
||||||
}
|
}
|
||||||
} else {
|
if(isCanFxyFy) {
|
||||||
fxyRate = twoRate;
|
orders.setFxyTwoUserId(fxyTwoUser.getUserId());
|
||||||
if (twoRate.compareTo(mostRate) > 0) {
|
orders.setFxyTwoUserName(fxyTwoUser.getUserName());
|
||||||
fxyRate = mostRate;
|
BigDecimal twoRate = fc.getTwoRate();
|
||||||
|
BigDecimal twoRecommendRate = fc.getTwoRecommendRate();
|
||||||
|
fxyRate = BigDecimal.ZERO;
|
||||||
|
if (twoRate == null || twoRate.compareTo(BigDecimal.ZERO) == 0) {
|
||||||
|
fxyRate = twoRecommendRate;
|
||||||
|
if (twoRecommendRate.compareTo(mostRate) > 0) {
|
||||||
|
fxyRate = mostRate;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
fxyRate = twoRate;
|
||||||
|
if (twoRate.compareTo(mostRate) > 0) {
|
||||||
|
fxyRate = mostRate;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
BigDecimal fxyTwoMoney = fxyMoney.multiply(fxyRate).divide(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||||
|
orders.setFxyTwoMoney(fxyTwoMoney);
|
||||||
|
BigDecimal fxyTwoArtificerDeductMoney = fxyTwoMoney.multiply(artificerRate).divide(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||||
|
orders.setFxyTwoArtificerDeductMoney(fxyTwoArtificerDeductMoney);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
BigDecimal fxyTwoMoney = fxyMoney.multiply(fxyRate).divide(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
||||||
orders.setFxyTwoMoney(fxyTwoMoney);
|
|
||||||
BigDecimal fxyTwoArtificerDeductMoney = fxyTwoMoney.multiply(artificerRate).divide(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
||||||
orders.setFxyTwoArtificerDeductMoney(fxyTwoArtificerDeductMoney);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else{
|
|
||||||
orders.setFxyTwoMoney(BigDecimal.ZERO);
|
|
||||||
orders.setFxyTwoArtificerDeductMoney(BigDecimal.ZERO);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else{
|
|
||||||
orders.setFxyOneMoney(BigDecimal.ZERO);
|
|
||||||
orders.setFxyOneArtificerDeductMoney(BigDecimal.ZERO);
|
|
||||||
orders.setFxyTwoMoney(BigDecimal.ZERO);
|
|
||||||
orders.setFxyTwoArtificerDeductMoney(BigDecimal.ZERO);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// artificerPrice = artificerPrice.subtract(oneArtificerMoney);
|
// artificerPrice = artificerPrice.subtract(oneArtificerMoney);
|
||||||
|
@ -2681,39 +2685,41 @@ public class WxServiceImpl implements WxService {
|
||||||
orders.setProjectBenefits(artificerPrice);
|
orders.setProjectBenefits(artificerPrice);
|
||||||
|
|
||||||
UserEntity user = userService.selectUserById(orders.getUserId());
|
UserEntity user = userService.selectUserById(orders.getUserId());
|
||||||
|
//经纪人分佣
|
||||||
|
orders.setJjrMoney(BigDecimal.ZERO);
|
||||||
|
orders.setJjrArtificerDeductMoney(BigDecimal.ZERO);
|
||||||
JjrConfig jc = jjrConfigService.getOne(new QueryWrapper<JjrConfig>());
|
JjrConfig jc = jjrConfigService.getOne(new QueryWrapper<JjrConfig>());
|
||||||
if(jc.getIsOpen().equals(1)){
|
if(jc!=null && jc.getIsOpen().equals(1)){
|
||||||
UserEntity jjrUser = userService.queryByInvitationCode(user.getBlJjrCode());
|
UserEntity jjrUser = userService.queryByInvitationCode(user.getBlJjrCode());
|
||||||
JjrApply jjrApply = jjrApplyService.findByUserId(jjrUser.getUserId());
|
if(jjrUser!=null){
|
||||||
if(jjrApply.getStatus().equals(1)){
|
JjrApply jjrApply = jjrApplyService.findByUserId(jjrUser.getUserId());
|
||||||
if(jjrUser!=null && jjrUser.getBlIsJjr() !=null && jjrUser.getBlIsJjr() ==1){
|
if(jjrApply!=null && jjrApply.getStatus().equals(1)){
|
||||||
orders.setJjrUserId(jjrUser.getUserId());
|
if(jjrUser.getBlIsJjr() !=null && jjrUser.getBlIsJjr() ==1){
|
||||||
orders.setJjrUserName(jjrUser.getUserName());
|
orders.setJjrUserId(jjrUser.getUserId());
|
||||||
BigDecimal artificerRate = jc.getArtificerRate();
|
orders.setJjrUserName(jjrUser.getUserName());
|
||||||
BigDecimal agentRate = jc.getAgentRate();
|
BigDecimal artificerRate = jc.getArtificerRate();
|
||||||
BigDecimal jjrRate = BigDecimal.ZERO;
|
BigDecimal agentRate = jc.getAgentRate();
|
||||||
if(jc.getType().equals(1)){
|
BigDecimal jjrRate = BigDecimal.ZERO;
|
||||||
jjrRate = jc.getRate();
|
if(jc.getType().equals(1)){
|
||||||
}else{
|
jjrRate = jc.getRate();
|
||||||
int invitationCn = jjrApplyService.getInvitationCn(user.getBlJjrCode());
|
}else{
|
||||||
List<JjrConfigLevel> list = jjrConfigServiceLevel.findList(null);
|
int invitationCn = jjrApplyService.getInvitationCn(user.getBlJjrCode());
|
||||||
for(int i=0;i<list.size();i++){
|
List<JjrConfigLevel> list = jjrConfigServiceLevel.findList(null);
|
||||||
JjrConfigLevel jjrcl = list.get(i);
|
for(int i=0;i<list.size();i++){
|
||||||
if(invitationCn>jjrcl.getMinNumber() && invitationCn<=jjrcl.getMaxNumber()){
|
JjrConfigLevel jjrcl = list.get(i);
|
||||||
jjrRate = jjrcl.getRate();
|
if(invitationCn>jjrcl.getMinNumber() && invitationCn<=jjrcl.getMaxNumber()){
|
||||||
break;
|
jjrRate = jjrcl.getRate();
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
BigDecimal jjrMoney = subtract.multiply(jjrRate).divide(new BigDecimal(100)).setScale(2,BigDecimal.ROUND_HALF_UP);
|
||||||
|
orders.setJjrMoney(jjrMoney);
|
||||||
|
BigDecimal jjrOneArtificerDeductMoney = jjrMoney.multiply(artificerRate).divide(new BigDecimal(100)).setScale(2,BigDecimal.ROUND_HALF_UP);
|
||||||
|
orders.setJjrArtificerDeductMoney(jjrOneArtificerDeductMoney);
|
||||||
}
|
}
|
||||||
BigDecimal jjrMoney = subtract.multiply(jjrRate).divide(new BigDecimal(100)).setScale(2,BigDecimal.ROUND_HALF_UP);
|
|
||||||
orders.setJjrMoney(jjrMoney);
|
|
||||||
BigDecimal jjrOneArtificerDeductMoney = jjrMoney.multiply(artificerRate).divide(new BigDecimal(100)).setScale(2,BigDecimal.ROUND_HALF_UP);
|
|
||||||
orders.setJjrArtificerDeductMoney(jjrOneArtificerDeductMoney);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else{
|
|
||||||
orders.setJjrMoney(BigDecimal.ZERO);
|
|
||||||
orders.setJjrArtificerDeductMoney(BigDecimal.ZERO);
|
|
||||||
}
|
}
|
||||||
UserEntity artificerUser = userService.selectUserById(artificer.getUserId());
|
UserEntity artificerUser = userService.selectUserById(artificer.getUserId());
|
||||||
BigDecimal shopMoney = BigDecimal.ZERO;
|
BigDecimal shopMoney = BigDecimal.ZERO;
|
||||||
|
@ -2743,115 +2749,115 @@ public class WxServiceImpl implements WxService {
|
||||||
// orders.setOneUserMoney(oneUserMoney);
|
// orders.setOneUserMoney(oneUserMoney);
|
||||||
|
|
||||||
//分销商分佣
|
//分销商分佣
|
||||||
|
orders.setFxyOneMoney(BigDecimal.ZERO);
|
||||||
|
orders.setFxyOneArtificerDeductMoney(BigDecimal.ZERO);
|
||||||
|
orders.setFxyTwoMoney(BigDecimal.ZERO);
|
||||||
|
orders.setFxyTwoArtificerDeductMoney(BigDecimal.ZERO);
|
||||||
FxyConfig fc = fxyConfigService.getOne(new QueryWrapper<FxyConfig>());
|
FxyConfig fc = fxyConfigService.getOne(new QueryWrapper<FxyConfig>());
|
||||||
if(fc.getIsOpen().equals(1)){
|
if(fc!=null && fc.getIsOpen().equals(1)){
|
||||||
UserEntity fxyOneUser = userService.queryByInvitationCode(user.getBlFxyCode());
|
UserEntity fxyOneUser = userService.queryByInvitationCode(user.getBlFxyCode());
|
||||||
FxyApply faOne = fxyApplyService.findByUserId(fxyOneUser.getUserId());
|
if(fxyOneUser!=null){
|
||||||
if(faOne.getStatus().equals(1)){
|
FxyApply faOne = fxyApplyService.findByUserId(fxyOneUser.getUserId());
|
||||||
if(fxyOneUser!=null && fxyOneUser.getBlIsFxy() !=null && fxyOneUser.getBlIsFxy() ==1){
|
if(faOne!=null && faOne.getStatus().equals(1)){
|
||||||
boolean isCanFxyFy = false;
|
if(fxyOneUser.getBlIsFxy() !=null && fxyOneUser.getBlIsFxy() ==1){
|
||||||
if(fc.getFxmLimit().equals(2)){
|
boolean isCanFxyFy = false;
|
||||||
int fxmLimitDays = fc.getFxmLimitDays();
|
if(fc.getFxmLimit().equals(2)){
|
||||||
String approveTime = faOne.getApproveTime();
|
int fxmLimitDays = fc.getFxmLimitDays();
|
||||||
Date approveDate = DateUtils.stringToDate(approveTime,DateUtils.DATE_TIME_PATTERN);
|
String approveTime = faOne.getApproveTime();
|
||||||
Calendar calendar = Calendar.getInstance();
|
Date approveDate = DateUtils.stringToDate(approveTime,DateUtils.DATE_TIME_PATTERN);
|
||||||
calendar.setTime(approveDate);
|
Calendar calendar = Calendar.getInstance();
|
||||||
calendar.add(Calendar.DAY_OF_MONTH, fxmLimitDays);
|
calendar.setTime(approveDate);
|
||||||
approveDate = calendar.getTime();
|
calendar.add(Calendar.DAY_OF_MONTH, fxmLimitDays);
|
||||||
Date current = new Date();
|
approveDate = calendar.getTime();
|
||||||
if(approveDate.getTime() > current.getTime()){
|
Date current = new Date();
|
||||||
isCanFxyFy = true;
|
if(approveDate.getTime() > current.getTime()){
|
||||||
}
|
isCanFxyFy = true;
|
||||||
}else{
|
|
||||||
isCanFxyFy = true;
|
|
||||||
}
|
|
||||||
if(isCanFxyFy){
|
|
||||||
orders.setFxyOneUserId(fxyOneUser.getUserId());
|
|
||||||
orders.setFxyOneUserName(fxyOneUser.getUserName());
|
|
||||||
BigDecimal fxyMoney = BigDecimal.ZERO;
|
|
||||||
if(fc.getType().equals(1)){
|
|
||||||
fxyMoney = artificerPrice;
|
|
||||||
}
|
|
||||||
if(fc.getType().equals(2)){
|
|
||||||
fxyMoney = subtract;
|
|
||||||
}
|
|
||||||
BigDecimal artificerRate = fc.getArtificerRate();
|
|
||||||
BigDecimal mostRate = fc.getMostRate();
|
|
||||||
BigDecimal oneRate = fc.getOneRate();
|
|
||||||
BigDecimal oneRecommendRate = fc.getOneRecommendRate();
|
|
||||||
BigDecimal fxyRate = BigDecimal.ZERO;
|
|
||||||
if(oneRate == null || oneRate.compareTo(BigDecimal.ZERO) == 0){
|
|
||||||
fxyRate = oneRecommendRate;
|
|
||||||
if(oneRecommendRate.compareTo(mostRate)> 0){
|
|
||||||
fxyRate = mostRate;
|
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
fxyRate = oneRate;
|
isCanFxyFy = true;
|
||||||
if(oneRate.compareTo(mostRate)> 0){
|
|
||||||
fxyRate = mostRate;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
BigDecimal fxyOneMoney = fxyMoney.multiply(fxyRate).divide(new BigDecimal(100)).setScale(2,BigDecimal.ROUND_HALF_UP);
|
if(isCanFxyFy){
|
||||||
orders.setFxyOneMoney(fxyOneMoney);
|
orders.setFxyOneUserId(fxyOneUser.getUserId());
|
||||||
BigDecimal fxyOneArtificerDeductMoney = fxyOneMoney.multiply(artificerRate).divide(new BigDecimal(100)).setScale(2,BigDecimal.ROUND_HALF_UP);
|
orders.setFxyOneUserName(fxyOneUser.getUserName());
|
||||||
orders.setFxyOneArtificerDeductMoney(fxyOneArtificerDeductMoney);
|
BigDecimal fxyMoney = BigDecimal.ZERO;
|
||||||
if(fxyOneUser.getBlFxyLevel().equals(1)){
|
if(fc.getType().equals(1)){
|
||||||
UserEntity fxyTwoUser = userService.queryByInvitationCode(fxyOneUser.getBlFxyCode());
|
fxyMoney = artificerPrice;
|
||||||
FxyApply faTwo = fxyApplyService.findByUserId(fxyTwoUser.getUserId());
|
}
|
||||||
if(faTwo.getStatus().equals(1)){
|
if(fc.getType().equals(2)){
|
||||||
if(fxyTwoUser!=null && fxyTwoUser.getBlIsFxy() !=null && fxyTwoUser.getBlIsFxy() ==1){
|
fxyMoney = subtract;
|
||||||
isCanFxyFy = false;
|
}
|
||||||
if(fc.getFxmLimit().equals(2)){
|
BigDecimal artificerRate = fc.getArtificerRate();
|
||||||
int fxmLimitDays = fc.getFxmLimitDays();
|
BigDecimal mostRate = fc.getMostRate();
|
||||||
String approveTime = faTwo.getApproveTime();
|
BigDecimal oneRate = fc.getOneRate();
|
||||||
Date approveDate = DateUtils.stringToDate(approveTime,DateUtils.DATE_TIME_PATTERN);
|
BigDecimal oneRecommendRate = fc.getOneRecommendRate();
|
||||||
Calendar calendar = Calendar.getInstance();
|
BigDecimal fxyRate = BigDecimal.ZERO;
|
||||||
calendar.setTime(approveDate);
|
if(oneRate == null || oneRate.compareTo(BigDecimal.ZERO) == 0){
|
||||||
calendar.add(Calendar.DAY_OF_MONTH, fxmLimitDays);
|
fxyRate = oneRecommendRate;
|
||||||
approveDate = calendar.getTime();
|
if(oneRecommendRate.compareTo(mostRate)> 0){
|
||||||
Date current = new Date();
|
fxyRate = mostRate;
|
||||||
if(approveDate.getTime() > current.getTime()){
|
}
|
||||||
isCanFxyFy = true;
|
}else{
|
||||||
}
|
fxyRate = oneRate;
|
||||||
}else{
|
if(oneRate.compareTo(mostRate)> 0){
|
||||||
isCanFxyFy = true;
|
fxyRate = mostRate;
|
||||||
}
|
}
|
||||||
if(isCanFxyFy) {
|
}
|
||||||
orders.setFxyTwoUserId(fxyTwoUser.getUserId());
|
BigDecimal fxyOneMoney = fxyMoney.multiply(fxyRate).divide(new BigDecimal(100)).setScale(2,BigDecimal.ROUND_HALF_UP);
|
||||||
orders.setFxyTwoUserName(fxyTwoUser.getUserName());
|
orders.setFxyOneMoney(fxyOneMoney);
|
||||||
BigDecimal twoRate = fc.getTwoRate();
|
BigDecimal fxyOneArtificerDeductMoney = fxyOneMoney.multiply(artificerRate).divide(new BigDecimal(100)).setScale(2,BigDecimal.ROUND_HALF_UP);
|
||||||
BigDecimal twoRecommendRate = fc.getTwoRecommendRate();
|
orders.setFxyOneArtificerDeductMoney(fxyOneArtificerDeductMoney);
|
||||||
fxyRate = BigDecimal.ZERO;
|
if(fxyOneUser.getBlFxyLevel().equals(1)){
|
||||||
if (twoRate == null || twoRate.compareTo(BigDecimal.ZERO) == 0) {
|
UserEntity fxyTwoUser = userService.queryByInvitationCode(fxyOneUser.getBlFxyCode());
|
||||||
fxyRate = twoRecommendRate;
|
if(fxyTwoUser!=null){
|
||||||
if (twoRecommendRate.compareTo(mostRate) > 0) {
|
FxyApply faTwo = fxyApplyService.findByUserId(fxyTwoUser.getUserId());
|
||||||
fxyRate = mostRate;
|
if(faTwo!=null && faTwo.getStatus().equals(1)){
|
||||||
|
if(fxyTwoUser.getBlIsFxy() !=null && fxyTwoUser.getBlIsFxy() ==1){
|
||||||
|
isCanFxyFy = false;
|
||||||
|
if(fc.getFxmLimit().equals(2)){
|
||||||
|
int fxmLimitDays = fc.getFxmLimitDays();
|
||||||
|
String approveTime = faTwo.getApproveTime();
|
||||||
|
Date approveDate = DateUtils.stringToDate(approveTime,DateUtils.DATE_TIME_PATTERN);
|
||||||
|
Calendar calendar = Calendar.getInstance();
|
||||||
|
calendar.setTime(approveDate);
|
||||||
|
calendar.add(Calendar.DAY_OF_MONTH, fxmLimitDays);
|
||||||
|
approveDate = calendar.getTime();
|
||||||
|
Date current = new Date();
|
||||||
|
if(approveDate.getTime() > current.getTime()){
|
||||||
|
isCanFxyFy = true;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
isCanFxyFy = true;
|
||||||
}
|
}
|
||||||
} else {
|
if(isCanFxyFy) {
|
||||||
fxyRate = twoRate;
|
orders.setFxyTwoUserId(fxyTwoUser.getUserId());
|
||||||
if (twoRate.compareTo(mostRate) > 0) {
|
orders.setFxyTwoUserName(fxyTwoUser.getUserName());
|
||||||
fxyRate = mostRate;
|
BigDecimal twoRate = fc.getTwoRate();
|
||||||
|
BigDecimal twoRecommendRate = fc.getTwoRecommendRate();
|
||||||
|
fxyRate = BigDecimal.ZERO;
|
||||||
|
if (twoRate == null || twoRate.compareTo(BigDecimal.ZERO) == 0) {
|
||||||
|
fxyRate = twoRecommendRate;
|
||||||
|
if (twoRecommendRate.compareTo(mostRate) > 0) {
|
||||||
|
fxyRate = mostRate;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
fxyRate = twoRate;
|
||||||
|
if (twoRate.compareTo(mostRate) > 0) {
|
||||||
|
fxyRate = mostRate;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
BigDecimal fxyTwoMoney = fxyMoney.multiply(fxyRate).divide(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||||
|
orders.setFxyTwoMoney(fxyTwoMoney);
|
||||||
|
BigDecimal fxyTwoArtificerDeductMoney = fxyTwoMoney.multiply(artificerRate).divide(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||||
|
orders.setFxyTwoArtificerDeductMoney(fxyTwoArtificerDeductMoney);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
BigDecimal fxyTwoMoney = fxyMoney.multiply(fxyRate).divide(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
||||||
orders.setFxyTwoMoney(fxyTwoMoney);
|
|
||||||
BigDecimal fxyTwoArtificerDeductMoney = fxyTwoMoney.multiply(artificerRate).divide(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
||||||
orders.setFxyTwoArtificerDeductMoney(fxyTwoArtificerDeductMoney);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else{
|
|
||||||
orders.setFxyTwoMoney(BigDecimal.ZERO);
|
|
||||||
orders.setFxyTwoArtificerDeductMoney(BigDecimal.ZERO);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else{
|
|
||||||
orders.setFxyOneMoney(BigDecimal.ZERO);
|
|
||||||
orders.setFxyOneArtificerDeductMoney(BigDecimal.ZERO);
|
|
||||||
orders.setFxyTwoMoney(BigDecimal.ZERO);
|
|
||||||
orders.setFxyTwoArtificerDeductMoney(BigDecimal.ZERO);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// artificerPrice = artificerPrice.subtract(oneArtificerMoney);
|
// artificerPrice = artificerPrice.subtract(oneArtificerMoney);
|
||||||
|
|
Loading…
Reference in New Issue