|
|
@@ -27,6 +27,7 @@ import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import java.math.BigDecimal;
|
|
|
+import java.math.RoundingMode;
|
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
|
|
@@ -95,6 +96,7 @@ public class SysPartnerController extends BaseController {
|
|
|
}
|
|
|
return HttpResult.error("添加失败");
|
|
|
}
|
|
|
+
|
|
|
@PostMapping("/edit")
|
|
|
@ApiOperation(value = "编辑合伙人")
|
|
|
public HttpResult edit(@RequestBody SysPartnerDto sysPartnerDto) {
|
|
|
@@ -159,7 +161,6 @@ public class SysPartnerController extends BaseController {
|
|
|
|
|
|
/**
|
|
|
* 合伙人查看直接合伙人、间接合伙人分页查询
|
|
|
- *
|
|
|
*/
|
|
|
@PostMapping("/querySysPartnerAPPPage")
|
|
|
@ApiOperation(value = "APP合伙人查看直接合伙人、间接合伙人分页查询")
|
|
|
@@ -178,7 +179,7 @@ public class SysPartnerController extends BaseController {
|
|
|
*/
|
|
|
@PostMapping("/queryAgencyLeaderById")
|
|
|
@ApiOperation(value = "根据合伙人id查询推荐的工作室管理员")
|
|
|
- public HttpResult<BasePageResult<AgencyExtractFeeVo>> queryAgencyLeaderById(@RequestBody SysAgencyLeaderPageDto sysAgencyLeaderPageDto){
|
|
|
+ public HttpResult<BasePageResult<AgencyExtractFeeVo>> queryAgencyLeaderById(@RequestBody SysAgencyLeaderPageDto sysAgencyLeaderPageDto) {
|
|
|
if (sysAgencyLeaderPageDto.getPageNum() == 0) {
|
|
|
sysAgencyLeaderPageDto.setPageNum(1);
|
|
|
}
|
|
|
@@ -198,26 +199,39 @@ public class SysPartnerController extends BaseController {
|
|
|
@ApiOperation(value = "比例配置")
|
|
|
public HttpResult add(@RequestBody SysProportionConfig sysProportionConfig) {
|
|
|
String proportion = sysProportionConfig.getProportion();
|
|
|
- double v = Double.parseDouble(sysProportionConfig.getOneProportion())
|
|
|
- + Double.parseDouble(sysProportionConfig.getTwoProportion())
|
|
|
- + Double.parseDouble(sysProportionConfig.getThreeProportion())
|
|
|
- + Double.parseDouble(sysProportionConfig.getFourProportion())
|
|
|
- + Double.parseDouble(sysProportionConfig.getFiveProportion());
|
|
|
+ String oneProportion = sysProportionConfig.getOneProportion();
|
|
|
+ String twoProportion = sysProportionConfig.getTwoProportion();
|
|
|
+ String threeProportion = sysProportionConfig.getThreeProportion();
|
|
|
+ String fourProportion = sysProportionConfig.getFourProportion();
|
|
|
+ String fiveProportion = sysProportionConfig.getFiveProportion();
|
|
|
+ BigDecimal d = BigDecimal.ZERO;
|
|
|
+ if (oneProportion != null) {
|
|
|
+ d = d.add(new BigDecimal(sysProportionConfig.getOneProportion()));
|
|
|
+ }
|
|
|
+ if (twoProportion != null) {
|
|
|
+ d = d.add(new BigDecimal(sysProportionConfig.getTwoProportion()));
|
|
|
|
|
|
-// String proportionNum = sysProportionConfig.getOneProportion()+sysProportionConfig.getTwoProportion()
|
|
|
-// +sysProportionConfig.getThreeProportion()+sysProportionConfig.getFourProportion()
|
|
|
-// +sysProportionConfig.getFiveProportion();
|
|
|
+ }
|
|
|
+ if (threeProportion != null) {
|
|
|
+ d = d.add(new BigDecimal(sysProportionConfig.getThreeProportion()));
|
|
|
+ }
|
|
|
+ if (fourProportion != null) {
|
|
|
+ d = d.add(new BigDecimal(sysProportionConfig.getFourProportion()));
|
|
|
+ }
|
|
|
+ if (fiveProportion != null) {
|
|
|
+ d = d.add(new BigDecimal(sysProportionConfig.getFiveProportion()));
|
|
|
+ }
|
|
|
|
|
|
BigDecimal bigDecimal = new BigDecimal(proportion);
|
|
|
- BigDecimal bigDecimal1 = new BigDecimal(v);
|
|
|
- if (bigDecimal.compareTo(bigDecimal1) != 0 ) {
|
|
|
+ BigDecimal bigDecimal1 = d.setScale(1, RoundingMode.DOWN);
|
|
|
+ if (bigDecimal.compareTo(bigDecimal1) != 0) {
|
|
|
throw new SystemException("总比例必须等于每级合伙人比例和");
|
|
|
}
|
|
|
Long id = sysProportionConfig.getId();
|
|
|
- boolean b =false;
|
|
|
+ boolean b = false;
|
|
|
if (id == null) {
|
|
|
- b = sysProportionConfigMapper.insert(sysProportionConfig)>0;
|
|
|
- }else {
|
|
|
+ b = sysProportionConfigMapper.insert(sysProportionConfig) > 0;
|
|
|
+ } else {
|
|
|
b = sysProportionConfigMapper.updateWithNull(sysProportionConfig);
|
|
|
}
|
|
|
return HttpResult.ok(b);
|
|
|
@@ -225,6 +239,7 @@ public class SysPartnerController extends BaseController {
|
|
|
|
|
|
/**
|
|
|
* 编辑查询
|
|
|
+ *
|
|
|
* @param id
|
|
|
* @return
|
|
|
*/
|
|
|
@@ -233,6 +248,7 @@ public class SysPartnerController extends BaseController {
|
|
|
public HttpResult getProportionConfig(@RequestParam("id") String id) {
|
|
|
return HttpResult.ok(sysProportionConfigService.getProportionConfig(id));
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
* 血缘关系
|
|
|
*/
|
|
|
@@ -243,9 +259,5 @@ public class SysPartnerController extends BaseController {
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
|