分销员
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);
|
||||
|
||||
UserEntity user = userService.selectUserById(orders.getUserId());
|
||||
//经纪人分佣
|
||||
orders.setJjrMoney(BigDecimal.ZERO);
|
||||
orders.setJjrArtificerDeductMoney(BigDecimal.ZERO);
|
||||
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());
|
||||
JjrApply jjrApply = jjrApplyService.findByUserId(jjrUser.getUserId());
|
||||
if(jjrApply.getStatus().equals(1)){
|
||||
if(jjrUser!=null && jjrUser.getBlIsJjr() !=null && jjrUser.getBlIsJjr() ==1){
|
||||
orders.setJjrUserId(jjrUser.getUserId());
|
||||
orders.setJjrUserName(jjrUser.getUserName());
|
||||
BigDecimal artificerRate = jc.getArtificerRate();
|
||||
BigDecimal agentRate = jc.getAgentRate();
|
||||
BigDecimal jjrRate = BigDecimal.ZERO;
|
||||
if(jc.getType().equals(1)){
|
||||
jjrRate = jc.getRate();
|
||||
}else{
|
||||
int invitationCn = jjrApplyService.getInvitationCn(user.getBlJjrCode());
|
||||
List<JjrConfigLevel> list = jjrConfigServiceLevel.findList(null);
|
||||
for(int i=0;i<list.size();i++){
|
||||
JjrConfigLevel jjrcl = list.get(i);
|
||||
if(invitationCn>jjrcl.getMinNumber() && invitationCn<=jjrcl.getMaxNumber()){
|
||||
jjrRate = jjrcl.getRate();
|
||||
break;
|
||||
if(jjrUser!=null){
|
||||
JjrApply jjrApply = jjrApplyService.findByUserId(jjrUser.getUserId());
|
||||
if(jjrApply!=null && jjrApply.getStatus().equals(1)){
|
||||
if(jjrUser.getBlIsJjr() !=null && jjrUser.getBlIsJjr() ==1){
|
||||
orders.setJjrUserId(jjrUser.getUserId());
|
||||
orders.setJjrUserName(jjrUser.getUserName());
|
||||
BigDecimal artificerRate = jc.getArtificerRate();
|
||||
BigDecimal agentRate = jc.getAgentRate();
|
||||
BigDecimal jjrRate = BigDecimal.ZERO;
|
||||
if(jc.getType().equals(1)){
|
||||
jjrRate = jc.getRate();
|
||||
}else{
|
||||
int invitationCn = jjrApplyService.getInvitationCn(user.getBlJjrCode());
|
||||
List<JjrConfigLevel> list = jjrConfigServiceLevel.findList(null);
|
||||
for(int i=0;i<list.size();i++){
|
||||
JjrConfigLevel jjrcl = list.get(i);
|
||||
if(invitationCn>jjrcl.getMinNumber() && invitationCn<=jjrcl.getMaxNumber()){
|
||||
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());
|
||||
BigDecimal shopMoney = BigDecimal.ZERO;
|
||||
|
@ -716,115 +718,115 @@ public class AliPayController {
|
|||
// 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>());
|
||||
if(fc.getIsOpen().equals(1)){
|
||||
if(fc!=null && fc.getIsOpen().equals(1)){
|
||||
UserEntity fxyOneUser = userService.queryByInvitationCode(user.getBlFxyCode());
|
||||
FxyApply faOne = fxyApplyService.findByUserId(fxyOneUser.getUserId());
|
||||
if(faOne.getStatus().equals(1)){
|
||||
if(fxyOneUser!=null && fxyOneUser.getBlIsFxy() !=null && fxyOneUser.getBlIsFxy() ==1){
|
||||
boolean isCanFxyFy = false;
|
||||
if(fc.getFxmLimit().equals(2)){
|
||||
int fxmLimitDays = fc.getFxmLimitDays();
|
||||
String approveTime = faOne.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;
|
||||
}
|
||||
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;
|
||||
if(fxyOneUser!=null){
|
||||
FxyApply faOne = fxyApplyService.findByUserId(fxyOneUser.getUserId());
|
||||
if(faOne!=null && faOne.getStatus().equals(1)){
|
||||
if(fxyOneUser.getBlIsFxy() !=null && fxyOneUser.getBlIsFxy() ==1){
|
||||
boolean isCanFxyFy = false;
|
||||
if(fc.getFxmLimit().equals(2)){
|
||||
int fxmLimitDays = fc.getFxmLimitDays();
|
||||
String approveTime = faOne.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{
|
||||
fxyRate = oneRate;
|
||||
if(oneRate.compareTo(mostRate)> 0){
|
||||
fxyRate = mostRate;
|
||||
}
|
||||
isCanFxyFy = true;
|
||||
}
|
||||
BigDecimal fxyOneMoney = fxyMoney.multiply(fxyRate).divide(new BigDecimal(100)).setScale(2,BigDecimal.ROUND_HALF_UP);
|
||||
orders.setFxyOneMoney(fxyOneMoney);
|
||||
BigDecimal fxyOneArtificerDeductMoney = fxyOneMoney.multiply(artificerRate).divide(new BigDecimal(100)).setScale(2,BigDecimal.ROUND_HALF_UP);
|
||||
orders.setFxyOneArtificerDeductMoney(fxyOneArtificerDeductMoney);
|
||||
if(fxyOneUser.getBlFxyLevel().equals(1)){
|
||||
UserEntity fxyTwoUser = userService.queryByInvitationCode(fxyOneUser.getBlFxyCode());
|
||||
FxyApply faTwo = fxyApplyService.findByUserId(fxyTwoUser.getUserId());
|
||||
if(faTwo.getStatus().equals(1)){
|
||||
if(fxyTwoUser!=null && 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;
|
||||
}
|
||||
if(isCanFxyFy) {
|
||||
orders.setFxyTwoUserId(fxyTwoUser.getUserId());
|
||||
orders.setFxyTwoUserName(fxyTwoUser.getUserName());
|
||||
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;
|
||||
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{
|
||||
fxyRate = oneRate;
|
||||
if(oneRate.compareTo(mostRate)> 0){
|
||||
fxyRate = mostRate;
|
||||
}
|
||||
}
|
||||
BigDecimal fxyOneMoney = fxyMoney.multiply(fxyRate).divide(new BigDecimal(100)).setScale(2,BigDecimal.ROUND_HALF_UP);
|
||||
orders.setFxyOneMoney(fxyOneMoney);
|
||||
BigDecimal fxyOneArtificerDeductMoney = fxyOneMoney.multiply(artificerRate).divide(new BigDecimal(100)).setScale(2,BigDecimal.ROUND_HALF_UP);
|
||||
orders.setFxyOneArtificerDeductMoney(fxyOneArtificerDeductMoney);
|
||||
if(fxyOneUser.getBlFxyLevel().equals(1)){
|
||||
UserEntity fxyTwoUser = userService.queryByInvitationCode(fxyOneUser.getBlFxyCode());
|
||||
if(fxyTwoUser!=null){
|
||||
FxyApply faTwo = fxyApplyService.findByUserId(fxyTwoUser.getUserId());
|
||||
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 {
|
||||
fxyRate = twoRate;
|
||||
if (twoRate.compareTo(mostRate) > 0) {
|
||||
fxyRate = mostRate;
|
||||
if(isCanFxyFy) {
|
||||
orders.setFxyTwoUserId(fxyTwoUser.getUserId());
|
||||
orders.setFxyTwoUserName(fxyTwoUser.getUserName());
|
||||
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);
|
||||
|
@ -1759,39 +1761,41 @@ public class AliPayController {
|
|||
// orders.setOneArtificerMoney(oneArtificerMoney);
|
||||
|
||||
UserEntity user = userService.selectUserById(orders.getUserId());
|
||||
//经纪人分佣
|
||||
orders.setJjrMoney(BigDecimal.ZERO);
|
||||
orders.setJjrArtificerDeductMoney(BigDecimal.ZERO);
|
||||
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());
|
||||
JjrApply jjrApply = jjrApplyService.findByUserId(jjrUser.getUserId());
|
||||
if(jjrApply.getStatus().equals(1)){
|
||||
if(jjrUser!=null && jjrUser.getBlIsJjr() !=null && jjrUser.getBlIsJjr() ==1){
|
||||
orders.setJjrUserId(jjrUser.getUserId());
|
||||
orders.setJjrUserName(jjrUser.getUserName());
|
||||
BigDecimal artificerRate = jc.getArtificerRate();
|
||||
BigDecimal agentRate = jc.getAgentRate();
|
||||
BigDecimal jjrRate = BigDecimal.ZERO;
|
||||
if(jc.getType().equals(1)){
|
||||
jjrRate = jc.getRate();
|
||||
}else{
|
||||
int invitationCn = jjrApplyService.getInvitationCn(user.getBlJjrCode());
|
||||
List<JjrConfigLevel> list = jjrConfigServiceLevel.findList(null);
|
||||
for(int i=0;i<list.size();i++){
|
||||
JjrConfigLevel jjrcl = list.get(i);
|
||||
if(invitationCn>jjrcl.getMinNumber() && invitationCn<=jjrcl.getMaxNumber()){
|
||||
jjrRate = jjrcl.getRate();
|
||||
break;
|
||||
if(jjrUser!=null){
|
||||
JjrApply jjrApply = jjrApplyService.findByUserId(jjrUser.getUserId());
|
||||
if(jjrApply!=null && jjrApply.getStatus().equals(1)){
|
||||
if(jjrUser.getBlIsJjr() !=null && jjrUser.getBlIsJjr() ==1){
|
||||
orders.setJjrUserId(jjrUser.getUserId());
|
||||
orders.setJjrUserName(jjrUser.getUserName());
|
||||
BigDecimal artificerRate = jc.getArtificerRate();
|
||||
BigDecimal agentRate = jc.getAgentRate();
|
||||
BigDecimal jjrRate = BigDecimal.ZERO;
|
||||
if(jc.getType().equals(1)){
|
||||
jjrRate = jc.getRate();
|
||||
}else{
|
||||
int invitationCn = jjrApplyService.getInvitationCn(user.getBlJjrCode());
|
||||
List<JjrConfigLevel> list = jjrConfigServiceLevel.findList(null);
|
||||
for(int i=0;i<list.size();i++){
|
||||
JjrConfigLevel jjrcl = list.get(i);
|
||||
if(invitationCn>jjrcl.getMinNumber() && invitationCn<=jjrcl.getMaxNumber()){
|
||||
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());
|
||||
BigDecimal shopMoney = BigDecimal.ZERO;
|
||||
|
@ -1821,115 +1825,115 @@ public class AliPayController {
|
|||
// 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>());
|
||||
if(fc.getIsOpen().equals(1)){
|
||||
if(fc!=null && fc.getIsOpen().equals(1)){
|
||||
UserEntity fxyOneUser = userService.queryByInvitationCode(user.getBlFxyCode());
|
||||
FxyApply faOne = fxyApplyService.findByUserId(fxyOneUser.getUserId());
|
||||
if(faOne.getStatus().equals(1)){
|
||||
if(fxyOneUser!=null && fxyOneUser.getBlIsFxy() !=null && fxyOneUser.getBlIsFxy() ==1){
|
||||
boolean isCanFxyFy = false;
|
||||
if(fc.getFxmLimit().equals(2)){
|
||||
int fxmLimitDays = fc.getFxmLimitDays();
|
||||
String approveTime = faOne.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;
|
||||
}
|
||||
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;
|
||||
if(fxyOneUser!=null){
|
||||
FxyApply faOne = fxyApplyService.findByUserId(fxyOneUser.getUserId());
|
||||
if(faOne!=null && faOne.getStatus().equals(1)){
|
||||
if(fxyOneUser.getBlIsFxy() !=null && fxyOneUser.getBlIsFxy() ==1){
|
||||
boolean isCanFxyFy = false;
|
||||
if(fc.getFxmLimit().equals(2)){
|
||||
int fxmLimitDays = fc.getFxmLimitDays();
|
||||
String approveTime = faOne.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{
|
||||
fxyRate = oneRate;
|
||||
if(oneRate.compareTo(mostRate)> 0){
|
||||
fxyRate = mostRate;
|
||||
}
|
||||
isCanFxyFy = true;
|
||||
}
|
||||
BigDecimal fxyOneMoney = fxyMoney.multiply(fxyRate).divide(new BigDecimal(100)).setScale(2,BigDecimal.ROUND_HALF_UP);
|
||||
orders.setFxyOneMoney(fxyOneMoney);
|
||||
BigDecimal fxyOneArtificerDeductMoney = fxyOneMoney.multiply(artificerRate).divide(new BigDecimal(100)).setScale(2,BigDecimal.ROUND_HALF_UP);
|
||||
orders.setFxyOneArtificerDeductMoney(fxyOneArtificerDeductMoney);
|
||||
if(fxyOneUser.getBlFxyLevel().equals(1)){
|
||||
UserEntity fxyTwoUser = userService.queryByInvitationCode(fxyOneUser.getBlFxyCode());
|
||||
FxyApply faTwo = fxyApplyService.findByUserId(fxyTwoUser.getUserId());
|
||||
if(faTwo.getStatus().equals(1)){
|
||||
if(fxyTwoUser!=null && 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;
|
||||
}
|
||||
if(isCanFxyFy) {
|
||||
orders.setFxyTwoUserId(fxyTwoUser.getUserId());
|
||||
orders.setFxyTwoUserName(fxyTwoUser.getUserName());
|
||||
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;
|
||||
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{
|
||||
fxyRate = oneRate;
|
||||
if(oneRate.compareTo(mostRate)> 0){
|
||||
fxyRate = mostRate;
|
||||
}
|
||||
}
|
||||
BigDecimal fxyOneMoney = fxyMoney.multiply(fxyRate).divide(new BigDecimal(100)).setScale(2,BigDecimal.ROUND_HALF_UP);
|
||||
orders.setFxyOneMoney(fxyOneMoney);
|
||||
BigDecimal fxyOneArtificerDeductMoney = fxyOneMoney.multiply(artificerRate).divide(new BigDecimal(100)).setScale(2,BigDecimal.ROUND_HALF_UP);
|
||||
orders.setFxyOneArtificerDeductMoney(fxyOneArtificerDeductMoney);
|
||||
if(fxyOneUser.getBlFxyLevel().equals(1)){
|
||||
UserEntity fxyTwoUser = userService.queryByInvitationCode(fxyOneUser.getBlFxyCode());
|
||||
if(fxyTwoUser!=null){
|
||||
FxyApply faTwo = fxyApplyService.findByUserId(fxyTwoUser.getUserId());
|
||||
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 {
|
||||
fxyRate = twoRate;
|
||||
if (twoRate.compareTo(mostRate) > 0) {
|
||||
fxyRate = mostRate;
|
||||
if(isCanFxyFy) {
|
||||
orders.setFxyTwoUserId(fxyTwoUser.getUserId());
|
||||
orders.setFxyTwoUserName(fxyTwoUser.getUserName());
|
||||
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);
|
||||
|
@ -2351,39 +2355,41 @@ public class AliPayController {
|
|||
// orders.setOneArtificerMoney(oneArtificerMoney);
|
||||
|
||||
UserEntity user = userService.selectUserById(orders.getUserId());
|
||||
//经纪人分佣
|
||||
orders.setJjrMoney(BigDecimal.ZERO);
|
||||
orders.setJjrArtificerDeductMoney(BigDecimal.ZERO);
|
||||
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());
|
||||
JjrApply jjrApply = jjrApplyService.findByUserId(jjrUser.getUserId());
|
||||
if(jjrApply.getStatus().equals(1)){
|
||||
if(jjrUser!=null && jjrUser.getBlIsJjr() !=null && jjrUser.getBlIsJjr() ==1){
|
||||
orders.setJjrUserId(jjrUser.getUserId());
|
||||
orders.setJjrUserName(jjrUser.getUserName());
|
||||
BigDecimal artificerRate = jc.getArtificerRate();
|
||||
BigDecimal agentRate = jc.getAgentRate();
|
||||
BigDecimal jjrRate = BigDecimal.ZERO;
|
||||
if(jc.getType().equals(1)){
|
||||
jjrRate = jc.getRate();
|
||||
}else{
|
||||
int invitationCn = jjrApplyService.getInvitationCn(user.getBlJjrCode());
|
||||
List<JjrConfigLevel> list = jjrConfigServiceLevel.findList(null);
|
||||
for(int i=0;i<list.size();i++){
|
||||
JjrConfigLevel jjrcl = list.get(i);
|
||||
if(invitationCn>jjrcl.getMinNumber() && invitationCn<=jjrcl.getMaxNumber()){
|
||||
jjrRate = jjrcl.getRate();
|
||||
break;
|
||||
if(jjrUser!=null){
|
||||
JjrApply jjrApply = jjrApplyService.findByUserId(jjrUser.getUserId());
|
||||
if(jjrApply!=null && jjrApply.getStatus().equals(1)){
|
||||
if(jjrUser.getBlIsJjr() !=null && jjrUser.getBlIsJjr() ==1){
|
||||
orders.setJjrUserId(jjrUser.getUserId());
|
||||
orders.setJjrUserName(jjrUser.getUserName());
|
||||
BigDecimal artificerRate = jc.getArtificerRate();
|
||||
BigDecimal agentRate = jc.getAgentRate();
|
||||
BigDecimal jjrRate = BigDecimal.ZERO;
|
||||
if(jc.getType().equals(1)){
|
||||
jjrRate = jc.getRate();
|
||||
}else{
|
||||
int invitationCn = jjrApplyService.getInvitationCn(user.getBlJjrCode());
|
||||
List<JjrConfigLevel> list = jjrConfigServiceLevel.findList(null);
|
||||
for(int i=0;i<list.size();i++){
|
||||
JjrConfigLevel jjrcl = list.get(i);
|
||||
if(invitationCn>jjrcl.getMinNumber() && invitationCn<=jjrcl.getMaxNumber()){
|
||||
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());
|
||||
BigDecimal shopMoney = BigDecimal.ZERO;
|
||||
|
@ -2413,115 +2419,115 @@ public class AliPayController {
|
|||
// 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>());
|
||||
if(fc.getIsOpen().equals(1)){
|
||||
if(fc!=null && fc.getIsOpen().equals(1)){
|
||||
UserEntity fxyOneUser = userService.queryByInvitationCode(user.getBlFxyCode());
|
||||
FxyApply faOne = fxyApplyService.findByUserId(fxyOneUser.getUserId());
|
||||
if(faOne.getStatus().equals(1)){
|
||||
if(fxyOneUser!=null && fxyOneUser.getBlIsFxy() !=null && fxyOneUser.getBlIsFxy() ==1){
|
||||
boolean isCanFxyFy = false;
|
||||
if(fc.getFxmLimit().equals(2)){
|
||||
int fxmLimitDays = fc.getFxmLimitDays();
|
||||
String approveTime = faOne.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;
|
||||
}
|
||||
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;
|
||||
if(fxyOneUser!=null){
|
||||
FxyApply faOne = fxyApplyService.findByUserId(fxyOneUser.getUserId());
|
||||
if(faOne!=null && faOne.getStatus().equals(1)){
|
||||
if(fxyOneUser.getBlIsFxy() !=null && fxyOneUser.getBlIsFxy() ==1){
|
||||
boolean isCanFxyFy = false;
|
||||
if(fc.getFxmLimit().equals(2)){
|
||||
int fxmLimitDays = fc.getFxmLimitDays();
|
||||
String approveTime = faOne.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{
|
||||
fxyRate = oneRate;
|
||||
if(oneRate.compareTo(mostRate)> 0){
|
||||
fxyRate = mostRate;
|
||||
}
|
||||
isCanFxyFy = true;
|
||||
}
|
||||
BigDecimal fxyOneMoney = fxyMoney.multiply(fxyRate).divide(new BigDecimal(100)).setScale(2,BigDecimal.ROUND_HALF_UP);
|
||||
orders.setFxyOneMoney(fxyOneMoney);
|
||||
BigDecimal fxyOneArtificerDeductMoney = fxyOneMoney.multiply(artificerRate).divide(new BigDecimal(100)).setScale(2,BigDecimal.ROUND_HALF_UP);
|
||||
orders.setFxyOneArtificerDeductMoney(fxyOneArtificerDeductMoney);
|
||||
if(fxyOneUser.getBlFxyLevel().equals(1)){
|
||||
UserEntity fxyTwoUser = userService.queryByInvitationCode(fxyOneUser.getBlFxyCode());
|
||||
FxyApply faTwo = fxyApplyService.findByUserId(fxyTwoUser.getUserId());
|
||||
if(faTwo.getStatus().equals(1)){
|
||||
if(fxyTwoUser!=null && 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;
|
||||
}
|
||||
if(isCanFxyFy) {
|
||||
orders.setFxyTwoUserId(fxyTwoUser.getUserId());
|
||||
orders.setFxyTwoUserName(fxyTwoUser.getUserName());
|
||||
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;
|
||||
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{
|
||||
fxyRate = oneRate;
|
||||
if(oneRate.compareTo(mostRate)> 0){
|
||||
fxyRate = mostRate;
|
||||
}
|
||||
}
|
||||
BigDecimal fxyOneMoney = fxyMoney.multiply(fxyRate).divide(new BigDecimal(100)).setScale(2,BigDecimal.ROUND_HALF_UP);
|
||||
orders.setFxyOneMoney(fxyOneMoney);
|
||||
BigDecimal fxyOneArtificerDeductMoney = fxyOneMoney.multiply(artificerRate).divide(new BigDecimal(100)).setScale(2,BigDecimal.ROUND_HALF_UP);
|
||||
orders.setFxyOneArtificerDeductMoney(fxyOneArtificerDeductMoney);
|
||||
if(fxyOneUser.getBlFxyLevel().equals(1)){
|
||||
UserEntity fxyTwoUser = userService.queryByInvitationCode(fxyOneUser.getBlFxyCode());
|
||||
if(fxyTwoUser!=null){
|
||||
FxyApply faTwo = fxyApplyService.findByUserId(fxyTwoUser.getUserId());
|
||||
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 {
|
||||
fxyRate = twoRate;
|
||||
if (twoRate.compareTo(mostRate) > 0) {
|
||||
fxyRate = mostRate;
|
||||
if(isCanFxyFy) {
|
||||
orders.setFxyTwoUserId(fxyTwoUser.getUserId());
|
||||
orders.setFxyTwoUserName(fxyTwoUser.getUserName());
|
||||
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);
|
||||
|
|
|
@ -898,39 +898,41 @@ public class WxServiceImpl implements WxService {
|
|||
orders.setProjectBenefits(artificerPrice);
|
||||
|
||||
UserEntity user = userService.selectUserById(orders.getUserId());
|
||||
//经纪人分佣
|
||||
orders.setJjrMoney(BigDecimal.ZERO);
|
||||
orders.setJjrArtificerDeductMoney(BigDecimal.ZERO);
|
||||
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());
|
||||
JjrApply jjrApply = jjrApplyService.findByUserId(jjrUser.getUserId());
|
||||
if(jjrApply.getStatus().equals(1)){
|
||||
if(jjrUser!=null && jjrUser.getBlIsJjr() !=null && jjrUser.getBlIsJjr() ==1){
|
||||
orders.setJjrUserId(jjrUser.getUserId());
|
||||
orders.setJjrUserName(jjrUser.getUserName());
|
||||
BigDecimal artificerRate = jc.getArtificerRate();
|
||||
BigDecimal agentRate = jc.getAgentRate();
|
||||
BigDecimal jjrRate = BigDecimal.ZERO;
|
||||
if(jc.getType().equals(1)){
|
||||
jjrRate = jc.getRate();
|
||||
}else{
|
||||
int invitationCn = jjrApplyService.getInvitationCn(user.getBlJjrCode());
|
||||
List<JjrConfigLevel> list = jjrConfigServiceLevel.findList(null);
|
||||
for(int i=0;i<list.size();i++){
|
||||
JjrConfigLevel jjrcl = list.get(i);
|
||||
if(invitationCn>jjrcl.getMinNumber() && invitationCn<=jjrcl.getMaxNumber()){
|
||||
jjrRate = jjrcl.getRate();
|
||||
break;
|
||||
if(jjrUser!=null){
|
||||
JjrApply jjrApply = jjrApplyService.findByUserId(jjrUser.getUserId());
|
||||
if(jjrApply!=null && jjrApply.getStatus().equals(1)){
|
||||
if(jjrUser!=null && jjrUser.getBlIsJjr() !=null && jjrUser.getBlIsJjr() ==1){
|
||||
orders.setJjrUserId(jjrUser.getUserId());
|
||||
orders.setJjrUserName(jjrUser.getUserName());
|
||||
BigDecimal artificerRate = jc.getArtificerRate();
|
||||
BigDecimal agentRate = jc.getAgentRate();
|
||||
BigDecimal jjrRate = BigDecimal.ZERO;
|
||||
if(jc.getType().equals(1)){
|
||||
jjrRate = jc.getRate();
|
||||
}else{
|
||||
int invitationCn = jjrApplyService.getInvitationCn(user.getBlJjrCode());
|
||||
List<JjrConfigLevel> list = jjrConfigServiceLevel.findList(null);
|
||||
for(int i=0;i<list.size();i++){
|
||||
JjrConfigLevel jjrcl = list.get(i);
|
||||
if(invitationCn>jjrcl.getMinNumber() && invitationCn<=jjrcl.getMaxNumber()){
|
||||
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());
|
||||
BigDecimal shopMoney = BigDecimal.ZERO;
|
||||
|
@ -960,115 +962,115 @@ public class WxServiceImpl implements WxService {
|
|||
// 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>());
|
||||
if(fc.getIsOpen().equals(1)){
|
||||
if(fc!=null && fc.getIsOpen().equals(1)){
|
||||
UserEntity fxyOneUser = userService.queryByInvitationCode(user.getBlFxyCode());
|
||||
FxyApply faOne = fxyApplyService.findByUserId(fxyOneUser.getUserId());
|
||||
if(faOne.getStatus().equals(1)){
|
||||
if(fxyOneUser!=null && fxyOneUser.getBlIsFxy() !=null && fxyOneUser.getBlIsFxy() ==1){
|
||||
boolean isCanFxyFy = false;
|
||||
if(fc.getFxmLimit().equals(2)){
|
||||
int fxmLimitDays = fc.getFxmLimitDays();
|
||||
String approveTime = faOne.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;
|
||||
}
|
||||
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;
|
||||
if(fxyOneUser!=null){
|
||||
FxyApply faOne = fxyApplyService.findByUserId(fxyOneUser.getUserId());
|
||||
if(faOne!=null && faOne.getStatus().equals(1)){
|
||||
if(fxyOneUser.getBlIsFxy() !=null && fxyOneUser.getBlIsFxy() ==1){
|
||||
boolean isCanFxyFy = false;
|
||||
if(fc.getFxmLimit().equals(2)){
|
||||
int fxmLimitDays = fc.getFxmLimitDays();
|
||||
String approveTime = faOne.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{
|
||||
fxyRate = oneRate;
|
||||
if(oneRate.compareTo(mostRate)> 0){
|
||||
fxyRate = mostRate;
|
||||
}
|
||||
isCanFxyFy = true;
|
||||
}
|
||||
BigDecimal fxyOneMoney = fxyMoney.multiply(fxyRate).divide(new BigDecimal(100)).setScale(2,BigDecimal.ROUND_HALF_UP);
|
||||
orders.setFxyOneMoney(fxyOneMoney);
|
||||
BigDecimal fxyOneArtificerDeductMoney = fxyOneMoney.multiply(artificerRate).divide(new BigDecimal(100)).setScale(2,BigDecimal.ROUND_HALF_UP);
|
||||
orders.setFxyOneArtificerDeductMoney(fxyOneArtificerDeductMoney);
|
||||
if(fxyOneUser.getBlFxyLevel().equals(1)){
|
||||
UserEntity fxyTwoUser = userService.queryByInvitationCode(fxyOneUser.getBlFxyCode());
|
||||
FxyApply faTwo = fxyApplyService.findByUserId(fxyTwoUser.getUserId());
|
||||
if(faTwo.getStatus().equals(1)){
|
||||
if(fxyTwoUser!=null && 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;
|
||||
}
|
||||
if(isCanFxyFy) {
|
||||
orders.setFxyTwoUserId(fxyTwoUser.getUserId());
|
||||
orders.setFxyTwoUserName(fxyTwoUser.getUserName());
|
||||
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;
|
||||
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{
|
||||
fxyRate = oneRate;
|
||||
if(oneRate.compareTo(mostRate)> 0){
|
||||
fxyRate = mostRate;
|
||||
}
|
||||
}
|
||||
BigDecimal fxyOneMoney = fxyMoney.multiply(fxyRate).divide(new BigDecimal(100)).setScale(2,BigDecimal.ROUND_HALF_UP);
|
||||
orders.setFxyOneMoney(fxyOneMoney);
|
||||
BigDecimal fxyOneArtificerDeductMoney = fxyOneMoney.multiply(artificerRate).divide(new BigDecimal(100)).setScale(2,BigDecimal.ROUND_HALF_UP);
|
||||
orders.setFxyOneArtificerDeductMoney(fxyOneArtificerDeductMoney);
|
||||
if(fxyOneUser.getBlFxyLevel().equals(1)){
|
||||
UserEntity fxyTwoUser = userService.queryByInvitationCode(fxyOneUser.getBlFxyCode());
|
||||
if(fxyTwoUser!=null){
|
||||
FxyApply faTwo = fxyApplyService.findByUserId(fxyTwoUser.getUserId());
|
||||
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 {
|
||||
fxyRate = twoRate;
|
||||
if (twoRate.compareTo(mostRate) > 0) {
|
||||
fxyRate = mostRate;
|
||||
if(isCanFxyFy) {
|
||||
orders.setFxyTwoUserId(fxyTwoUser.getUserId());
|
||||
orders.setFxyTwoUserName(fxyTwoUser.getUserName());
|
||||
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);
|
||||
|
@ -1680,39 +1682,41 @@ public class WxServiceImpl implements WxService {
|
|||
orders.setProjectBenefits(artificerPrice);
|
||||
|
||||
UserEntity user = userService.selectUserById(orders.getUserId());
|
||||
//经纪人分佣
|
||||
orders.setJjrMoney(BigDecimal.ZERO);
|
||||
orders.setJjrArtificerDeductMoney(BigDecimal.ZERO);
|
||||
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());
|
||||
JjrApply jjrApply = jjrApplyService.findByUserId(jjrUser.getUserId());
|
||||
if(jjrApply.getStatus().equals(1)){
|
||||
if(jjrUser!=null && jjrUser.getBlIsJjr() !=null && jjrUser.getBlIsJjr() ==1){
|
||||
orders.setJjrUserId(jjrUser.getUserId());
|
||||
orders.setJjrUserName(jjrUser.getUserName());
|
||||
BigDecimal artificerRate = jc.getArtificerRate();
|
||||
BigDecimal agentRate = jc.getAgentRate();
|
||||
BigDecimal jjrRate = BigDecimal.ZERO;
|
||||
if(jc.getType().equals(1)){
|
||||
jjrRate = jc.getRate();
|
||||
}else{
|
||||
int invitationCn = jjrApplyService.getInvitationCn(user.getBlJjrCode());
|
||||
List<JjrConfigLevel> list = jjrConfigServiceLevel.findList(null);
|
||||
for(int i=0;i<list.size();i++){
|
||||
JjrConfigLevel jjrcl = list.get(i);
|
||||
if(invitationCn>jjrcl.getMinNumber() && invitationCn<=jjrcl.getMaxNumber()){
|
||||
jjrRate = jjrcl.getRate();
|
||||
break;
|
||||
if(jjrUser!=null){
|
||||
JjrApply jjrApply = jjrApplyService.findByUserId(jjrUser.getUserId());
|
||||
if(jjrApply!=null && jjrApply.getStatus().equals(1)){
|
||||
if( jjrUser.getBlIsJjr() !=null && jjrUser.getBlIsJjr() ==1){
|
||||
orders.setJjrUserId(jjrUser.getUserId());
|
||||
orders.setJjrUserName(jjrUser.getUserName());
|
||||
BigDecimal artificerRate = jc.getArtificerRate();
|
||||
BigDecimal agentRate = jc.getAgentRate();
|
||||
BigDecimal jjrRate = BigDecimal.ZERO;
|
||||
if(jc.getType().equals(1)){
|
||||
jjrRate = jc.getRate();
|
||||
}else{
|
||||
int invitationCn = jjrApplyService.getInvitationCn(user.getBlJjrCode());
|
||||
List<JjrConfigLevel> list = jjrConfigServiceLevel.findList(null);
|
||||
for(int i=0;i<list.size();i++){
|
||||
JjrConfigLevel jjrcl = list.get(i);
|
||||
if(invitationCn>jjrcl.getMinNumber() && invitationCn<=jjrcl.getMaxNumber()){
|
||||
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());
|
||||
BigDecimal shopMoney = BigDecimal.ZERO;
|
||||
|
@ -1742,115 +1746,115 @@ public class WxServiceImpl implements WxService {
|
|||
// 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>());
|
||||
if(fc.getIsOpen().equals(1)){
|
||||
if(fc!=null && fc.getIsOpen().equals(1)){
|
||||
UserEntity fxyOneUser = userService.queryByInvitationCode(user.getBlFxyCode());
|
||||
FxyApply faOne = fxyApplyService.findByUserId(fxyOneUser.getUserId());
|
||||
if(faOne.getStatus().equals(1)){
|
||||
if(fxyOneUser!=null && fxyOneUser.getBlIsFxy() !=null && fxyOneUser.getBlIsFxy() ==1){
|
||||
boolean isCanFxyFy = false;
|
||||
if(fc.getFxmLimit().equals(2)){
|
||||
int fxmLimitDays = fc.getFxmLimitDays();
|
||||
String approveTime = faOne.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;
|
||||
}
|
||||
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;
|
||||
if(fxyOneUser!=null){
|
||||
FxyApply faOne = fxyApplyService.findByUserId(fxyOneUser.getUserId());
|
||||
if(faOne!=null && faOne.getStatus().equals(1)){
|
||||
if(fxyOneUser.getBlIsFxy() !=null && fxyOneUser.getBlIsFxy() ==1){
|
||||
boolean isCanFxyFy = false;
|
||||
if(fc.getFxmLimit().equals(2)){
|
||||
int fxmLimitDays = fc.getFxmLimitDays();
|
||||
String approveTime = faOne.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{
|
||||
fxyRate = oneRate;
|
||||
if(oneRate.compareTo(mostRate)> 0){
|
||||
fxyRate = mostRate;
|
||||
}
|
||||
isCanFxyFy = true;
|
||||
}
|
||||
BigDecimal fxyOneMoney = fxyMoney.multiply(fxyRate).divide(new BigDecimal(100)).setScale(2,BigDecimal.ROUND_HALF_UP);
|
||||
orders.setFxyOneMoney(fxyOneMoney);
|
||||
BigDecimal fxyOneArtificerDeductMoney = fxyOneMoney.multiply(artificerRate).divide(new BigDecimal(100)).setScale(2,BigDecimal.ROUND_HALF_UP);
|
||||
orders.setFxyOneArtificerDeductMoney(fxyOneArtificerDeductMoney);
|
||||
if(fxyOneUser.getBlFxyLevel().equals(1)){
|
||||
UserEntity fxyTwoUser = userService.queryByInvitationCode(fxyOneUser.getBlFxyCode());
|
||||
FxyApply faTwo = fxyApplyService.findByUserId(fxyTwoUser.getUserId());
|
||||
if(faTwo.getStatus().equals(1)){
|
||||
if(fxyTwoUser!=null && 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;
|
||||
}
|
||||
if(isCanFxyFy) {
|
||||
orders.setFxyTwoUserId(fxyTwoUser.getUserId());
|
||||
orders.setFxyTwoUserName(fxyTwoUser.getUserName());
|
||||
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;
|
||||
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{
|
||||
fxyRate = oneRate;
|
||||
if(oneRate.compareTo(mostRate)> 0){
|
||||
fxyRate = mostRate;
|
||||
}
|
||||
}
|
||||
BigDecimal fxyOneMoney = fxyMoney.multiply(fxyRate).divide(new BigDecimal(100)).setScale(2,BigDecimal.ROUND_HALF_UP);
|
||||
orders.setFxyOneMoney(fxyOneMoney);
|
||||
BigDecimal fxyOneArtificerDeductMoney = fxyOneMoney.multiply(artificerRate).divide(new BigDecimal(100)).setScale(2,BigDecimal.ROUND_HALF_UP);
|
||||
orders.setFxyOneArtificerDeductMoney(fxyOneArtificerDeductMoney);
|
||||
if(fxyOneUser.getBlFxyLevel().equals(1)){
|
||||
UserEntity fxyTwoUser = userService.queryByInvitationCode(fxyOneUser.getBlFxyCode());
|
||||
if(fxyTwoUser!=null){
|
||||
FxyApply faTwo = fxyApplyService.findByUserId(fxyTwoUser.getUserId());
|
||||
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 {
|
||||
fxyRate = twoRate;
|
||||
if (twoRate.compareTo(mostRate) > 0) {
|
||||
fxyRate = mostRate;
|
||||
if(isCanFxyFy) {
|
||||
orders.setFxyTwoUserId(fxyTwoUser.getUserId());
|
||||
orders.setFxyTwoUserName(fxyTwoUser.getUserName());
|
||||
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);
|
||||
|
@ -2681,39 +2685,41 @@ public class WxServiceImpl implements WxService {
|
|||
orders.setProjectBenefits(artificerPrice);
|
||||
|
||||
UserEntity user = userService.selectUserById(orders.getUserId());
|
||||
//经纪人分佣
|
||||
orders.setJjrMoney(BigDecimal.ZERO);
|
||||
orders.setJjrArtificerDeductMoney(BigDecimal.ZERO);
|
||||
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());
|
||||
JjrApply jjrApply = jjrApplyService.findByUserId(jjrUser.getUserId());
|
||||
if(jjrApply.getStatus().equals(1)){
|
||||
if(jjrUser!=null && jjrUser.getBlIsJjr() !=null && jjrUser.getBlIsJjr() ==1){
|
||||
orders.setJjrUserId(jjrUser.getUserId());
|
||||
orders.setJjrUserName(jjrUser.getUserName());
|
||||
BigDecimal artificerRate = jc.getArtificerRate();
|
||||
BigDecimal agentRate = jc.getAgentRate();
|
||||
BigDecimal jjrRate = BigDecimal.ZERO;
|
||||
if(jc.getType().equals(1)){
|
||||
jjrRate = jc.getRate();
|
||||
}else{
|
||||
int invitationCn = jjrApplyService.getInvitationCn(user.getBlJjrCode());
|
||||
List<JjrConfigLevel> list = jjrConfigServiceLevel.findList(null);
|
||||
for(int i=0;i<list.size();i++){
|
||||
JjrConfigLevel jjrcl = list.get(i);
|
||||
if(invitationCn>jjrcl.getMinNumber() && invitationCn<=jjrcl.getMaxNumber()){
|
||||
jjrRate = jjrcl.getRate();
|
||||
break;
|
||||
if(jjrUser!=null){
|
||||
JjrApply jjrApply = jjrApplyService.findByUserId(jjrUser.getUserId());
|
||||
if(jjrApply!=null && jjrApply.getStatus().equals(1)){
|
||||
if(jjrUser.getBlIsJjr() !=null && jjrUser.getBlIsJjr() ==1){
|
||||
orders.setJjrUserId(jjrUser.getUserId());
|
||||
orders.setJjrUserName(jjrUser.getUserName());
|
||||
BigDecimal artificerRate = jc.getArtificerRate();
|
||||
BigDecimal agentRate = jc.getAgentRate();
|
||||
BigDecimal jjrRate = BigDecimal.ZERO;
|
||||
if(jc.getType().equals(1)){
|
||||
jjrRate = jc.getRate();
|
||||
}else{
|
||||
int invitationCn = jjrApplyService.getInvitationCn(user.getBlJjrCode());
|
||||
List<JjrConfigLevel> list = jjrConfigServiceLevel.findList(null);
|
||||
for(int i=0;i<list.size();i++){
|
||||
JjrConfigLevel jjrcl = list.get(i);
|
||||
if(invitationCn>jjrcl.getMinNumber() && invitationCn<=jjrcl.getMaxNumber()){
|
||||
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());
|
||||
BigDecimal shopMoney = BigDecimal.ZERO;
|
||||
|
@ -2743,115 +2749,115 @@ public class WxServiceImpl implements WxService {
|
|||
// 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>());
|
||||
if(fc.getIsOpen().equals(1)){
|
||||
if(fc!=null && fc.getIsOpen().equals(1)){
|
||||
UserEntity fxyOneUser = userService.queryByInvitationCode(user.getBlFxyCode());
|
||||
FxyApply faOne = fxyApplyService.findByUserId(fxyOneUser.getUserId());
|
||||
if(faOne.getStatus().equals(1)){
|
||||
if(fxyOneUser!=null && fxyOneUser.getBlIsFxy() !=null && fxyOneUser.getBlIsFxy() ==1){
|
||||
boolean isCanFxyFy = false;
|
||||
if(fc.getFxmLimit().equals(2)){
|
||||
int fxmLimitDays = fc.getFxmLimitDays();
|
||||
String approveTime = faOne.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;
|
||||
}
|
||||
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;
|
||||
if(fxyOneUser!=null){
|
||||
FxyApply faOne = fxyApplyService.findByUserId(fxyOneUser.getUserId());
|
||||
if(faOne!=null && faOne.getStatus().equals(1)){
|
||||
if(fxyOneUser.getBlIsFxy() !=null && fxyOneUser.getBlIsFxy() ==1){
|
||||
boolean isCanFxyFy = false;
|
||||
if(fc.getFxmLimit().equals(2)){
|
||||
int fxmLimitDays = fc.getFxmLimitDays();
|
||||
String approveTime = faOne.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{
|
||||
fxyRate = oneRate;
|
||||
if(oneRate.compareTo(mostRate)> 0){
|
||||
fxyRate = mostRate;
|
||||
}
|
||||
isCanFxyFy = true;
|
||||
}
|
||||
BigDecimal fxyOneMoney = fxyMoney.multiply(fxyRate).divide(new BigDecimal(100)).setScale(2,BigDecimal.ROUND_HALF_UP);
|
||||
orders.setFxyOneMoney(fxyOneMoney);
|
||||
BigDecimal fxyOneArtificerDeductMoney = fxyOneMoney.multiply(artificerRate).divide(new BigDecimal(100)).setScale(2,BigDecimal.ROUND_HALF_UP);
|
||||
orders.setFxyOneArtificerDeductMoney(fxyOneArtificerDeductMoney);
|
||||
if(fxyOneUser.getBlFxyLevel().equals(1)){
|
||||
UserEntity fxyTwoUser = userService.queryByInvitationCode(fxyOneUser.getBlFxyCode());
|
||||
FxyApply faTwo = fxyApplyService.findByUserId(fxyTwoUser.getUserId());
|
||||
if(faTwo.getStatus().equals(1)){
|
||||
if(fxyTwoUser!=null && 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;
|
||||
}
|
||||
if(isCanFxyFy) {
|
||||
orders.setFxyTwoUserId(fxyTwoUser.getUserId());
|
||||
orders.setFxyTwoUserName(fxyTwoUser.getUserName());
|
||||
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;
|
||||
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{
|
||||
fxyRate = oneRate;
|
||||
if(oneRate.compareTo(mostRate)> 0){
|
||||
fxyRate = mostRate;
|
||||
}
|
||||
}
|
||||
BigDecimal fxyOneMoney = fxyMoney.multiply(fxyRate).divide(new BigDecimal(100)).setScale(2,BigDecimal.ROUND_HALF_UP);
|
||||
orders.setFxyOneMoney(fxyOneMoney);
|
||||
BigDecimal fxyOneArtificerDeductMoney = fxyOneMoney.multiply(artificerRate).divide(new BigDecimal(100)).setScale(2,BigDecimal.ROUND_HALF_UP);
|
||||
orders.setFxyOneArtificerDeductMoney(fxyOneArtificerDeductMoney);
|
||||
if(fxyOneUser.getBlFxyLevel().equals(1)){
|
||||
UserEntity fxyTwoUser = userService.queryByInvitationCode(fxyOneUser.getBlFxyCode());
|
||||
if(fxyTwoUser!=null){
|
||||
FxyApply faTwo = fxyApplyService.findByUserId(fxyTwoUser.getUserId());
|
||||
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 {
|
||||
fxyRate = twoRate;
|
||||
if (twoRate.compareTo(mostRate) > 0) {
|
||||
fxyRate = mostRate;
|
||||
if(isCanFxyFy) {
|
||||
orders.setFxyTwoUserId(fxyTwoUser.getUserId());
|
||||
orders.setFxyTwoUserName(fxyTwoUser.getUserName());
|
||||
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);
|
||||
|
|
Loading…
Reference in New Issue