|
@@ -46,18 +46,18 @@ public class TProportionController {
|
|
|
|
|
|
@ApiOperation(value = "获取分销信息列表 分页 商户")
|
|
|
@GetMapping("/pageProportion")
|
|
|
- public ResponseModel<IPage<?>> pageProportion(String adminId,String type,long current, long size ) {
|
|
|
+ public ResponseModel<IPage<?>> pageProportion(String adminId, String type, long current, long size) {
|
|
|
TAdmin admin = adminService.getById(adminId);
|
|
|
- if(StringUtils.isEmpty(adminId)){
|
|
|
+ if (StringUtils.isEmpty(adminId)) {
|
|
|
return R.fail(ResponseCodesEnum.A0100);
|
|
|
}
|
|
|
- if(type.equals("0")){
|
|
|
+ if (type.equals("0")) {
|
|
|
//未审核
|
|
|
LambdaQueryWrapper<TProportionCheck> query = Wrappers.lambdaQuery();
|
|
|
- if(admin.getType()>1){
|
|
|
- query.eq(TProportionCheck::getAdminId,admin.getId());
|
|
|
+ if (admin.getType() > 1) {
|
|
|
+ query.eq(TProportionCheck::getAdminId, admin.getId());
|
|
|
}
|
|
|
- query.eq(TProportionCheck::getCheckType,"0");
|
|
|
+ query.eq(TProportionCheck::getCheckType, "0");
|
|
|
// 公司平台
|
|
|
// 申泽平台管理员
|
|
|
if (admin.getId() == 2738) {
|
|
@@ -66,7 +66,7 @@ public class TProportionController {
|
|
|
.eq(TAdmin::getCompanyType, "0");
|
|
|
List<Long> adminIds = adminService.list(adminQuery).stream()
|
|
|
.map(TAdmin::getId).collect(Collectors.toList());
|
|
|
- query.in(TProportionCheck::getAdminId,adminIds);
|
|
|
+ query.in(TProportionCheck::getAdminId, adminIds);
|
|
|
}
|
|
|
// 七云平台管理员
|
|
|
if (admin.getId() == 2739) {
|
|
@@ -74,20 +74,20 @@ public class TProportionController {
|
|
|
adminQuery.eq(TAdmin::getCompanyType, "1");
|
|
|
List<Long> adminIds = adminService.list(adminQuery).stream()
|
|
|
.map(TAdmin::getId).collect(Collectors.toList());
|
|
|
- query.in(TProportionCheck::getAdminId,adminIds);
|
|
|
+ query.in(TProportionCheck::getAdminId, adminIds);
|
|
|
}
|
|
|
query.orderByDesc(TProportionCheck::getCreateDate);
|
|
|
Page<TProportionCheck> page = new Page<>(current, size, true);
|
|
|
IPage<TProportionCheck> iPage = tProportionCheckService.page(page, query);
|
|
|
List<TProportionCheck> records = iPage.getRecords();
|
|
|
- if(records.size()>0){
|
|
|
- for(TProportionCheck proportionCheck:records){
|
|
|
- if(proportionCheck.getEquipmentId()!=null){
|
|
|
+ if (records.size() > 0) {
|
|
|
+ for (TProportionCheck proportionCheck : records) {
|
|
|
+ if (proportionCheck.getEquipmentId() != null) {
|
|
|
TEquipment equipment = tEquipmentService.getById(proportionCheck.getEquipmentId());
|
|
|
- if(equipment != null) {
|
|
|
- if(StringUtils.isNotEmpty(equipment.getName())){
|
|
|
+ if (equipment != null) {
|
|
|
+ if (StringUtils.isNotEmpty(equipment.getName())) {
|
|
|
proportionCheck.setEquipmentName(equipment.getName());
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
proportionCheck.setEquipmentName(equipment.getClientId());
|
|
|
}
|
|
|
}
|
|
@@ -97,13 +97,13 @@ public class TProportionController {
|
|
|
}
|
|
|
|
|
|
return R.ok(iPage);
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
//已审核
|
|
|
LambdaQueryWrapper<TProportionCheck> query = Wrappers.lambdaQuery();
|
|
|
- if(admin.getType()>1){
|
|
|
- query.eq(TProportionCheck::getAdminId,admin.getId());
|
|
|
+ if (admin.getType() > 1) {
|
|
|
+ query.eq(TProportionCheck::getAdminId, admin.getId());
|
|
|
}
|
|
|
- query.in(TProportionCheck::getCheckType,"1","2","3");
|
|
|
+ query.in(TProportionCheck::getCheckType, "1", "2", "3");
|
|
|
// 公司平台
|
|
|
// 申泽平台管理员
|
|
|
if (admin.getId() == 2738) {
|
|
@@ -112,7 +112,7 @@ public class TProportionController {
|
|
|
.eq(TAdmin::getCompanyType, "0");
|
|
|
List<Long> adminIds = adminService.list(adminQuery).stream()
|
|
|
.map(TAdmin::getId).collect(Collectors.toList());
|
|
|
- query.in(TProportionCheck::getAdminId,adminIds);
|
|
|
+ query.in(TProportionCheck::getAdminId, adminIds);
|
|
|
}
|
|
|
// 七云平台管理员
|
|
|
if (admin.getId() == 2739) {
|
|
@@ -120,20 +120,20 @@ public class TProportionController {
|
|
|
adminQuery.eq(TAdmin::getCompanyType, "1");
|
|
|
List<Long> adminIds = adminService.list(adminQuery).stream()
|
|
|
.map(TAdmin::getId).collect(Collectors.toList());
|
|
|
- query.in(TProportionCheck::getAdminId,adminIds);
|
|
|
+ query.in(TProportionCheck::getAdminId, adminIds);
|
|
|
}
|
|
|
query.orderByDesc(TProportionCheck::getCreateDate);
|
|
|
Page<TProportionCheck> page = new Page<>(current, size, true);
|
|
|
IPage<TProportionCheck> iPage = tProportionCheckService.page(page, query);
|
|
|
List<TProportionCheck> records = iPage.getRecords();
|
|
|
- if(records.size()>0){
|
|
|
- for(TProportionCheck proportionCheck:records){
|
|
|
- if(proportionCheck.getEquipmentId()!=null){
|
|
|
+ if (records.size() > 0) {
|
|
|
+ for (TProportionCheck proportionCheck : records) {
|
|
|
+ if (proportionCheck.getEquipmentId() != null) {
|
|
|
TEquipment equipment = tEquipmentService.getById(proportionCheck.getEquipmentId());
|
|
|
- if(equipment != null) {
|
|
|
- if(StringUtils.isNotEmpty(equipment.getName())){
|
|
|
+ if (equipment != null) {
|
|
|
+ if (StringUtils.isNotEmpty(equipment.getName())) {
|
|
|
proportionCheck.setEquipmentName(equipment.getName());
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
proportionCheck.setEquipmentName(equipment.getClientId());
|
|
|
}
|
|
|
}
|
|
@@ -143,20 +143,21 @@ public class TProportionController {
|
|
|
return R.ok(iPage);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
@ApiOperation(value = "获取分销信息列表 分页 平台")
|
|
|
@GetMapping("/pageProportionAdmin")
|
|
|
- public ResponseModel<IPage<?>> pageProportionAdmin(String adminId,String userName,String type,long current, long size ) {
|
|
|
+ public ResponseModel<IPage<?>> pageProportionAdmin(String adminId, String userName, String type, long current, long size) {
|
|
|
TAdmin admin = adminService.getById(adminId);
|
|
|
- if(StringUtils.isEmpty(adminId)){
|
|
|
+ if (StringUtils.isEmpty(adminId)) {
|
|
|
return R.fail(ResponseCodesEnum.A0100);
|
|
|
}
|
|
|
//未审核
|
|
|
LambdaQueryWrapper<TProportionCheck> query = Wrappers.lambdaQuery();
|
|
|
- if(admin.getType()>1){
|
|
|
- query.eq(TProportionCheck::getAdminId,admin.getId());
|
|
|
+ if (admin.getType() > 1) {
|
|
|
+ query.eq(TProportionCheck::getAdminId, admin.getId());
|
|
|
}
|
|
|
- if(type.equals("0")){
|
|
|
- query.eq(TProportionCheck::getCheckType,type);
|
|
|
+ if (type.equals("0")) {
|
|
|
+ query.eq(TProportionCheck::getCheckType, type);
|
|
|
}
|
|
|
// 申泽平台管理员
|
|
|
if (admin.getId() == 2738) {
|
|
@@ -165,7 +166,7 @@ public class TProportionController {
|
|
|
.eq(TAdmin::getCompanyType, "0");
|
|
|
List<Long> adminIds = adminService.list(adminQuery).stream()
|
|
|
.map(TAdmin::getId).collect(Collectors.toList());
|
|
|
- query.in(TProportionCheck::getAdminId,adminIds);
|
|
|
+ query.in(TProportionCheck::getAdminId, adminIds);
|
|
|
}
|
|
|
// 七云平台管理员
|
|
|
if (admin.getId() == 2739) {
|
|
@@ -173,28 +174,28 @@ public class TProportionController {
|
|
|
adminQuery.eq(TAdmin::getCompanyType, "1");
|
|
|
List<Long> adminIds = adminService.list(adminQuery).stream()
|
|
|
.map(TAdmin::getId).collect(Collectors.toList());
|
|
|
- query.in(TProportionCheck::getAdminId,adminIds);
|
|
|
+ query.in(TProportionCheck::getAdminId, adminIds);
|
|
|
}
|
|
|
- if(StringUtils.isNotEmpty(userName)){
|
|
|
+ if (StringUtils.isNotEmpty(userName)) {
|
|
|
LambdaQueryWrapper<TAdmin> query1 = Wrappers.lambdaQuery();
|
|
|
- query1.eq(TAdmin::getUsername,userName);
|
|
|
+ query1.eq(TAdmin::getUsername, userName);
|
|
|
List<TAdmin> list = adminService.list(query1);
|
|
|
- if(list.size()>0){
|
|
|
- query.eq(TProportionCheck::getAdminId,list.get(0).getId());
|
|
|
+ if (list.size() > 0) {
|
|
|
+ query.eq(TProportionCheck::getAdminId, list.get(0).getId());
|
|
|
}
|
|
|
}
|
|
|
query.orderByDesc(TProportionCheck::getCreateDate);
|
|
|
Page<TProportionCheck> page = new Page<>(current, size, true);
|
|
|
IPage<TProportionCheck> iPage = tProportionCheckService.page(page, query);
|
|
|
List<TProportionCheck> records = iPage.getRecords();
|
|
|
- if(records.size()>0){
|
|
|
- for(TProportionCheck proportionCheck:records){
|
|
|
- if(proportionCheck.getEquipmentId()!=null){
|
|
|
+ if (records.size() > 0) {
|
|
|
+ for (TProportionCheck proportionCheck : records) {
|
|
|
+ if (proportionCheck.getEquipmentId() != null) {
|
|
|
TEquipment equipment = tEquipmentService.getById(proportionCheck.getEquipmentId());
|
|
|
- if(equipment != null) {
|
|
|
- if(StringUtils.isNotEmpty(equipment.getName())){
|
|
|
+ if (equipment != null) {
|
|
|
+ if (StringUtils.isNotEmpty(equipment.getName())) {
|
|
|
proportionCheck.setEquipmentName(equipment.getName());
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
proportionCheck.setEquipmentName(equipment.getClientId());
|
|
|
}
|
|
|
}
|
|
@@ -204,6 +205,7 @@ public class TProportionController {
|
|
|
return R.ok(iPage);
|
|
|
|
|
|
}
|
|
|
+
|
|
|
@ApiOperation(value = "查找机器分销信息信息")
|
|
|
@PostMapping("/getOne")
|
|
|
public ResponseModel<?> getOne(String adminId, String clientId) {
|
|
@@ -214,10 +216,10 @@ public class TProportionController {
|
|
|
adminId = String.valueOf(equipment.getAdminId());
|
|
|
}
|
|
|
LambdaQueryWrapper<TProportion> query = Wrappers.lambdaQuery();
|
|
|
- query.eq(TProportion::getAdminId,adminId);
|
|
|
- query.eq(TProportion::getClientId,clientId);
|
|
|
+ query.eq(TProportion::getAdminId, adminId);
|
|
|
+ query.eq(TProportion::getClientId, clientId);
|
|
|
List<TProportion> list = tProportionService.list(query);
|
|
|
- if(list.size()>0){
|
|
|
+ if (list.size() > 0) {
|
|
|
//已经注册,就要查看是否有提交审核的
|
|
|
// LambdaQueryWrapper<TProportionCheck> query1 = Wrappers.lambdaQuery();
|
|
|
// query1.eq(TProportionCheck::getAdminId,adminid);
|
|
@@ -254,20 +256,20 @@ public class TProportionController {
|
|
|
// return R.ok(list.get(0));
|
|
|
// }
|
|
|
TProportion tProportion = list.get(0);
|
|
|
- if(tProportion.getAgencyId()!=null){
|
|
|
+ if (tProportion.getAgencyId() != null) {
|
|
|
TAdmin admin1 = adminService.getById(tProportion.getAgencyId());
|
|
|
tProportion.setAgencyName(admin1.getUsername());
|
|
|
}
|
|
|
- if(tProportion.getMerchantId()!=null){
|
|
|
+ if (tProportion.getMerchantId() != null) {
|
|
|
TAdmin admin2 = adminService.getById(tProportion.getMerchantId());
|
|
|
tProportion.setMerchantName(admin2.getUsername());
|
|
|
}
|
|
|
- if(tProportion.getPersonageId()!=null){
|
|
|
+ if (tProportion.getPersonageId() != null) {
|
|
|
TAdmin admin3 = adminService.getById(tProportion.getId());
|
|
|
tProportion.setPersonageName(admin3.getUsername());
|
|
|
}
|
|
|
return R.ok(tProportion);
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
return R.fail("尚未注册!");
|
|
|
}
|
|
|
}
|
|
@@ -275,17 +277,17 @@ public class TProportionController {
|
|
|
@ApiOperation(value = "保存或提交审核")
|
|
|
@PostMapping("/save")
|
|
|
public ResponseModel<?> save(@RequestBody TProportion tProportion) {
|
|
|
- if(tProportion.getAdminId()==null||StringUtils.isEmpty(tProportion.getClientId())){
|
|
|
+ if (tProportion.getAdminId() == null || StringUtils.isEmpty(tProportion.getClientId())) {
|
|
|
R.fail("信息有空!");
|
|
|
}
|
|
|
// TAdmin admin = adminService.getById(tProportion.getAdminId());
|
|
|
//查找机器,看改商家是否有该机器
|
|
|
LambdaQueryWrapper<TEquipment> query1 = Wrappers.lambdaQuery();
|
|
|
- query1.eq(TEquipment::getAdminId,tProportion.getAdminId());
|
|
|
- query1.eq(TEquipment::getClientId,tProportion.getClientId());
|
|
|
+ query1.eq(TEquipment::getAdminId, tProportion.getAdminId());
|
|
|
+ query1.eq(TEquipment::getClientId, tProportion.getClientId());
|
|
|
// List<TEquipment> equipmentList = tEquipmentService.list(query1);
|
|
|
TEquipment equipment = tEquipmentService.getOne(query1);
|
|
|
- if(equipment == null){
|
|
|
+ if (equipment == null) {
|
|
|
return R.fail("找不到该机器!");
|
|
|
}
|
|
|
String name = equipment.getName();
|
|
@@ -295,81 +297,81 @@ public class TProportionController {
|
|
|
}
|
|
|
//查看是否有审核中的
|
|
|
LambdaQueryWrapper<TProportionCheck> queryCheck = Wrappers.lambdaQuery();
|
|
|
- queryCheck.eq(TProportionCheck::getAdminId,tProportion.getAdminId());
|
|
|
- queryCheck.eq(TProportionCheck::getClientId,tProportion.getClientId());
|
|
|
- queryCheck.eq(TProportionCheck::getCheckType,"0");
|
|
|
+ queryCheck.eq(TProportionCheck::getAdminId, tProportion.getAdminId());
|
|
|
+ queryCheck.eq(TProportionCheck::getClientId, tProportion.getClientId());
|
|
|
+ queryCheck.eq(TProportionCheck::getCheckType, "0");
|
|
|
List<TProportionCheck> listCheck = tProportionCheckService.list(queryCheck);
|
|
|
- if(listCheck.size()>0){
|
|
|
+ if (listCheck.size() > 0) {
|
|
|
return R.fail("已有审核,如需修改请先取消原来的审核!");
|
|
|
}
|
|
|
Long agencyId = null;
|
|
|
Long merchantId = null;
|
|
|
Long personageId = null;
|
|
|
//查找个分账人的id
|
|
|
- if(tProportion.getType()>0){
|
|
|
+ if (tProportion.getType() > 0) {
|
|
|
//1个
|
|
|
LambdaQueryWrapper<TAdmin> queryTAdmin = Wrappers.lambdaQuery();
|
|
|
- queryTAdmin.eq(TAdmin::getUsername,tProportion.getAgencyName());
|
|
|
+ queryTAdmin.eq(TAdmin::getUsername, tProportion.getAgencyName());
|
|
|
TAdmin admins = adminService.getOne(queryTAdmin);
|
|
|
- if(admins != null){
|
|
|
+ if (admins != null) {
|
|
|
agencyId = admins.getId();
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
return R.fail("找不到第一个分账人!");
|
|
|
}
|
|
|
}
|
|
|
- if(tProportion.getType()>1){
|
|
|
+ if (tProportion.getType() > 1) {
|
|
|
//2个
|
|
|
LambdaQueryWrapper<TAdmin> queryTAdmin1 = Wrappers.lambdaQuery();
|
|
|
- queryTAdmin1.eq(TAdmin::getUsername,tProportion.getMerchantName());
|
|
|
+ queryTAdmin1.eq(TAdmin::getUsername, tProportion.getMerchantName());
|
|
|
TAdmin admins1 = adminService.getOne(queryTAdmin1);
|
|
|
- if(admins1 != null){
|
|
|
+ if (admins1 != null) {
|
|
|
merchantId = admins1.getId();
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
return R.fail("找不到第二个分账人!");
|
|
|
}
|
|
|
}
|
|
|
- if(tProportion.getType()>2){
|
|
|
+ if (tProportion.getType() > 2) {
|
|
|
//3个
|
|
|
LambdaQueryWrapper<TAdmin> queryTAdmin2 = Wrappers.lambdaQuery();
|
|
|
- queryTAdmin2.eq(TAdmin::getUsername,tProportion.getPersonageName());
|
|
|
+ queryTAdmin2.eq(TAdmin::getUsername, tProportion.getPersonageName());
|
|
|
TAdmin admins2 = adminService.getOne(queryTAdmin2);
|
|
|
- if(admins2 != null){
|
|
|
+ if (admins2 != null) {
|
|
|
personageId = admins2.getId();
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
return R.fail("找不到第三个分账人!");
|
|
|
}
|
|
|
|
|
|
}
|
|
|
LambdaQueryWrapper<TProportion> query = Wrappers.lambdaQuery();
|
|
|
- query.eq(TProportion::getAdminId,tProportion.getAdminId());
|
|
|
- query.eq(TProportion::getClientId,tProportion.getClientId());
|
|
|
+ query.eq(TProportion::getAdminId, tProportion.getAdminId());
|
|
|
+ query.eq(TProportion::getClientId, tProportion.getClientId());
|
|
|
TProportion proportion = tProportionService.getOne(query);
|
|
|
- if(proportion != null){
|
|
|
- //提交审核
|
|
|
- TProportionCheck proportionCheck = new TProportionCheck();
|
|
|
- proportionCheck.setAdminId(tProportion.getAdminId());
|
|
|
- proportionCheck.setEquipmentId(equipment.getId());
|
|
|
- proportionCheck.setClientId(tProportion.getClientId());
|
|
|
- proportionCheck.setType(tProportion.getType());
|
|
|
- proportionCheck.setProportion(tProportion.getProportion());
|
|
|
- proportionCheck.setAdminProportion(tProportion.getAdminProportion());
|
|
|
- proportionCheck.setAgencyId(agencyId);
|
|
|
- proportionCheck.setMerchantId(merchantId);
|
|
|
- proportionCheck.setPersonageId(personageId);
|
|
|
- proportionCheck.setAgencyProportion(tProportion.getAgencyProportion());
|
|
|
- proportionCheck.setMerchantProportion(tProportion.getMerchantProportion());
|
|
|
- proportionCheck.setPersonageProportion(tProportion.getPersonageProportion());
|
|
|
- proportionCheck.setAgencyName(tProportion.getAgencyName());
|
|
|
- proportionCheck.setMerchantName(tProportion.getMerchantName());
|
|
|
- proportionCheck.setPersonageName(tProportion.getPersonageName());
|
|
|
- proportionCheck.setEquipmentName(equipment.getName());
|
|
|
- proportionCheck.setCreateDate(new Date());
|
|
|
- proportionCheck.setModifyDate(new Date());
|
|
|
- proportionCheck.setCheckType("0");
|
|
|
- tProportionCheckService.save(proportionCheck);
|
|
|
- return R.ok("已提交审核");
|
|
|
+ if (proportion != null) {
|
|
|
+ //提交审核
|
|
|
+ TProportionCheck proportionCheck = new TProportionCheck();
|
|
|
+ proportionCheck.setAdminId(tProportion.getAdminId());
|
|
|
+ proportionCheck.setEquipmentId(equipment.getId());
|
|
|
+ proportionCheck.setClientId(tProportion.getClientId());
|
|
|
+ proportionCheck.setType(tProportion.getType());
|
|
|
+ proportionCheck.setProportion(tProportion.getProportion());
|
|
|
+ proportionCheck.setAdminProportion(tProportion.getAdminProportion());
|
|
|
+ proportionCheck.setAgencyId(agencyId);
|
|
|
+ proportionCheck.setMerchantId(merchantId);
|
|
|
+ proportionCheck.setPersonageId(personageId);
|
|
|
+ proportionCheck.setAgencyProportion(tProportion.getAgencyProportion());
|
|
|
+ proportionCheck.setMerchantProportion(tProportion.getMerchantProportion());
|
|
|
+ proportionCheck.setPersonageProportion(tProportion.getPersonageProportion());
|
|
|
+ proportionCheck.setAgencyName(tProportion.getAgencyName());
|
|
|
+ proportionCheck.setMerchantName(tProportion.getMerchantName());
|
|
|
+ proportionCheck.setPersonageName(tProportion.getPersonageName());
|
|
|
+ proportionCheck.setEquipmentName(equipment.getName());
|
|
|
+ proportionCheck.setCreateDate(new Date());
|
|
|
+ proportionCheck.setModifyDate(new Date());
|
|
|
+ proportionCheck.setCheckType("0");
|
|
|
+ tProportionCheckService.save(proportionCheck);
|
|
|
+ return R.ok("已提交审核");
|
|
|
// }
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
//提交审核
|
|
|
TProportionCheck proportionCheck = new TProportionCheck();
|
|
|
proportionCheck.setAdminId(tProportion.getAdminId());
|
|
@@ -391,7 +393,7 @@ public class TProportionController {
|
|
|
proportionCheck.setCreateDate(new Date());
|
|
|
proportionCheck.setModifyDate(new Date());
|
|
|
//没有,判断是否为99%和1%组合
|
|
|
- if(tProportion.getProportion().compareTo(new BigDecimal("99"))==0&&tProportion.getAdminProportion().compareTo(new BigDecimal("1"))==0){
|
|
|
+ if (tProportion.getProportion().compareTo(new BigDecimal("99")) == 0 && tProportion.getAdminProportion().compareTo(new BigDecimal("1")) == 0) {
|
|
|
tProportion.setAgencyId(agencyId);
|
|
|
tProportion.setMerchantId(merchantId);
|
|
|
tProportion.setPersonageId(personageId);
|
|
@@ -406,85 +408,88 @@ public class TProportionController {
|
|
|
proportionCheck.setCheckType("1");
|
|
|
tProportionCheckService.save(proportionCheck);
|
|
|
return R.ok("添加成功");
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
proportionCheck.setCheckType("0");
|
|
|
tProportionCheckService.save(proportionCheck);
|
|
|
return R.ok("已提交审核");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
@ApiOperation(value = "")
|
|
|
@GetMapping("/getById")
|
|
|
- public ResponseModel<?> getById( String id,String type) {
|
|
|
- if(StringUtils.isEmpty(id)&&StringUtils.isEmpty(type)){
|
|
|
+ public ResponseModel<?> getById(String id, String type) {
|
|
|
+ if (StringUtils.isEmpty(id) && StringUtils.isEmpty(type)) {
|
|
|
return R.fail(ResponseCodesEnum.A0100);
|
|
|
}
|
|
|
- if(type.equals("0")){
|
|
|
+ if (type.equals("0")) {
|
|
|
//未审核
|
|
|
LambdaQueryWrapper<TProportionCheck> query = Wrappers.lambdaQuery();
|
|
|
- query.eq(TProportionCheck::getId,id);
|
|
|
+ query.eq(TProportionCheck::getId, id);
|
|
|
List<TProportionCheck> list = tProportionCheckService.list(query);
|
|
|
TProportionCheck tProportionCheck = list.get(0);
|
|
|
return R.ok(tProportionCheck);
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
//已审核
|
|
|
LambdaQueryWrapper<TProportion> query = Wrappers.lambdaQuery();
|
|
|
- query.eq(TProportion::getId,id);
|
|
|
+ query.eq(TProportion::getId, id);
|
|
|
List<TProportion> list = tProportionService.list(query);
|
|
|
TProportion tProportion = list.get(0);
|
|
|
return R.ok(tProportion);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
@ApiOperation(value = "获取机器分销信息")
|
|
|
@GetMapping("/getProportion")
|
|
|
public ResponseModel<TProportion> getProportion(@RequestParam String equipmentId) {
|
|
|
LambdaQueryWrapper<TProportion> query = Wrappers.lambdaQuery();
|
|
|
- query.eq(TProportion::getEquipmentId,Long.valueOf(equipmentId));
|
|
|
+ query.eq(TProportion::getEquipmentId, Long.valueOf(equipmentId));
|
|
|
// List<TProportion> list = tProportionService.list(query);
|
|
|
// TProportion tProportion = list.get(0);
|
|
|
TProportion proportion = tProportionService.getOne(query);
|
|
|
return R.ok(proportion);
|
|
|
}
|
|
|
+
|
|
|
@ApiOperation(value = "批量设置机器分销")
|
|
|
@GetMapping("/setProportion")
|
|
|
public ResponseModel<?> setProportion() {
|
|
|
LambdaQueryWrapper<TAdmin> query = Wrappers.lambdaQuery();
|
|
|
- query.eq(TAdmin::getIfForeign,"0");
|
|
|
+ query.eq(TAdmin::getIfForeign, "0");
|
|
|
List<TAdmin> list = adminService.list(query);
|
|
|
List<TEquipment> equipmentList = new ArrayList<>();
|
|
|
- if(list.size()>0){
|
|
|
- for(TAdmin admin:list){
|
|
|
+ if (list.size() > 0) {
|
|
|
+ for (TAdmin admin : list) {
|
|
|
LambdaQueryWrapper<TEquipment> query1 = Wrappers.lambdaQuery();
|
|
|
- query1.eq(TEquipment::getAdminId,admin.getId());
|
|
|
+ query1.eq(TEquipment::getAdminId, admin.getId());
|
|
|
List<TEquipment> list1 = tEquipmentService.list(query1);
|
|
|
- if(list1.size()>0){
|
|
|
- for(TEquipment equipment:list1){
|
|
|
+ if (list1.size() > 0) {
|
|
|
+ for (TEquipment equipment : list1) {
|
|
|
String s = equipment.getClientId().substring(equipment.getClientId().length() - 1, equipment.getClientId().length());
|
|
|
- if(!s.equals("x")){
|
|
|
+ if (!s.equals("x")) {
|
|
|
equipmentList.add(equipment);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- if(equipmentList.size()>0){
|
|
|
- for(TEquipment equipment:equipmentList){
|
|
|
+ if (equipmentList.size() > 0) {
|
|
|
+ for (TEquipment equipment : equipmentList) {
|
|
|
String clientId = equipment.getClientId();
|
|
|
LambdaQueryWrapper<TEquipment> query2 = Wrappers.lambdaQuery();
|
|
|
- query2.eq(TEquipment::getClientId,clientId);
|
|
|
+ query2.eq(TEquipment::getClientId, clientId);
|
|
|
List<TEquipment> list2 = tEquipmentService.list(query2);
|
|
|
TEquipment equipment1 = list2.get(0);
|
|
|
- if(equipment1!=null&&equipment1.getId()!=null){
|
|
|
+ if (equipment1 != null && equipment1.getId() != null) {
|
|
|
TAdmin admin = adminService.getById(equipment1.getAdminId());
|
|
|
String name = admin.getName();
|
|
|
//查询机器是否已经有设置分销
|
|
|
LambdaQueryWrapper<TProportion> query1 = Wrappers.lambdaQuery();
|
|
|
- query1.eq(TProportion::getClientId,equipment1.getClientId());
|
|
|
- query1.eq(TProportion::getEquipmentId,equipment1.getId());
|
|
|
+ query1.eq(TProportion::getClientId, equipment1.getClientId());
|
|
|
+ query1.eq(TProportion::getEquipmentId, equipment1.getId());
|
|
|
List<TProportion> list1 = tProportionService.list(query1);
|
|
|
- if(list1.size()>0){
|
|
|
+ if (list1.size() > 0) {
|
|
|
//已有
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
//没有,需要创建
|
|
|
//1,判断是否新机器
|
|
|
// Date createDate = equipment.getCreateDate();
|
|
@@ -501,11 +506,11 @@ public class TProportionController {
|
|
|
// }
|
|
|
//先找到原账户的分销
|
|
|
LambdaQueryWrapper<TProportion> query3 = Wrappers.lambdaQuery();
|
|
|
- query3.eq(TProportion::getAdminId,admin.getId());
|
|
|
+ query3.eq(TProportion::getAdminId, admin.getId());
|
|
|
List<TProportion> list3 = tProportionService.list(query3);
|
|
|
- if(list3.size()>0){
|
|
|
+ if (list3.size() > 0) {
|
|
|
TProportion adminProportion = list3.get(0);
|
|
|
- if(StringUtils.isEmpty(adminProportion.getClientId())){
|
|
|
+ if (StringUtils.isEmpty(adminProportion.getClientId())) {
|
|
|
TProportion equipmentProportion = new TProportion();
|
|
|
equipmentProportion.setCreateDate(new Date());
|
|
|
equipmentProportion.setModifyDate(new Date());
|
|
@@ -514,7 +519,7 @@ public class TProportionController {
|
|
|
equipmentProportion.setEquipmentId(equipment.getId());
|
|
|
equipmentProportion.setAdminProportion(adminProportion.getAdminProportion());
|
|
|
Integer type = adminProportion.getType();
|
|
|
- if(type!=null){
|
|
|
+ if (type != null) {
|
|
|
switch (type) {
|
|
|
case 1:
|
|
|
equipmentProportion.setProportion(adminProportion.getAgencyProportion());
|
|
@@ -567,7 +572,7 @@ public class TProportionController {
|
|
|
|
|
|
}
|
|
|
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
|
|
|
}
|
|
|
}
|