|
@@ -5,7 +5,9 @@ import com.alipay.sofa.runtime.api.annotation.SofaReference;
|
|
import com.baomidou.mybatisplus.mapper.EntityWrapper;
|
|
import com.baomidou.mybatisplus.mapper.EntityWrapper;
|
|
import com.baomidou.mybatisplus.plugins.Page;
|
|
import com.baomidou.mybatisplus.plugins.Page;
|
|
import com.google.common.collect.Lists;
|
|
import com.google.common.collect.Lists;
|
|
|
|
+import com.winsea.svc.base.base.entity.CommonCompany;
|
|
import com.winsea.svc.base.base.entity.CommonRoleResource;
|
|
import com.winsea.svc.base.base.entity.CommonRoleResource;
|
|
|
|
+import com.winsea.svc.base.base.service.ICommonCompanyService;
|
|
import com.winsea.svc.base.base.service.ICommonRoleResourceService;
|
|
import com.winsea.svc.base.base.service.ICommonRoleResourceService;
|
|
import com.winsea.svc.base.security.entity.User;
|
|
import com.winsea.svc.base.security.entity.User;
|
|
import com.winsea.svc.base.security.util.AuthSecurityUtils;
|
|
import com.winsea.svc.base.security.util.AuthSecurityUtils;
|
|
@@ -15,20 +17,16 @@ import com.yh.saas.plugin.yiliangyiyun.entity.*;
|
|
import com.yh.saas.plugin.yiliangyiyun.exception.YException;
|
|
import com.yh.saas.plugin.yiliangyiyun.exception.YException;
|
|
import com.yh.saas.plugin.yiliangyiyun.exception.YExceptionEnum;
|
|
import com.yh.saas.plugin.yiliangyiyun.exception.YExceptionEnum;
|
|
import com.yh.saas.plugin.yiliangyiyun.mapper.PaymentManagementMapper;
|
|
import com.yh.saas.plugin.yiliangyiyun.mapper.PaymentManagementMapper;
|
|
-import com.yh.saas.plugin.yiliangyiyun.service.INewWorkflowService;
|
|
|
|
-import com.yh.saas.plugin.yiliangyiyun.service.IPaymentManagementService;
|
|
|
|
|
|
+import com.yh.saas.plugin.yiliangyiyun.service.*;
|
|
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
|
|
-import com.yh.saas.plugin.yiliangyiyun.service.IQualityInspectionManagementService;
|
|
|
|
-import com.yh.saas.plugin.yiliangyiyun.service.IWeighingManagementService;
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.util.CollectionUtils;
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
-import java.util.ArrayList;
|
|
|
|
-import java.util.HashMap;
|
|
|
|
-import java.util.List;
|
|
|
|
-import java.util.Map;
|
|
|
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
|
+import java.util.*;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -50,6 +48,11 @@ public class PaymentManagementServiceImpl extends ServiceImpl<PaymentManagementM
|
|
private IQualityInspectionManagementService qualityInspectionManagementService;
|
|
private IQualityInspectionManagementService qualityInspectionManagementService;
|
|
@Autowired
|
|
@Autowired
|
|
private IWeighingManagementService weighingManagementService;
|
|
private IWeighingManagementService weighingManagementService;
|
|
|
|
+ @Autowired
|
|
|
|
+ private ICommonCompanyService commonCompanyService;
|
|
|
|
+ @Autowired
|
|
|
|
+ private IIdentityAuthenticationInfoService iIdentityAuthenticationInfoService;
|
|
|
|
+
|
|
|
|
|
|
/**
|
|
/**
|
|
* 付款管理列表
|
|
* 付款管理列表
|
|
@@ -72,12 +75,15 @@ public class PaymentManagementServiceImpl extends ServiceImpl<PaymentManagementM
|
|
statusSet.addAll(statusList);
|
|
statusSet.addAll(statusList);
|
|
}
|
|
}
|
|
// 公司ID
|
|
// 公司ID
|
|
- pageView.put("compId", AuthSecurityUtils.getCurrentUserInfo().getCompId());
|
|
|
|
|
|
+ pageView.put("compId", paymentManagement.getCompId());
|
|
pageView.put("searchKeyWord", paymentManagement.getSearchKeyWord());
|
|
pageView.put("searchKeyWord", paymentManagement.getSearchKeyWord());
|
|
pageView.put("searchType", paymentManagement.getSearchType());
|
|
pageView.put("searchType", paymentManagement.getSearchType());
|
|
|
|
+ pageView.put("pcFlag", paymentManagement.getPcFlag());
|
|
pageView.put("pageSize", paymentManagement.getPageSize());
|
|
pageView.put("pageSize", paymentManagement.getPageSize());
|
|
pageView.put("warehouseName",paymentManagement.getWarehouseName());
|
|
pageView.put("warehouseName",paymentManagement.getWarehouseName());
|
|
|
|
+ pageView.put("customerPhone",paymentManagement.getCustomerPhone());
|
|
pageView.put("currentPage", paymentManagement.getCurrentPage());
|
|
pageView.put("currentPage", paymentManagement.getCurrentPage());
|
|
|
|
+ pageView.put("managementType",paymentManagement.getManagementType());
|
|
pageView.put("businessKeys", businessKeys);
|
|
pageView.put("businessKeys", businessKeys);
|
|
pageView.put("statusSet", statusSet);
|
|
pageView.put("statusSet", statusSet);
|
|
// 查询服务商总数
|
|
// 查询服务商总数
|
|
@@ -85,6 +91,12 @@ public class PaymentManagementServiceImpl extends ServiceImpl<PaymentManagementM
|
|
List<PaymentManagement> dataList = baseMapper.getListByCondition(pageView);
|
|
List<PaymentManagement> dataList = baseMapper.getListByCondition(pageView);
|
|
if (!CollectionUtils.isEmpty(dataList)) {
|
|
if (!CollectionUtils.isEmpty(dataList)) {
|
|
dataList.forEach(paymentManagement1 -> {
|
|
dataList.forEach(paymentManagement1 -> {
|
|
|
|
+ CommonCompany commonCompany=commonCompanyService.selectOne(new EntityWrapper<CommonCompany>()
|
|
|
|
+ .eq("comp_id",paymentManagement1.getCompId()));
|
|
|
|
+ //公司名
|
|
|
|
+ if (commonCompany!=null){
|
|
|
|
+ paymentManagement1.setCompName(commonCompany.getCompName());
|
|
|
|
+ }
|
|
String taskId = "";
|
|
String taskId = "";
|
|
// 只有待审核状态才有taskId
|
|
// 只有待审核状态才有taskId
|
|
if (StringUtils.isNotBlank(paymentManagement1.getWorkflowId())) {
|
|
if (StringUtils.isNotBlank(paymentManagement1.getWorkflowId())) {
|
|
@@ -117,6 +129,17 @@ public class PaymentManagementServiceImpl extends ServiceImpl<PaymentManagementM
|
|
//检斤信息
|
|
//检斤信息
|
|
WeighingManagement weighingManagement = weighingManagementService.selectOne(new EntityWrapper<WeighingManagement>()
|
|
WeighingManagement weighingManagement = weighingManagementService.selectOne(new EntityWrapper<WeighingManagement>()
|
|
.eq("relation_id", paymentManagement.getRelationId()));
|
|
.eq("relation_id", paymentManagement.getRelationId()));
|
|
|
|
+ CommonCompany commonCompany=commonCompanyService.selectOne(new EntityWrapper<CommonCompany>()
|
|
|
|
+ .eq("comp_id",paymentManagement.getCompId()));
|
|
|
|
+ //公司名
|
|
|
|
+ if (commonCompany!=null){
|
|
|
|
+ paymentManagement.setCompName(commonCompany.getCompName());
|
|
|
|
+ paymentManagement.setTaxRegistrationNo(commonCompany.getCompImo());
|
|
|
|
+ }
|
|
|
|
+ IdentityAuthenticationInfo identityAuthenticationInfo=iIdentityAuthenticationInfoService.selectOne(new EntityWrapper<IdentityAuthenticationInfo>()
|
|
|
|
+ .eq("customer_name",paymentManagement.getCustomerName())
|
|
|
|
+ .eq("customer_type_flag","1"));
|
|
|
|
+ paymentManagement.setIdentityAuthenticationInfo(identityAuthenticationInfo);
|
|
paymentManagement.setQualityInspectionManagement(qualityInspectionManagement);
|
|
paymentManagement.setQualityInspectionManagement(qualityInspectionManagement);
|
|
paymentManagement.setWeighingManagement(weighingManagement);
|
|
paymentManagement.setWeighingManagement(weighingManagement);
|
|
return paymentManagement;
|
|
return paymentManagement;
|
|
@@ -128,32 +151,12 @@ public class PaymentManagementServiceImpl extends ServiceImpl<PaymentManagementM
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
@Override
|
|
@Override
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
public String editInfo(PaymentManagement paymentManagement) {
|
|
public String editInfo(PaymentManagement paymentManagement) {
|
|
PaymentManagement paymentManagement1=this.selectById(paymentManagement.getId());
|
|
PaymentManagement paymentManagement1=this.selectById(paymentManagement.getId());
|
|
|
|
+ paymentManagement.setAmountIngPayable(paymentManagement.getActualPayment());
|
|
|
|
+ this.openAuditFlow(paymentManagement1);
|
|
this.updateById(paymentManagement);
|
|
this.updateById(paymentManagement);
|
|
- boolean isStartWorkflow = org.apache.commons.lang3.StringUtils.isBlank(paymentManagement.getWorkflowId());
|
|
|
|
- // 不是退回的单子
|
|
|
|
- if (isStartWorkflow) {
|
|
|
|
- Workflow workflow = workflowService
|
|
|
|
- .findLatestWorkflowByBusinessCodeByApp(paymentManagement1.getCompId(), "PAYMENT-MANAGEMENT-APPROVE");
|
|
|
|
- // 没配置审核流程,直接结束并处理信息
|
|
|
|
- if (workflow == null) {
|
|
|
|
- throw new YException(YExceptionEnum.PURCHASE_ORDER_ERROR);
|
|
|
|
- }
|
|
|
|
- // 开启审核流
|
|
|
|
- else {
|
|
|
|
-
|
|
|
|
- // 设置状态 已提交审核
|
|
|
|
- paymentManagement1.setWorkflowId(workflow.getId());
|
|
|
|
- this.updateById(paymentManagement1);
|
|
|
|
- workflowService.startInstance(workflow.getId(), paymentManagement1.getId());
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- // 退回的单子 再启用
|
|
|
|
- else {
|
|
|
|
- this.updateById(paymentManagement1);
|
|
|
|
- workflowService.activateInstance(paymentManagement1.getWorkflowId(), paymentManagement1.getId());
|
|
|
|
- }
|
|
|
|
return "OK";
|
|
return "OK";
|
|
}
|
|
}
|
|
|
|
|
|
@@ -199,7 +202,78 @@ public class PaymentManagementServiceImpl extends ServiceImpl<PaymentManagementM
|
|
}
|
|
}
|
|
return "ok";
|
|
return "ok";
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 收款
|
|
|
|
+ * @param paymentManagement
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ @Override
|
|
|
|
+ public String collectMoney(PaymentManagement paymentManagement) {
|
|
|
|
+ List<PaymentManagement> paymentManagementList = paymentManagement.getPaymentManagementList();
|
|
|
|
+ Float money = paymentManagement.getMoney();
|
|
|
|
+ //收款多条
|
|
|
|
+ if (!CollectionUtils.isEmpty(paymentManagementList)) {
|
|
|
|
+ for (PaymentManagement paymentManagement1 : paymentManagementList) {
|
|
|
|
+ PaymentManagement paymentManagement2 = this.selectById(paymentManagement1.getId());
|
|
|
|
+ //收款金额大于本次循环未收金额
|
|
|
|
+ if (money >= paymentManagement1.getAmountNotCollectable()) {
|
|
|
|
+ money = money - paymentManagement1.getAmountNotCollectable();
|
|
|
|
+ //全部收款
|
|
|
|
+ paymentManagement1.setStatus(StatusEnum.PUR_COLLECTaLL.getName());
|
|
|
|
+ paymentManagement1.setStatusFlag(StatusEnum.PUR_COLLECTaLL.getFlag());
|
|
|
|
+ paymentManagement1.setCollectionDate(paymentManagement.getCollectionDate());
|
|
|
|
+ paymentManagement1.setCollectionScreenshot(paymentManagement2.getCollectionScreenshot() != null ? paymentManagement2.getCollectionScreenshot() + '$' + paymentManagement.getCollectionScreenshot() : paymentManagement.getCollectionScreenshot());
|
|
|
|
+ paymentManagement1.setAmountEdCollectionable(paymentManagement1.getAmountEdCollectionable() + paymentManagement1.getAmountNotCollectable());
|
|
|
|
+ paymentManagement1.setAmountNotCollectable(0.0f);
|
|
|
|
+ this.updateById(paymentManagement1);
|
|
|
|
+ } else if (money > 0) {
|
|
|
|
+ Float moneyTmp = money - paymentManagement1.getAmountNotCollectable();
|
|
|
|
+ //部分收款
|
|
|
|
+ paymentManagement1.setStatus(StatusEnum.PUR_COLLECT.getName());
|
|
|
|
+ paymentManagement1.setStatusFlag(StatusEnum.PUR_COLLECT.getFlag());
|
|
|
|
+ paymentManagement1.setCollectionDate(paymentManagement.getCollectionDate());
|
|
|
|
+ paymentManagement1.setCollectionScreenshot(paymentManagement2.getCollectionScreenshot() != null ? paymentManagement2.getCollectionScreenshot() + '$' + paymentManagement.getCollectionScreenshot() : paymentManagement.getCollectionScreenshot());
|
|
|
|
+ paymentManagement1.setAmountEdCollectionable(paymentManagement1.getAmountEdCollectionable() + money);
|
|
|
|
+ paymentManagement1.setAmountNotCollectable(paymentManagement1.getAmountNotCollectable() - money);
|
|
|
|
+ this.updateById(paymentManagement1);
|
|
|
|
+ money = moneyTmp;
|
|
|
|
+ } else {
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return "OK";
|
|
|
|
+ }
|
|
|
|
+ /**
|
|
|
|
+ * 添加备注
|
|
|
|
+ * @param paymentManagement
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ @Override
|
|
|
|
+ public String addRemarks(PaymentManagement paymentManagement) {
|
|
|
|
+ List<PaymentManagement> paymentManagementList = paymentManagement.getPaymentManagementList();
|
|
|
|
+ if (!CollectionUtils.isEmpty(paymentManagementList)) {
|
|
|
|
+ for (PaymentManagement paymentManagement1 : paymentManagementList) {
|
|
|
|
+ paymentManagement1.setRemarks(paymentManagement.getRemarks());
|
|
|
|
+ this.updateById(paymentManagement1);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return "OK";
|
|
|
|
+ }
|
|
|
|
+ /**
|
|
|
|
+ * 编辑应收
|
|
|
|
+ * @param paymentManagement
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ @Override
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
|
+ public String editCollect(PaymentManagement paymentManagement) {
|
|
|
|
+ boolean one = this.updateById(paymentManagement);
|
|
|
|
+ if(one){
|
|
|
|
+ return "OK";
|
|
|
|
+ }
|
|
|
|
+ return "NG";
|
|
|
|
+ }
|
|
/**
|
|
/**
|
|
* 删除
|
|
* 删除
|
|
* @param id
|
|
* @param id
|
|
@@ -224,20 +298,28 @@ public class PaymentManagementServiceImpl extends ServiceImpl<PaymentManagementM
|
|
@Override
|
|
@Override
|
|
public Float cumulant(PaymentManagement paymentManagement) {
|
|
public Float cumulant(PaymentManagement paymentManagement) {
|
|
Float cumulant=0.0f;
|
|
Float cumulant=0.0f;
|
|
|
|
+ //本年第一天零点
|
|
|
|
+ SimpleDateFormat now = new SimpleDateFormat("yyyy-01-01 00:00:00");
|
|
|
|
+ Calendar c = Calendar.getInstance();
|
|
|
|
+ c.setTime(new Date());
|
|
|
|
+ c.add(Calendar.YEAR, 0);
|
|
|
|
+ Date y = c.getTime();
|
|
|
|
+ String year = now.format(y);
|
|
List<PaymentManagement> paymentManagementList = this.selectList(new EntityWrapper<PaymentManagement>()
|
|
List<PaymentManagement> paymentManagementList = this.selectList(new EntityWrapper<PaymentManagement>()
|
|
.eq("goods_name",paymentManagement.getGoodsName())
|
|
.eq("goods_name",paymentManagement.getGoodsName())
|
|
.eq("customer_name",paymentManagement.getCustomerName())
|
|
.eq("customer_name",paymentManagement.getCustomerName())
|
|
- .eq("comp_id",paymentManagement.getCompId()));
|
|
|
|
|
|
+ .eq("comp_id",paymentManagement.getCompId())
|
|
|
|
+ .ge("create_date",year));
|
|
if (!CollectionUtils.isEmpty(paymentManagementList)){
|
|
if (!CollectionUtils.isEmpty(paymentManagementList)){
|
|
Float netWeight = 0f;
|
|
Float netWeight = 0f;
|
|
for (PaymentManagement paymentManagement1:paymentManagementList){
|
|
for (PaymentManagement paymentManagement1:paymentManagementList){
|
|
//干粮净重
|
|
//干粮净重
|
|
if ("干粮".equals(paymentManagement1.getType())){
|
|
if ("干粮".equals(paymentManagement1.getType())){
|
|
- netWeight=paymentManagement1.getNetWeight();
|
|
|
|
|
|
+ netWeight=netWeight+(paymentManagement1.getNetWeight()!=null?paymentManagement1.getNetWeight():0f);
|
|
}
|
|
}
|
|
//潮粮纯重
|
|
//潮粮纯重
|
|
- else {
|
|
|
|
- netWeight=paymentManagement1.getPureWeight();
|
|
|
|
|
|
+ else if("潮粮".equals(paymentManagement1.getType())){
|
|
|
|
+ netWeight=netWeight+(paymentManagement1.getPureWeight()!=null?paymentManagement1.getPureWeight():0f);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
cumulant=cumulant+netWeight;
|
|
cumulant=cumulant+netWeight;
|
|
@@ -245,6 +327,35 @@ public class PaymentManagementServiceImpl extends ServiceImpl<PaymentManagementM
|
|
return cumulant;
|
|
return cumulant;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public String openAuditFlow(PaymentManagement paymentManagement1) {
|
|
|
|
+ PaymentManagement paymentManagement = this.selectById(paymentManagement1.getId());
|
|
|
|
+ boolean isStartWorkflow = org.apache.commons.lang3.StringUtils.isBlank(paymentManagement.getWorkflowId());
|
|
|
|
+ // 不是退回的单子
|
|
|
|
+ if (isStartWorkflow) {
|
|
|
|
+ Workflow workflow = workflowService
|
|
|
|
+ .findLatestWorkflowByBusinessCodeByApp(paymentManagement.getCompId(), "PAYMENT-MANAGEMENT-APPROVE");
|
|
|
|
+ // 没配置审核流程,直接结束并处理信息
|
|
|
|
+ if (workflow == null) {
|
|
|
|
+ throw new YException(YExceptionEnum.PURCHASE_ORDER_ERROR);
|
|
|
|
+ }
|
|
|
|
+ // 开启审核流
|
|
|
|
+ else {
|
|
|
|
+
|
|
|
|
+ // 设置状态 已提交审核
|
|
|
|
+ paymentManagement.setWorkflowId(workflow.getId());
|
|
|
|
+ this.updateById(paymentManagement);
|
|
|
|
+ workflowService.startInstance(workflow.getId(), paymentManagement.getId());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ // 退回的单子 再启用
|
|
|
|
+ else {
|
|
|
|
+ this.updateById(paymentManagement);
|
|
|
|
+ workflowService.activateInstance(paymentManagement.getWorkflowId(), paymentManagement.getId());
|
|
|
|
+ }
|
|
|
|
+ return "OK";
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
|
|
private List<String> getResourceIdList() {
|
|
private List<String> getResourceIdList() {
|
|
User currentUser = AuthSecurityUtils.getCurrentUserInfo();
|
|
User currentUser = AuthSecurityUtils.getCurrentUserInfo();
|