|
|
@@ -1,6 +1,7 @@
|
|
|
package org.jeecg.modules.api.controller;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import io.swagger.annotations.Api;
|
|
|
@@ -9,7 +10,13 @@ import lombok.extern.slf4j.Slf4j;
|
|
|
import org.jeecg.common.api.vo.Result;
|
|
|
import org.jeecg.common.aspect.annotation.AutoLog;
|
|
|
import org.jeecg.common.system.base.controller.JeecgController;
|
|
|
+import org.jeecg.common.system.query.QueryGenerator;
|
|
|
+import org.jeecg.common.util.businessAccountUtils;
|
|
|
+import org.jeecg.modules.hlwaccount.entity.HlwCompanyAccount;
|
|
|
+import org.jeecg.modules.hlwaccount.entity.HlwCompanyAccountDetail;
|
|
|
import org.jeecg.modules.hlwaccount.entity.HlwCompanySubcontractor;
|
|
|
+import org.jeecg.modules.hlwaccount.service.IHlwCompanyAccountDetailService;
|
|
|
+import org.jeecg.modules.hlwaccount.service.IHlwCompanyAccountService;
|
|
|
import org.jeecg.modules.hlworder.entity.HlwOrder;
|
|
|
import org.jeecg.modules.hlworder.entity.HlwRequirement;
|
|
|
import org.jeecg.modules.hlworder.service.IHlwOrderService;
|
|
|
@@ -20,6 +27,8 @@ import org.springframework.web.bind.annotation.RequestBody;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
+import java.math.BigDecimal;
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
|
|
@@ -37,6 +46,10 @@ public class HlwAutoMonitorApiController extends JeecgController<HlwOrder, IHlwO
|
|
|
private IHlwOrderService hlwOrderService;
|
|
|
@Autowired
|
|
|
private IHlwRequirementService hlwRequirementService;
|
|
|
+ @Autowired
|
|
|
+ private IHlwCompanyAccountService hlwCompanyAccountService;
|
|
|
+ @Autowired
|
|
|
+ private IHlwCompanyAccountDetailService hlwCompanyAccountDetailService;
|
|
|
|
|
|
|
|
|
|
|
|
@@ -83,4 +96,99 @@ public class HlwAutoMonitorApiController extends JeecgController<HlwOrder, IHlwO
|
|
|
result.setResult(pageList);
|
|
|
return result;
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 企业账户监测
|
|
|
+ *
|
|
|
+ * @param jsonObject
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @AutoLog(value = "企业账户监测")
|
|
|
+ @ApiOperation(value = "企业账户监测", notes = "企业账户监测")
|
|
|
+ @PostMapping(value = "/statisticData")
|
|
|
+ public Result<?> statisticData(@RequestBody JSONObject jsonObject) {
|
|
|
+ Result<IPage<HlwCompanyAccount>> result = new Result<IPage<HlwCompanyAccount>>();
|
|
|
+ Integer applicationId=jsonObject.getInteger("applicationId");
|
|
|
+ Integer pageNo = jsonObject.getInteger("pageNo");
|
|
|
+ Integer pageSize = jsonObject.getInteger("pageSize");
|
|
|
+ QueryWrapper<HlwCompanyAccount> queryWrapper3 = new QueryWrapper<>();
|
|
|
+ queryWrapper3.eq("application_id",applicationId);
|
|
|
+ List<HlwCompanyAccount> hlwCompanyAccountList=hlwCompanyAccountService.list(queryWrapper3);
|
|
|
+ //存放返回参数
|
|
|
+ List<HlwCompanyAccount> list=new ArrayList<>();
|
|
|
+ if(hlwCompanyAccountList.size()>0){
|
|
|
+ for (int i = 0; i <hlwCompanyAccountList.size() ; i++) {
|
|
|
+ HlwCompanyAccount hlwCompanyAccount=hlwCompanyAccountList.get(i);
|
|
|
+ //充值
|
|
|
+ QueryWrapper<HlwCompanyAccountDetail> queryWrapper = new QueryWrapper<>();
|
|
|
+ queryWrapper.eq("company_account_id",hlwCompanyAccount.getId());
|
|
|
+ queryWrapper.eq("type",0);
|
|
|
+ List<HlwCompanyAccountDetail> hlwCompanyAccountDetailList=hlwCompanyAccountDetailService.list(queryWrapper);
|
|
|
+ //付款
|
|
|
+ QueryWrapper<HlwCompanyAccountDetail> queryWrapper1 = new QueryWrapper<>();
|
|
|
+ queryWrapper1.eq("company_account_id",hlwCompanyAccount.getId());
|
|
|
+ queryWrapper1.eq("type",1);
|
|
|
+ List<HlwCompanyAccountDetail> hlwCompanyAccountDetailList1=hlwCompanyAccountDetailService.list(queryWrapper1);
|
|
|
+ //提现
|
|
|
+ QueryWrapper<HlwCompanyAccountDetail> queryWrapper2 = new QueryWrapper<>();
|
|
|
+ queryWrapper2.eq("company_account_id",hlwCompanyAccount.getId());
|
|
|
+ queryWrapper2.eq("type",2);
|
|
|
+ List<HlwCompanyAccountDetail> hlwCompanyAccountDetailList2=hlwCompanyAccountDetailService.list(queryWrapper2);
|
|
|
+
|
|
|
+ //比较入账(充值金额-提现金额)
|
|
|
+ Double totalDeposit=0.00;
|
|
|
+ Double totalOut=0.00;
|
|
|
+ for (int j = 0; j <hlwCompanyAccountDetailList.size() ; j++) {
|
|
|
+ //计算总充值金额
|
|
|
+ totalDeposit=businessAccountUtils.add(totalDeposit,hlwCompanyAccountDetailList.get(i).getAmount());
|
|
|
+ }
|
|
|
+ for (int j = 0; j <hlwCompanyAccountDetailList2.size() ; j++) {
|
|
|
+ //计算总提现金额金额
|
|
|
+ totalOut=businessAccountUtils.add(totalOut,hlwCompanyAccountDetailList2.get(i).getAmount());
|
|
|
+ }
|
|
|
+ BigDecimal data1 = new BigDecimal(businessAccountUtils.sub(totalDeposit,totalOut));
|
|
|
+ BigDecimal data2 = new BigDecimal(hlwCompanyAccount.getTotalDeposit());
|
|
|
+ //-1小于;0等于;1:大于
|
|
|
+ if (data1.compareTo(data2) != 0) {
|
|
|
+ list.add(hlwCompanyAccount);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ //比较出账(付款)
|
|
|
+ Double totalPayment=0.00;
|
|
|
+ Double totalServiceFee=0.00;
|
|
|
+ for (int j = 0; j <hlwCompanyAccountDetailList1.size() ; j++) {
|
|
|
+ //计算总付款金额
|
|
|
+ totalPayment=businessAccountUtils.add(totalPayment,hlwCompanyAccountDetailList1.get(i).getAmount());
|
|
|
+ //计算总服务费
|
|
|
+ totalServiceFee=businessAccountUtils.add(totalServiceFee,hlwCompanyAccountDetailList1.get(i).getServiceFee());
|
|
|
+
|
|
|
+ }
|
|
|
+ BigDecimal data3 = new BigDecimal(totalPayment);
|
|
|
+ BigDecimal data4 = new BigDecimal(hlwCompanyAccount.getTotalPayment());
|
|
|
+ if (data3.compareTo(data4) != 0) {
|
|
|
+ list.add(hlwCompanyAccount);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ //比较服务费
|
|
|
+ BigDecimal data5 = new BigDecimal(totalServiceFee);
|
|
|
+ BigDecimal data6 = new BigDecimal(hlwCompanyAccount.getTotalServiceFee());
|
|
|
+ if (data5.compareTo(data6) != 0) {
|
|
|
+ list.add(hlwCompanyAccount);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ Page<HlwCompanyAccount> pageList = new Page<HlwCompanyAccount>();
|
|
|
+ pageList.setRecords(list);
|
|
|
+ pageList.setTotal(list.size());
|
|
|
+ pageList.setCurrent(1);
|
|
|
+ pageList.setSize(list.size());
|
|
|
+ result.setSuccess(true);
|
|
|
+ result.setResult(pageList);
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
}
|