|
@@ -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;
|
|
@@ -23,12 +25,11 @@ 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 +51,8 @@ public class PaymentManagementServiceImpl extends ServiceImpl<PaymentManagementM
|
|
private IQualityInspectionManagementService qualityInspectionManagementService;
|
|
private IQualityInspectionManagementService qualityInspectionManagementService;
|
|
@Autowired
|
|
@Autowired
|
|
private IWeighingManagementService weighingManagementService;
|
|
private IWeighingManagementService weighingManagementService;
|
|
|
|
+ @Autowired
|
|
|
|
+ private ICommonCompanyService commonCompanyService;
|
|
|
|
|
|
/**
|
|
/**
|
|
* 付款管理列表
|
|
* 付款管理列表
|
|
@@ -117,6 +120,12 @@ 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",qualityInspectionManagement.getCompId()));
|
|
|
|
+ //公司名
|
|
|
|
+ if (commonCompany!=null){
|
|
|
|
+ paymentManagement.setCompName(commonCompany.getCompName());
|
|
|
|
+ }
|
|
paymentManagement.setQualityInspectionManagement(qualityInspectionManagement);
|
|
paymentManagement.setQualityInspectionManagement(qualityInspectionManagement);
|
|
paymentManagement.setWeighingManagement(weighingManagement);
|
|
paymentManagement.setWeighingManagement(weighingManagement);
|
|
return paymentManagement;
|
|
return paymentManagement;
|
|
@@ -128,32 +137,11 @@ 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());
|
|
|
|
+ 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";
|
|
}
|
|
}
|
|
|
|
|
|
@@ -224,20 +212,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 +241,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();
|