|
@@ -2,6 +2,7 @@ package com.yh.saas.plugin.yiliangyiyun.service.impl;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.alipay.sofa.runtime.api.annotation.SofaReference;
|
|
|
+import com.alipay.sofa.runtime.api.annotation.SofaService;
|
|
|
import com.baomidou.mybatisplus.mapper.EntityWrapper;
|
|
|
import com.baomidou.mybatisplus.plugins.Page;
|
|
|
import com.google.common.collect.Lists;
|
|
@@ -11,6 +12,7 @@ import com.winsea.svc.base.base.entity.CommonStaff;
|
|
|
import com.winsea.svc.base.base.service.ICommonCompanyService;
|
|
|
import com.winsea.svc.base.base.service.ICommonRoleResourceService;
|
|
|
import com.winsea.svc.base.base.service.ICommonStaffService;
|
|
|
+import com.winsea.svc.base.base.util.DateUtils;
|
|
|
import com.winsea.svc.base.security.entity.User;
|
|
|
import com.winsea.svc.base.security.util.AuthSecurityUtils;
|
|
|
import com.winsea.svc.base.workflow.entity.Workflow;
|
|
@@ -22,12 +24,24 @@ import com.yh.saas.plugin.yiliangyiyun.exception.YExceptionEnum;
|
|
|
import com.yh.saas.plugin.yiliangyiyun.mapper.PaymentManagementMapper;
|
|
|
import com.yh.saas.plugin.yiliangyiyun.service.*;
|
|
|
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.apache.commons.httpclient.util.DateUtil;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.apache.poi.hssf.usermodel.*;
|
|
|
+import org.apache.poi.ss.usermodel.IndexedColors;
|
|
|
+import org.apache.poi.ss.usermodel.Workbook;
|
|
|
+import org.apache.poi.ss.util.CellRangeAddress;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
+import java.io.ByteArrayOutputStream;
|
|
|
+import java.io.File;
|
|
|
+import java.io.IOException;
|
|
|
+import java.net.URLDecoder;
|
|
|
import java.text.DecimalFormat;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
@@ -41,7 +55,8 @@ import java.util.stream.Collectors;
|
|
|
* @author Gdc
|
|
|
* @since 2021-09-06
|
|
|
*/
|
|
|
-@Service
|
|
|
+@SofaService
|
|
|
+@Slf4j
|
|
|
public class PaymentManagementServiceImpl extends ServiceImpl<PaymentManagementMapper, PaymentManagement> implements IPaymentManagementService {
|
|
|
|
|
|
@Autowired
|
|
@@ -80,8 +95,11 @@ public class PaymentManagementServiceImpl extends ServiceImpl<PaymentManagementM
|
|
|
private IPurchasePriceDetailService purchasePriceDetailService;
|
|
|
@Autowired
|
|
|
private IPurchasePriceService purchasePriceService;
|
|
|
+ @Value("${file-root-path}")
|
|
|
+ private String localPath;
|
|
|
/**
|
|
|
* 付款管理列表
|
|
|
+ *
|
|
|
* @param paymentManagement
|
|
|
* @return
|
|
|
*/
|
|
@@ -106,11 +124,11 @@ public class PaymentManagementServiceImpl extends ServiceImpl<PaymentManagementM
|
|
|
pageView.put("searchType", paymentManagement.getSearchType());
|
|
|
pageView.put("pcFlag", paymentManagement.getPcFlag());
|
|
|
pageView.put("pageSize", paymentManagement.getPageSize());
|
|
|
- pageView.put("warehouseName",paymentManagement.getWarehouseName());
|
|
|
- pageView.put("customerPhone",paymentManagement.getCustomerPhone());
|
|
|
+ pageView.put("warehouseName", paymentManagement.getWarehouseName());
|
|
|
+ pageView.put("customerPhone", paymentManagement.getCustomerPhone());
|
|
|
pageView.put("contractNo", paymentManagement.getContractNo());
|
|
|
pageView.put("currentPage", paymentManagement.getCurrentPage());
|
|
|
- pageView.put("managementType",paymentManagement.getManagementType());
|
|
|
+ pageView.put("managementType", paymentManagement.getManagementType());
|
|
|
pageView.put("businessKeys", businessKeys);
|
|
|
pageView.put("statusSet", statusSet);
|
|
|
// 查询服务商总数
|
|
@@ -118,32 +136,30 @@ public class PaymentManagementServiceImpl extends ServiceImpl<PaymentManagementM
|
|
|
List<PaymentManagement> dataList = baseMapper.getListByCondition(pageView);
|
|
|
if (!CollectionUtils.isEmpty(dataList)) {
|
|
|
dataList.forEach(paymentManagement1 -> {
|
|
|
- CommonCompany commonCompany=commonCompanyService.selectOne(new EntityWrapper<CommonCompany>()
|
|
|
- .eq("comp_id",paymentManagement1.getCompId()));
|
|
|
+ CommonCompany commonCompany = commonCompanyService.selectOne(new EntityWrapper<CommonCompany>()
|
|
|
+ .eq("comp_id", paymentManagement1.getCompId()));
|
|
|
//公司名
|
|
|
- if (commonCompany!=null){
|
|
|
+ if (commonCompany != null) {
|
|
|
paymentManagement1.setCompName(commonCompany.getCompName());
|
|
|
}
|
|
|
- IdentityAuthenticationInfo identityAuthenticationInfo=iIdentityAuthenticationInfoService.selectOne(new EntityWrapper<IdentityAuthenticationInfo>()
|
|
|
- .eq("customer_name",paymentManagement1.getCustomerName())
|
|
|
- .eq("customer_phone",paymentManagement1.getCustomerPhone())
|
|
|
- .eq("cover","0")
|
|
|
- .eq("customer_type_flag","1"));
|
|
|
- if (identityAuthenticationInfo!=null){
|
|
|
+ IdentityAuthenticationInfo identityAuthenticationInfo = iIdentityAuthenticationInfoService.selectOne(new EntityWrapper<IdentityAuthenticationInfo>()
|
|
|
+ .eq("customer_name", paymentManagement1.getCustomerName())
|
|
|
+ .eq("customer_phone", paymentManagement1.getCustomerPhone())
|
|
|
+ .eq("cover", "0")
|
|
|
+ .eq("customer_type_flag", "1"));
|
|
|
+ if (identityAuthenticationInfo != null) {
|
|
|
paymentManagement1.setIdentityAuthenticationInfo(identityAuthenticationInfo);
|
|
|
}
|
|
|
WeighingManagement weighingManagement = weighingManagementService.selectOne(new EntityWrapper<WeighingManagement>()
|
|
|
- .eq("relation_id", paymentManagement1.getRelationId())
|
|
|
- .eq("comp_id", paymentManagement1.getCompId()));
|
|
|
- if (weighingManagement!=null){
|
|
|
+ .eq("relation_id", paymentManagement1.getRelationId()));
|
|
|
+ if (weighingManagement != null) {
|
|
|
paymentManagement1.setContractPrice(weighingManagement.getContractPrice());
|
|
|
paymentManagement1.setWeighingPictureAddress(weighingManagement.getPictureAddress());
|
|
|
paymentManagement1.setWeighingManagement(weighingManagement);
|
|
|
}
|
|
|
QualityInspectionManagement qualityInspectionManagement = qualityInspectionManagementService.selectOne(new EntityWrapper<QualityInspectionManagement>()
|
|
|
- .eq("relation_id", paymentManagement1.getRelationId())
|
|
|
- .eq("comp_id", paymentManagement1.getCompId()));
|
|
|
- if (qualityInspectionManagement!=null){
|
|
|
+ .eq("relation_id", paymentManagement1.getRelationId()));
|
|
|
+ if (qualityInspectionManagement != null) {
|
|
|
paymentManagement1.setQualityInspectionPictureAddress(qualityInspectionManagement.getPictureAddress());
|
|
|
paymentManagement1.setQualityInspectionManagement(qualityInspectionManagement);
|
|
|
}
|
|
@@ -167,66 +183,63 @@ public class PaymentManagementServiceImpl extends ServiceImpl<PaymentManagementM
|
|
|
|
|
|
/**
|
|
|
* 查看
|
|
|
+ *
|
|
|
* @param id
|
|
|
* @return
|
|
|
*/
|
|
|
@Override
|
|
|
public PaymentManagement getInfo(String id) {
|
|
|
- PaymentManagement paymentManagement=this.selectById(id);
|
|
|
+ PaymentManagement paymentManagement = this.selectById(id);
|
|
|
//质检信息
|
|
|
QualityInspectionManagement qualityInspectionManagement = qualityInspectionManagementService.selectOne(new EntityWrapper<QualityInspectionManagement>()
|
|
|
- .eq("relation_id", paymentManagement.getRelationId())
|
|
|
- .eq("comp_id", paymentManagement.getCompId()));
|
|
|
+ .eq("relation_id", paymentManagement.getRelationId()));
|
|
|
//检斤信息
|
|
|
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()));
|
|
|
- CommonCompany commonCompany=commonCompanyService.selectOne(new EntityWrapper<CommonCompany>()
|
|
|
- .eq("comp_id",paymentManagement.getCompId()));
|
|
|
//公司名
|
|
|
- if (commonCompany!=null){
|
|
|
+ if (commonCompany != null) {
|
|
|
paymentManagement.setCompName(commonCompany.getCompName());
|
|
|
paymentManagement.setTaxRegistrationNo(commonCompany.getCompImo());
|
|
|
}
|
|
|
- PurchasePrice purchasePrice=purchasePriceService.selectOne(new EntityWrapper<PurchasePrice>()
|
|
|
- .eq("warehouse_name",qualityInspectionManagement.getWarehouseName())
|
|
|
- .eq("goods_name",qualityInspectionManagement.getGoodsName())
|
|
|
- .eq("status_flag","3"));
|
|
|
- if (purchasePrice!=null){
|
|
|
- if(purchasePrice.getParamType().equals("1")){
|
|
|
+ PurchasePrice purchasePrice = purchasePriceService.selectOne(new EntityWrapper<PurchasePrice>()
|
|
|
+ .eq("warehouse_name", qualityInspectionManagement.getWarehouseName())
|
|
|
+ .eq("goods_name", qualityInspectionManagement.getGoodsName())
|
|
|
+ .eq("status_flag", "3"));
|
|
|
+ if (purchasePrice != null) {
|
|
|
+ if (purchasePrice.getParamType().equals("1")) {
|
|
|
PurchasePriceDetail purchasePriceDetail = purchasePriceDetailService.selectOne(new EntityWrapper<PurchasePriceDetail>()
|
|
|
- .eq("main_id",purchasePrice.getId())
|
|
|
- .like("level",qualityInspectionManagement.getGrade().replace("品",""))
|
|
|
- .eq("delete_flag","0"));
|
|
|
+ .eq("main_id", purchasePrice.getId())
|
|
|
+ .like("level", qualityInspectionManagement.getGrade().replace("品", ""))
|
|
|
+ .eq("delete_flag", "0"));
|
|
|
String[] point = purchasePriceDetail.getPoint().split(",");
|
|
|
String[] pointPrice = purchasePriceDetail.getPointPrice().split(",");
|
|
|
Float param = 0f;
|
|
|
- for(int i=0;i<point.length - 1;i++){
|
|
|
- if(Float.parseFloat(qualityInspectionManagement.getWaterContent()) >= Float.parseFloat(point[i])
|
|
|
- &&Float.parseFloat(qualityInspectionManagement.getWaterContent()) < Float.parseFloat(point[i+1])){
|
|
|
- param += (Float.parseFloat(qualityInspectionManagement.getWaterContent()) - Float.parseFloat(point[i]))*Float.parseFloat(pointPrice[i]);
|
|
|
+ for (int i = 0; i < point.length - 1; i++) {
|
|
|
+ if (Float.parseFloat(qualityInspectionManagement.getWaterContent()) >= Float.parseFloat(point[i])
|
|
|
+ && Float.parseFloat(qualityInspectionManagement.getWaterContent()) < Float.parseFloat(point[i + 1])) {
|
|
|
+ param += (Float.parseFloat(qualityInspectionManagement.getWaterContent()) - Float.parseFloat(point[i])) * Float.parseFloat(pointPrice[i]);
|
|
|
break;
|
|
|
- }
|
|
|
- else{
|
|
|
- param += (Float.parseFloat(point[i+1]) - Float.parseFloat(point[i]))*Float.parseFloat(pointPrice[i]);
|
|
|
+ } else {
|
|
|
+ param += (Float.parseFloat(point[i + 1]) - Float.parseFloat(point[i])) * Float.parseFloat(pointPrice[i]);
|
|
|
}
|
|
|
}
|
|
|
param += qualityInspectionManagement.getBuckleMiscellaneous();
|
|
|
DecimalFormat df = new DecimalFormat("#.00");
|
|
|
param = Float.parseFloat(df.format(param));
|
|
|
- paymentManagement.setParam(param );
|
|
|
+ paymentManagement.setParam(param);
|
|
|
paymentManagement.setWeightDeduction(param);
|
|
|
- }
|
|
|
- else{
|
|
|
+ } else {
|
|
|
paymentManagement.setWeightDeduction(weighingManagement.getBuckleMiscellaneous());
|
|
|
}
|
|
|
qualityInspectionManagement.setWaterMin(purchasePrice.getWaterMin());
|
|
|
}
|
|
|
- IdentityAuthenticationInfo identityAuthenticationInfo=iIdentityAuthenticationInfoService.selectOne(new EntityWrapper<IdentityAuthenticationInfo>()
|
|
|
- .eq("customer_name",paymentManagement.getCustomerName())
|
|
|
- .eq("customer_phone",paymentManagement.getCustomerPhone())
|
|
|
- .eq("cover","0")
|
|
|
- .eq("customer_type_flag","1"));
|
|
|
+ IdentityAuthenticationInfo identityAuthenticationInfo = iIdentityAuthenticationInfoService.selectOne(new EntityWrapper<IdentityAuthenticationInfo>()
|
|
|
+ .eq("customer_name", paymentManagement.getCustomerName())
|
|
|
+ .eq("customer_phone", paymentManagement.getCustomerPhone())
|
|
|
+ .eq("cover", "0")
|
|
|
+ .eq("customer_type_flag", "1"));
|
|
|
paymentManagement.setIdentityAuthenticationInfo(identityAuthenticationInfo);
|
|
|
paymentManagement.setQualityInspectionManagement(qualityInspectionManagement);
|
|
|
paymentManagement.setWeighingManagement(weighingManagement);
|
|
@@ -235,24 +248,24 @@ public class PaymentManagementServiceImpl extends ServiceImpl<PaymentManagementM
|
|
|
|
|
|
/**
|
|
|
* 结算
|
|
|
+ *
|
|
|
* @param paymentManagement
|
|
|
* @return
|
|
|
*/
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public String editInfo(PaymentManagement paymentManagement) {
|
|
|
- PaymentManagement paymentManagement1=this.selectById(paymentManagement.getId());
|
|
|
+ PaymentManagement paymentManagement1 = this.selectById(paymentManagement.getId());
|
|
|
//未付
|
|
|
- paymentManagement.setAmountNotPayable(paymentManagement.getAmountIngPayable()-paymentManagement1.getAmountEdPayable());
|
|
|
+ paymentManagement.setAmountNotPayable(paymentManagement.getAmountIngPayable() - paymentManagement1.getAmountEdPayable());
|
|
|
this.openAuditFlow(paymentManagement1);
|
|
|
//查询关联流转记录
|
|
|
QualityInspectionManagement qualityInspectionManagement = qualityInspectionManagementService.selectOne(new EntityWrapper<QualityInspectionManagement>()
|
|
|
- .eq("relation_id",paymentManagement1.getRelationId())
|
|
|
- .eq("comp_id", paymentManagement1.getCompId()));
|
|
|
+ .eq("relation_id", paymentManagement1.getRelationId()));
|
|
|
WarehouseInOutInfo warehouseInOutInfo1 = new WarehouseInOutInfo();
|
|
|
WarehouseBaseInfo warehouseBaseInfo = warehouseBaseInfoService.selectOne(new EntityWrapper<WarehouseBaseInfo>()
|
|
|
- .eq("warehouse_name",paymentManagement1.getWarehouseName())
|
|
|
- .eq("comp_id",qualityInspectionManagement.getCompId()));
|
|
|
+ .eq("warehouse_name", paymentManagement1.getWarehouseName())
|
|
|
+ .eq("comp_id", qualityInspectionManagement.getCompId()));
|
|
|
//生成流转信息
|
|
|
warehouseInOutInfo1.setId(IdGenerator.generateUUID());
|
|
|
warehouseInOutInfo1.setWarehouseName(paymentManagement1.getWarehouseName());
|
|
@@ -260,12 +273,12 @@ public class PaymentManagementServiceImpl extends ServiceImpl<PaymentManagementM
|
|
|
warehouseInOutInfo1.setBaseId(warehouseBaseInfo.getId());
|
|
|
//查到仓位编号
|
|
|
WarehousePositionInfo warehousePositionInfo = warehousePositionInfoService.selectOne(new EntityWrapper<WarehousePositionInfo>()
|
|
|
- .eq("base_id",warehouseBaseInfo.getId())
|
|
|
- .eq("bin_number",qualityInspectionManagement.getBinNumber()));
|
|
|
+ .eq("base_id", warehouseBaseInfo.getId())
|
|
|
+ .eq("bin_number", qualityInspectionManagement.getBinNumber()));
|
|
|
warehouseInOutInfo1.setPositionId(warehousePositionInfo.getId());
|
|
|
warehouseInOutInfo1.setBinNumber(qualityInspectionManagement.getBinNumber());
|
|
|
warehouseInOutInfo1.setGoodsName(paymentManagement1.getGoodsName());
|
|
|
- CommonSysParameter commonSysParameter = iCommonSysParameterService.selectOne(new EntityWrapper<CommonSysParameter>().eq("const_id","CON2").eq("const_value",paymentManagement1.getGoodsName()));
|
|
|
+ CommonSysParameter commonSysParameter = iCommonSysParameterService.selectOne(new EntityWrapper<CommonSysParameter>().eq("const_id", "CON2").eq("const_value", paymentManagement1.getGoodsName()));
|
|
|
warehouseInOutInfo1.setGoodsNameKey(commonSysParameter.getConstKey());
|
|
|
warehouseInOutInfo1.setGrossWeight(paymentManagement1.getGrossWeight());
|
|
|
warehouseInOutInfo1.setTare(paymentManagement1.getTare());
|
|
@@ -277,11 +290,11 @@ public class PaymentManagementServiceImpl extends ServiceImpl<PaymentManagementM
|
|
|
warehouseInOutInfo1.setInOutDate(new Date());
|
|
|
warehouseInOutInfo1.setGrade(qualityInspectionManagement.getGrade());
|
|
|
//潮粮取纯重,干粮取净重
|
|
|
- if("潮粮".equals(paymentManagement1.getType())){
|
|
|
- warehouseInOutInfo1.setPureWeight(paymentManagement.getPureWeight()/1000);
|
|
|
- warehouseInOutInfo1.setNetWeight(paymentManagement.getPureWeight()/1000);
|
|
|
- }else{
|
|
|
- warehouseInOutInfo1.setNetWeight(paymentManagement.getNetWeight()/1000);
|
|
|
+ if ("潮粮".equals(paymentManagement1.getType())) {
|
|
|
+ warehouseInOutInfo1.setPureWeight(paymentManagement.getPureWeight() / 1000);
|
|
|
+ warehouseInOutInfo1.setNetWeight(paymentManagement.getPureWeight() / 1000);
|
|
|
+ } else {
|
|
|
+ warehouseInOutInfo1.setNetWeight(paymentManagement.getNetWeight() / 1000);
|
|
|
}
|
|
|
warehouseInOutInfo1.setStatusFlag("3");
|
|
|
warehouseInOutInfoService.insert(warehouseInOutInfo1);
|
|
@@ -295,18 +308,18 @@ public class PaymentManagementServiceImpl extends ServiceImpl<PaymentManagementM
|
|
|
if (warehousePositionStorageInfo != null) {
|
|
|
original = warehousePositionStorageInfo.getStorage();
|
|
|
// 更新库存量
|
|
|
- warehousePositionStorageInfo.setStorage(warehousePositionStorageInfo.getStorage() + warehouseInOutInfo1.getNetWeight()/1000);
|
|
|
+ warehousePositionStorageInfo.setStorage(warehousePositionStorageInfo.getStorage() + warehouseInOutInfo1.getNetWeight() / 1000);
|
|
|
warehousePositionStorageInfoService.updateById(warehousePositionStorageInfo);
|
|
|
}
|
|
|
// 没有货
|
|
|
else {
|
|
|
- original=0f;
|
|
|
+ original = 0f;
|
|
|
WarehousePositionStorageInfo warehousePositionStorageInfo1 = new WarehousePositionStorageInfo();
|
|
|
warehousePositionStorageInfo1.setId(IdGenerator.generateUUID());
|
|
|
warehousePositionStorageInfo1.setPositionId(warehouseInOutInfo1.getPositionId());
|
|
|
warehousePositionStorageInfo1.setBinNumber(warehouseInOutInfo1.getBinNumber());
|
|
|
warehousePositionStorageInfo1.setGoodsName(warehouseInOutInfo1.getGoodsName());
|
|
|
- warehousePositionStorageInfo1.setStorage(warehouseInOutInfo1.getNetWeight()/1000);
|
|
|
+ warehousePositionStorageInfo1.setStorage(warehouseInOutInfo1.getNetWeight() / 1000);
|
|
|
warehousePositionStorageInfoService.insert(warehousePositionStorageInfo1);
|
|
|
}
|
|
|
WarehouseInOutDetail warehouseInOutDetail = new WarehouseInOutDetail();
|
|
@@ -330,7 +343,7 @@ public class PaymentManagementServiceImpl extends ServiceImpl<PaymentManagementM
|
|
|
weightedDetails.setGrainType(warehouseInOutInfo1.getType());
|
|
|
weightedDetails.setInTypeKey(warehouseInOutInfo1.getInOutTypeKey());
|
|
|
weightedDetails.setInType(warehouseInOutInfo1.getInOutType());
|
|
|
- weightedDetails.setNetWeight(warehouseInOutInfo1.getNetWeight()/1000);
|
|
|
+ weightedDetails.setNetWeight(warehouseInOutInfo1.getNetWeight() / 1000);
|
|
|
weightedDetails.setPureWeight(warehouseInOutInfo1.getPureWeight());
|
|
|
weightedDetails.setUnitPrice(warehouseInOutInfo1.getCost());
|
|
|
weightedDetails.setDeductionAmount(warehouseInOutInfo1.getDeductionAmount());
|
|
@@ -345,7 +358,7 @@ public class PaymentManagementServiceImpl extends ServiceImpl<PaymentManagementM
|
|
|
weightedDetails.setCostBefore(weightedDetailsList.get(0).getCostBefore());
|
|
|
}
|
|
|
// 计算新加权成本
|
|
|
- Float newCost = (paymentManagement.getActualPayment() + original * weightedDetails.getCostBefore()) / (warehouseInOutInfo1.getNetWeight()/1000 + original);
|
|
|
+ Float newCost = (paymentManagement.getActualPayment() + original * weightedDetails.getCostBefore()) / (warehouseInOutInfo1.getNetWeight() / 1000 + original);
|
|
|
|
|
|
weightedDetails.setCostAfter(newCost);
|
|
|
|
|
@@ -368,8 +381,8 @@ public class PaymentManagementServiceImpl extends ServiceImpl<PaymentManagementM
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- if(costManagementInfo ==null){
|
|
|
- CostManagementInfo costManagementInfo1= new CostManagementInfo();
|
|
|
+ if (costManagementInfo == null) {
|
|
|
+ CostManagementInfo costManagementInfo1 = new CostManagementInfo();
|
|
|
costManagementInfo1.setCompId(AuthSecurityUtils.getCurrentUserInfo().getCompId());
|
|
|
costManagementInfo1.setId(IdGenerator.generateUUID());
|
|
|
costManagementInfo1.setWarehouseId(weightedDetails.getWarehouseId());
|
|
@@ -381,8 +394,7 @@ public class PaymentManagementServiceImpl extends ServiceImpl<PaymentManagementM
|
|
|
costManagementInfo1.setStorage(net);
|
|
|
costManagementInfo1.setCost(weightedDetails.getCostAfter());
|
|
|
costManagementInfoService.insert(costManagementInfo1);
|
|
|
- }
|
|
|
- else{
|
|
|
+ } else {
|
|
|
costManagementInfo.setCost(weightedDetails.getCostAfter());
|
|
|
costManagementInfo.setStorage(net);
|
|
|
costManagementInfoService.updateById(costManagementInfo);
|
|
@@ -394,6 +406,7 @@ public class PaymentManagementServiceImpl extends ServiceImpl<PaymentManagementM
|
|
|
|
|
|
/**
|
|
|
* 付款
|
|
|
+ *
|
|
|
* @param paymentManagement
|
|
|
* @return
|
|
|
*/
|
|
@@ -436,8 +449,10 @@ public class PaymentManagementServiceImpl extends ServiceImpl<PaymentManagementM
|
|
|
}
|
|
|
return "ok";
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
* 收款
|
|
|
+ *
|
|
|
* @param paymentManagement
|
|
|
* @return
|
|
|
*/
|
|
@@ -478,6 +493,7 @@ public class PaymentManagementServiceImpl extends ServiceImpl<PaymentManagementM
|
|
|
}
|
|
|
return "OK";
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
* 合同编号下拉列表
|
|
|
*
|
|
@@ -504,7 +520,7 @@ public class PaymentManagementServiceImpl extends ServiceImpl<PaymentManagementM
|
|
|
collectMoney = collectMoney + paymentManagement.getAmountNotCollectable();
|
|
|
}
|
|
|
//有未付/未收金额
|
|
|
- if ( collectMoney > 0) {
|
|
|
+ if (collectMoney > 0) {
|
|
|
contractManagementInfo.setListStatus("待付款");
|
|
|
} else {
|
|
|
contractManagementInfo.setListStatus("已付款");
|
|
@@ -513,8 +529,10 @@ public class PaymentManagementServiceImpl extends ServiceImpl<PaymentManagementM
|
|
|
}
|
|
|
return contractManagementInfoList;
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
* 添加备注
|
|
|
+ *
|
|
|
* @param paymentManagement
|
|
|
* @return
|
|
|
*/
|
|
@@ -524,10 +542,10 @@ public class PaymentManagementServiceImpl extends ServiceImpl<PaymentManagementM
|
|
|
if (!CollectionUtils.isEmpty(paymentManagementList)) {
|
|
|
for (PaymentManagement paymentManagement1 : paymentManagementList) {
|
|
|
//关联的合同号加备注信息
|
|
|
- ContractManagementInfo contractManagementInfo=ContractManagementInfoService.selectOne(new EntityWrapper<ContractManagementInfo>()
|
|
|
- .eq("contract_no",paymentManagement1.getContractNo())
|
|
|
- .eq("comp_id",paymentManagement1.getCompId()));
|
|
|
- if (contractManagementInfo!=null){
|
|
|
+ ContractManagementInfo contractManagementInfo = ContractManagementInfoService.selectOne(new EntityWrapper<ContractManagementInfo>()
|
|
|
+ .eq("contract_no", paymentManagement1.getContractNo())
|
|
|
+ .eq("comp_id", paymentManagement1.getCompId()));
|
|
|
+ if (contractManagementInfo != null) {
|
|
|
contractManagementInfo.setRemarks(paymentManagement.getRemarks());
|
|
|
ContractManagementInfoService.updateById(contractManagementInfo);
|
|
|
}
|
|
@@ -537,37 +555,39 @@ public class PaymentManagementServiceImpl extends ServiceImpl<PaymentManagementM
|
|
|
}
|
|
|
return "OK";
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
* 编辑应收
|
|
|
+ *
|
|
|
* @param paymentManagement
|
|
|
* @return
|
|
|
*/
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public String editCollect(PaymentManagement paymentManagement) {
|
|
|
- boolean one = this.updateById(paymentManagement);
|
|
|
- if(one){
|
|
|
+ boolean one = this.updateById(paymentManagement);
|
|
|
+ if (one) {
|
|
|
return "OK";
|
|
|
}
|
|
|
return "NG";
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
* 删除
|
|
|
+ *
|
|
|
* @param id
|
|
|
*/
|
|
|
@Override
|
|
|
public void deleteInfo(String id) {
|
|
|
- PaymentManagement paymentManagement=this.selectById(id);
|
|
|
- if(paymentManagement!=null){
|
|
|
+ PaymentManagement paymentManagement = this.selectById(id);
|
|
|
+ if (paymentManagement != null) {
|
|
|
this.deleteById(paymentManagement.getId());
|
|
|
//质检信息
|
|
|
QualityInspectionManagement qualityInspectionManagement = qualityInspectionManagementService.selectOne(new EntityWrapper<QualityInspectionManagement>()
|
|
|
- .eq("relation_id", paymentManagement.getRelationId())
|
|
|
- .eq("comp_id", paymentManagement.getCompId()));
|
|
|
+ .eq("relation_id", paymentManagement.getRelationId()));
|
|
|
//检斤信息
|
|
|
WeighingManagement weighingManagement = weighingManagementService.selectOne(new EntityWrapper<WeighingManagement>()
|
|
|
- .eq("relation_id", paymentManagement.getRelationId())
|
|
|
- .eq("comp_id", paymentManagement.getCompId()));
|
|
|
+ .eq("relation_id", paymentManagement.getRelationId()));
|
|
|
qualityInspectionManagement.deleteById(qualityInspectionManagement.getId());
|
|
|
weighingManagement.deleteById(weighingManagement.getId());
|
|
|
|
|
@@ -576,7 +596,7 @@ public class PaymentManagementServiceImpl extends ServiceImpl<PaymentManagementM
|
|
|
|
|
|
@Override
|
|
|
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();
|
|
@@ -584,27 +604,27 @@ public class PaymentManagementServiceImpl extends ServiceImpl<PaymentManagementM
|
|
|
c.add(Calendar.YEAR, 0);
|
|
|
Date y = c.getTime();
|
|
|
String year = now.format(y);
|
|
|
- if(paymentManagement.getCompId() == null || paymentManagement.getCompId().isEmpty()){
|
|
|
+ if (paymentManagement.getCompId() == null || paymentManagement.getCompId().isEmpty()) {
|
|
|
paymentManagement.setCompId(AuthSecurityUtils.getStaffById(AuthSecurityUtils.getCurrentUserId()).getCompId());
|
|
|
}
|
|
|
List<PaymentManagement> paymentManagementList = this.selectList(new EntityWrapper<PaymentManagement>()
|
|
|
- .eq("goods_name",paymentManagement.getGoodsName())
|
|
|
- .eq("customer_number_card",paymentManagement.getCustomerNumberCard())
|
|
|
- .eq("comp_id",paymentManagement.getCompId())
|
|
|
- .ge("create_date",year));
|
|
|
- if (!CollectionUtils.isEmpty(paymentManagementList)){
|
|
|
+ .eq("goods_name", paymentManagement.getGoodsName())
|
|
|
+ .eq("customer_number_card", paymentManagement.getCustomerNumberCard())
|
|
|
+ .eq("comp_id", paymentManagement.getCompId())
|
|
|
+ .ge("create_date", year));
|
|
|
+ if (!CollectionUtils.isEmpty(paymentManagementList)) {
|
|
|
Float netWeight = 0f;
|
|
|
- for (PaymentManagement paymentManagement1:paymentManagementList){
|
|
|
+ for (PaymentManagement paymentManagement1 : paymentManagementList) {
|
|
|
//干粮净重
|
|
|
- if ("干粮".equals(paymentManagement1.getType())){
|
|
|
- netWeight=netWeight+(paymentManagement1.getNetWeight()!=null?paymentManagement1.getNetWeight():0f);
|
|
|
+ if ("干粮".equals(paymentManagement1.getType())) {
|
|
|
+ netWeight = netWeight + (paymentManagement1.getNetWeight() != null ? paymentManagement1.getNetWeight() : 0f);
|
|
|
}
|
|
|
//潮粮纯重
|
|
|
- else if("潮粮".equals(paymentManagement1.getType())){
|
|
|
- netWeight=netWeight+(paymentManagement1.getPureWeight()!=null?paymentManagement1.getPureWeight():0f);
|
|
|
+ else if ("潮粮".equals(paymentManagement1.getType())) {
|
|
|
+ netWeight = netWeight + (paymentManagement1.getPureWeight() != null ? paymentManagement1.getPureWeight() : 0f);
|
|
|
}
|
|
|
}
|
|
|
- cumulant=cumulant+netWeight;
|
|
|
+ cumulant = cumulant + netWeight;
|
|
|
}
|
|
|
return cumulant;
|
|
|
}
|
|
@@ -640,13 +660,13 @@ public class PaymentManagementServiceImpl extends ServiceImpl<PaymentManagementM
|
|
|
|
|
|
@Override
|
|
|
public String selectTaskId(PaymentManagement paymentManagement) {
|
|
|
- String taskIdNull="";
|
|
|
- List<PaymentManagement> paymentManagementList=this.selectList(new EntityWrapper<PaymentManagement>()
|
|
|
- .eq("management_type",paymentManagement.getManagementType())
|
|
|
- .eq("comp_id",paymentManagement.getCompId())
|
|
|
- .eq("warehouse_name",paymentManagement.getWarehouseName()));
|
|
|
- if (!CollectionUtils.isEmpty(paymentManagementList)){
|
|
|
- for (PaymentManagement paymentManagement1:paymentManagementList) {
|
|
|
+ String taskIdNull = "";
|
|
|
+ List<PaymentManagement> paymentManagementList = this.selectList(new EntityWrapper<PaymentManagement>()
|
|
|
+ .eq("management_type", paymentManagement.getManagementType())
|
|
|
+ .eq("comp_id", paymentManagement.getCompId())
|
|
|
+ .eq("warehouse_name", paymentManagement.getWarehouseName()));
|
|
|
+ if (!CollectionUtils.isEmpty(paymentManagementList)) {
|
|
|
+ for (PaymentManagement paymentManagement1 : paymentManagementList) {
|
|
|
String taskId = "";
|
|
|
// 只有待审核状态才有taskId
|
|
|
if (StringUtils.isNotBlank(paymentManagement1.getWorkflowId())) {
|
|
@@ -654,11 +674,10 @@ public class PaymentManagementServiceImpl extends ServiceImpl<PaymentManagementM
|
|
|
taskId = jsonObject.getString("taskId");
|
|
|
paymentManagement1.setTaskId(taskId);
|
|
|
}
|
|
|
- if (paymentManagement1.getTaskId()!=null){
|
|
|
- taskIdNull="true";
|
|
|
- }
|
|
|
- else {
|
|
|
- taskIdNull="false";
|
|
|
+ if (paymentManagement1.getTaskId() != null) {
|
|
|
+ taskIdNull = "true";
|
|
|
+ } else {
|
|
|
+ taskIdNull = "false";
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -668,11 +687,493 @@ public class PaymentManagementServiceImpl extends ServiceImpl<PaymentManagementM
|
|
|
|
|
|
private List<String> getResourceIdList() {
|
|
|
User currentUser = AuthSecurityUtils.getCurrentUserInfo();
|
|
|
- if(currentUser == null){
|
|
|
+ if (currentUser == null) {
|
|
|
return null;
|
|
|
}
|
|
|
// 当前登录人主要角色
|
|
|
return roleResourceService.getBindResourcesByUserId(currentUser.getUserId()).stream()
|
|
|
.map(CommonRoleResource::getResourceId).collect(Collectors.toList());
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 导出
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ * @throws Exception
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public void export(PaymentManagement paymentManagement, HttpServletResponse response) throws Exception {
|
|
|
+
|
|
|
+
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ // 查询
|
|
|
+// Page<ContractManagementInfo> contractManagementInfoPage = this.selectInfo(example);
|
|
|
+// List<ContractManagementInfo> contractManagementInfos = contractManagementInfoPage.getRecords();
|
|
|
+
|
|
|
+
|
|
|
+ // 1.Excel的头部信息
|
|
|
+ String headerTitle = "";
|
|
|
+
|
|
|
+ // 2.创建一个webbook 对应一个Excel文件
|
|
|
+ HSSFWorkbook wb = new HSSFWorkbook();
|
|
|
+
|
|
|
+ // 3.在webbook中添加一个sheet,对应Excel文件中的sheet
|
|
|
+ HSSFSheet sheet;
|
|
|
+
|
|
|
+ sheet = wb.createSheet("付款管理信息");
|
|
|
+ headerTitle = "付款管理信息";
|
|
|
+
|
|
|
+ // 4.设置打印参数
|
|
|
+ sheet.setMargin(HSSFSheet.TopMargin, (short) 1);// 页边距(上)
|
|
|
+ sheet.setMargin(HSSFSheet.BottomMargin, (short) 1);// 页边距(下)
|
|
|
+ sheet.setMargin(HSSFSheet.LeftMargin, (short) 1);// 页边距(左)
|
|
|
+ sheet.setMargin(HSSFSheet.RightMargin, (short) 1);// 页边距(右)
|
|
|
+
|
|
|
+ // 不显示网格
|
|
|
+ sheet.setDisplayGridlines(false);
|
|
|
+ // 设置水平居中
|
|
|
+ sheet.setHorizontallyCenter(true);
|
|
|
+
|
|
|
+ /**************** 数据行样式 start ****************/
|
|
|
+ HSSFFont fontTitle = wb.createFont();
|
|
|
+ fontTitle.setFontName("宋体");
|
|
|
+ fontTitle.setFontHeightInPoints((short) 14);
|
|
|
+ // 设置字体加粗
|
|
|
+ fontTitle.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
|
|
|
+
|
|
|
+ HSSFFont fontComp = wb.createFont();
|
|
|
+ fontComp.setFontName("宋体");
|
|
|
+ fontComp.setFontHeightInPoints((short) 16);
|
|
|
+ // 设置字体加粗
|
|
|
+ fontComp.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
|
|
|
+
|
|
|
+ HSSFFont fontDetail = wb.createFont();
|
|
|
+ fontDetail.setFontName("宋体");
|
|
|
+ fontDetail.setFontHeightInPoints((short) 12);
|
|
|
+
|
|
|
+ // title
|
|
|
+ HSSFCellStyle styleTitle = wb.createCellStyle();
|
|
|
+ // 指定单元格居中对齐
|
|
|
+ styleTitle.setAlignment(HSSFCellStyle.ALIGN_CENTER);
|
|
|
+ // 指定单元格垂直居中对齐
|
|
|
+ styleTitle.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);
|
|
|
+ // 指定单元格自动换行
|
|
|
+ styleTitle.setWrapText(true);
|
|
|
+ // 设置单元格字体
|
|
|
+ styleTitle.setFont(fontTitle);
|
|
|
+ // 右边框
|
|
|
+ styleTitle.setBorderRight(HSSFCellStyle.BORDER_NONE);
|
|
|
+ // 左边框
|
|
|
+ styleTitle.setBorderLeft(HSSFCellStyle.BORDER_NONE);
|
|
|
+ // 上边框
|
|
|
+ styleTitle.setBorderTop(HSSFCellStyle.BORDER_NONE);
|
|
|
+ // 下边框
|
|
|
+ styleTitle.setBorderBottom(HSSFCellStyle.BORDER_NONE);
|
|
|
+
|
|
|
+ // title
|
|
|
+ HSSFCellStyle styleComp = wb.createCellStyle();
|
|
|
+ // 指定单元格居中对齐
|
|
|
+ styleComp.setAlignment(HSSFCellStyle.ALIGN_CENTER);
|
|
|
+ // 指定单元格垂直居中对齐
|
|
|
+ styleComp.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);
|
|
|
+ // 指定单元格自动换行
|
|
|
+ styleComp.setWrapText(true);
|
|
|
+ // 设置单元格字体
|
|
|
+ styleComp.setFont(fontComp);
|
|
|
+ // 右边框
|
|
|
+ styleComp.setBorderRight(HSSFCellStyle.BORDER_NONE);
|
|
|
+ // 左边框
|
|
|
+ styleComp.setBorderLeft(HSSFCellStyle.BORDER_NONE);
|
|
|
+ // 上边框
|
|
|
+ styleComp.setBorderTop(HSSFCellStyle.BORDER_NONE);
|
|
|
+ // 下边框
|
|
|
+ styleComp.setBorderBottom(HSSFCellStyle.BORDER_NONE);
|
|
|
+
|
|
|
+ HSSFCellStyle styleInfo = wb.createCellStyle();
|
|
|
+ // 指定单元格居中对齐
|
|
|
+ styleInfo.setAlignment(HSSFCellStyle.ALIGN_LEFT);
|
|
|
+ // 指定单元格垂直居中对齐
|
|
|
+ styleInfo.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);
|
|
|
+ // 指定单元格自动换行
|
|
|
+ styleInfo.setWrapText(true);
|
|
|
+ // 设置单元格字体
|
|
|
+ styleInfo.setFont(fontDetail);
|
|
|
+ // 右边框
|
|
|
+ styleInfo.setBorderRight(HSSFCellStyle.BORDER_NONE);
|
|
|
+ // 左边框
|
|
|
+ styleInfo.setBorderLeft(HSSFCellStyle.BORDER_NONE);
|
|
|
+ // 上边框
|
|
|
+ styleInfo.setBorderTop(HSSFCellStyle.BORDER_NONE);
|
|
|
+ // 下边框
|
|
|
+ styleInfo.setBorderBottom(HSSFCellStyle.BORDER_NONE);
|
|
|
+
|
|
|
+ HSSFCellStyle styleDetail = wb.createCellStyle();
|
|
|
+ // 指定单元格居中对齐
|
|
|
+ styleDetail.setAlignment(HSSFCellStyle.ALIGN_CENTER);
|
|
|
+ // 指定单元格垂直居中对齐
|
|
|
+ styleDetail.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);
|
|
|
+ // 指定单元格自动换行
|
|
|
+ styleDetail.setWrapText(true);
|
|
|
+ // 设置单元格字体
|
|
|
+ styleDetail.setFont(fontDetail);
|
|
|
+ // 右边框
|
|
|
+ styleDetail.setBorderRight(HSSFCellStyle.BORDER_THIN);
|
|
|
+ // 左边框
|
|
|
+ styleDetail.setBorderLeft(HSSFCellStyle.BORDER_THIN);
|
|
|
+ // 上边框
|
|
|
+ styleDetail.setBorderTop(HSSFCellStyle.BORDER_THIN);
|
|
|
+ // 下styleDetailTitle
|
|
|
+ styleDetail.setBorderBottom(HSSFCellStyle.BORDER_THIN);
|
|
|
+
|
|
|
+ HSSFCellStyle styleDetailYellow = wb.createCellStyle();
|
|
|
+ // 指定单元格居中对齐
|
|
|
+ styleDetailYellow.setAlignment(HSSFCellStyle.ALIGN_CENTER);
|
|
|
+ // 指定单元格垂直居中对齐
|
|
|
+ styleDetailYellow.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);
|
|
|
+ // 指定单元格自动换行
|
|
|
+ styleDetailYellow.setWrapText(true);
|
|
|
+ // 设置单元格字体
|
|
|
+ styleDetailYellow.setFont(fontDetail);
|
|
|
+ // 右边框
|
|
|
+ styleDetailYellow.setBorderRight(HSSFCellStyle.BORDER_THIN);
|
|
|
+ // 左边框
|
|
|
+ styleDetailYellow.setBorderLeft(HSSFCellStyle.BORDER_THIN);
|
|
|
+ // 上边框
|
|
|
+ styleDetailYellow.setBorderTop(HSSFCellStyle.BORDER_THIN);
|
|
|
+ // 下styleDetailTitle
|
|
|
+ styleDetailYellow.setBorderBottom(HSSFCellStyle.BORDER_THIN);
|
|
|
+ styleDetailYellow.setFillForegroundColor(IndexedColors.YELLOW.getIndex());
|
|
|
+ styleDetailYellow.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
|
|
|
+
|
|
|
+
|
|
|
+ HSSFCellStyle styleDetailLeft = wb.createCellStyle();
|
|
|
+ // 指定单元格居中对齐
|
|
|
+ styleDetailLeft.setAlignment(HSSFCellStyle.ALIGN_LEFT);
|
|
|
+ // 指定单元格垂直居中对齐
|
|
|
+ styleDetailLeft.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);
|
|
|
+ // 指定单元格自动换行
|
|
|
+ styleDetailLeft.setWrapText(true);
|
|
|
+ // 设置单元格字体
|
|
|
+ styleDetailLeft.setFont(fontDetail);
|
|
|
+ // 右边框
|
|
|
+ styleDetailLeft.setBorderRight(HSSFCellStyle.BORDER_THIN);
|
|
|
+ // 左边框
|
|
|
+ styleDetailLeft.setBorderLeft(HSSFCellStyle.BORDER_THIN);
|
|
|
+ // 上边框
|
|
|
+ styleDetailLeft.setBorderTop(HSSFCellStyle.BORDER_THIN);
|
|
|
+ // 下styleDetailTitle
|
|
|
+ styleDetailLeft.setBorderBottom(HSSFCellStyle.BORDER_THIN);
|
|
|
+ /**************** 数据行样式 end ****************/
|
|
|
+
|
|
|
+ // 设置列宽
|
|
|
+ sheet.setColumnWidth(0, 1 * 256 + 184);
|
|
|
+ sheet.setColumnWidth(1, 12 * 256 + 184);
|
|
|
+ sheet.setColumnWidth(2, 12 * 256 + 184);
|
|
|
+ sheet.setColumnWidth(3, 12 * 256 + 184);
|
|
|
+ sheet.setColumnWidth(4, 12 * 256 + 184);
|
|
|
+ sheet.setColumnWidth(5, 12 * 256 + 184);
|
|
|
+ sheet.setColumnWidth(6, 12 * 256 + 184);
|
|
|
+ sheet.setColumnWidth(7, 12 * 256 + 184);
|
|
|
+ sheet.setColumnWidth(8, 12 * 256 + 184);
|
|
|
+ sheet.setColumnWidth(9, 12 * 256 + 184);
|
|
|
+ sheet.setColumnWidth(10, 12 * 256 + 184);
|
|
|
+ sheet.setColumnWidth(11, 12 * 256 + 184);
|
|
|
+ sheet.setColumnWidth(12, 12 * 256 + 184);
|
|
|
+ sheet.setColumnWidth(13, 12 * 256 + 184);
|
|
|
+ sheet.setColumnWidth(14, 12 * 256 + 184);
|
|
|
+ sheet.setColumnWidth(15, 12 * 256 + 184);
|
|
|
+ sheet.setColumnWidth(16, 12 * 256 + 184);
|
|
|
+ sheet.setColumnWidth(17, 12 * 256 + 184);
|
|
|
+ sheet.setColumnWidth(18, 12 * 256 + 184);
|
|
|
+ sheet.setColumnWidth(19, 1 * 256 + 184);
|
|
|
+
|
|
|
+ // 创建单元格对象
|
|
|
+ HSSFCell cell = null;
|
|
|
+
|
|
|
+ // 创建打印设置对象
|
|
|
+ HSSFPrintSetup ps = sheet.getPrintSetup();
|
|
|
+ // 打印方向,true:横向,false:纵向(默认)
|
|
|
+ ps.setLandscape(false);
|
|
|
+ // // 打印质量
|
|
|
+ // ps.setVResolution((short) 700)
|
|
|
+ // 设置缩放比例
|
|
|
+ ps.setScale((short) 80);
|
|
|
+ // 纸张类型
|
|
|
+ ps.setPaperSize(HSSFPrintSetup.A4_PAPERSIZE);
|
|
|
+
|
|
|
+
|
|
|
+ int rownum = 1;
|
|
|
+ HSSFRow row0 = sheet.createRow((int) rownum);
|
|
|
+ row0.setHeightInPoints(25);
|
|
|
+ cell = row0.createCell(1);
|
|
|
+ cell.setCellStyle(styleTitle);
|
|
|
+ cell.setCellValue("付款信息");
|
|
|
+ sheet.addMergedRegion(new CellRangeAddress(rownum, rownum, (short) 1, (short) 19));
|
|
|
+ cell = row0.createCell(2);
|
|
|
+ cell.setCellStyle(styleTitle);
|
|
|
+ cell = row0.createCell(3);
|
|
|
+ cell.setCellStyle(styleTitle);
|
|
|
+ cell = row0.createCell(4);
|
|
|
+ cell.setCellStyle(styleTitle);
|
|
|
+ cell = row0.createCell(5);
|
|
|
+ cell.setCellStyle(styleTitle);
|
|
|
+ cell = row0.createCell(6);
|
|
|
+ cell.setCellStyle(styleTitle);
|
|
|
+ cell = row0.createCell(7);
|
|
|
+ cell.setCellStyle(styleTitle);
|
|
|
+ cell = row0.createCell(8);
|
|
|
+ cell.setCellStyle(styleTitle);
|
|
|
+ cell = row0.createCell(9);
|
|
|
+ cell.setCellStyle(styleTitle);
|
|
|
+ cell = row0.createCell(10);
|
|
|
+ cell.setCellStyle(styleTitle);
|
|
|
+ cell = row0.createCell(11);
|
|
|
+ cell.setCellStyle(styleTitle);
|
|
|
+ cell = row0.createCell(12);
|
|
|
+ cell.setCellStyle(styleTitle);
|
|
|
+ cell = row0.createCell(13);
|
|
|
+ cell.setCellStyle(styleTitle);
|
|
|
+ cell = row0.createCell(14);
|
|
|
+ cell.setCellStyle(styleTitle);
|
|
|
+ cell = row0.createCell(15);
|
|
|
+ cell.setCellStyle(styleTitle);
|
|
|
+ cell = row0.createCell(16);
|
|
|
+ cell.setCellStyle(styleTitle);
|
|
|
+ cell = row0.createCell(17);
|
|
|
+ cell.setCellStyle(styleTitle);
|
|
|
+ cell = row0.createCell(18);
|
|
|
+ cell.setCellStyle(styleTitle);
|
|
|
+ rownum++;
|
|
|
+
|
|
|
+ HSSFRow row1 = sheet.createRow((int) rownum);
|
|
|
+ row1.setHeightInPoints(30);
|
|
|
+ cell = row1.createCell(1);
|
|
|
+ cell.setCellValue("采购公司");
|
|
|
+ cell.setCellStyle(styleDetail);
|
|
|
+ cell = row1.createCell(2);
|
|
|
+ cell.setCellValue("收货仓库");
|
|
|
+ cell.setCellStyle(styleDetail);
|
|
|
+ cell = row1.createCell(3);
|
|
|
+ cell.setCellValue("业务编号");
|
|
|
+ cell.setCellStyle(styleDetail);
|
|
|
+ cell = row1.createCell(4);
|
|
|
+ cell.setCellValue("供应商");
|
|
|
+ cell.setCellStyle(styleDetail);
|
|
|
+ cell = row1.createCell(5);
|
|
|
+ cell.setCellValue("货名");
|
|
|
+ cell.setCellStyle(styleDetail);
|
|
|
+ cell = row1.createCell(6);
|
|
|
+ cell.setCellValue("类型");
|
|
|
+ cell.setCellStyle(styleDetail);
|
|
|
+ cell = row1.createCell(7);
|
|
|
+ cell.setCellValue("水分");
|
|
|
+ cell.setCellStyle(styleDetail);
|
|
|
+ cell = row1.createCell(8);
|
|
|
+ cell.setCellValue("杂质");
|
|
|
+ cell.setCellStyle(styleDetail);
|
|
|
+ cell = row1.createCell(9);
|
|
|
+ cell.setCellValue("车牌号");
|
|
|
+ cell.setCellStyle(styleDetail);
|
|
|
+ cell = row1.createCell(10);
|
|
|
+ cell.setCellValue("净重单价");
|
|
|
+ cell.setCellStyle(styleDetail);
|
|
|
+ cell = row1.createCell(11);
|
|
|
+ cell.setCellValue("净重");
|
|
|
+ cell.setCellStyle(styleDetail);
|
|
|
+ cell = row1.createCell(12);
|
|
|
+ cell.setCellValue("纯重单价");
|
|
|
+ cell.setCellStyle(styleDetail);
|
|
|
+ cell = row1.createCell(13);
|
|
|
+ cell.setCellValue("纯重");
|
|
|
+ cell.setCellStyle(styleDetail);
|
|
|
+ cell = row1.createCell(14);
|
|
|
+ cell.setCellValue("合计应付");
|
|
|
+ cell.setCellStyle(styleDetail);
|
|
|
+ cell = row1.createCell(15);
|
|
|
+ cell.setCellValue("实付金额");
|
|
|
+ cell.setCellStyle(styleDetail);
|
|
|
+ cell = row1.createCell(16);
|
|
|
+ cell.setCellValue("姓名");
|
|
|
+ cell.setCellStyle(styleDetail);
|
|
|
+ cell = row1.createCell(17);
|
|
|
+ cell.setCellValue("卡号");
|
|
|
+ cell.setCellStyle(styleDetail);
|
|
|
+ cell = row1.createCell(18);
|
|
|
+ cell.setCellValue("开户行");
|
|
|
+ cell.setCellStyle(styleDetail);
|
|
|
+
|
|
|
+ rownum++;
|
|
|
+ String compName = commonCompanyService.selectById(AuthSecurityUtils.getCurrentUserInfo().getCompId()).getCompName();
|
|
|
+ // 详情信息
|
|
|
+ if (org.apache.commons.collections.CollectionUtils.isNotEmpty(paymentManagement.getPaymentManagementList())) {
|
|
|
+ for (int i = 0; i < paymentManagement.getPaymentManagementList().size(); i++) {
|
|
|
+ PaymentManagement paymentManagement1 = paymentManagement.getPaymentManagementList().get(i);
|
|
|
+ HSSFRow rowx = sheet.createRow((int) rownum);
|
|
|
+ rowx.setHeightInPoints(20);
|
|
|
+ cell = rowx.createCell(1);
|
|
|
+ cell.setCellValue(compName);
|
|
|
+ cell.setCellStyle(styleDetail);
|
|
|
+ cell = rowx.createCell(2);
|
|
|
+ cell.setCellValue(editString(paymentManagement1.getWarehouseName()));
|
|
|
+ cell.setCellStyle(styleDetail);
|
|
|
+ cell = rowx.createCell(3);
|
|
|
+ cell.setCellValue(editString(paymentManagement1.getPaymentNo()));
|
|
|
+ cell.setCellStyle(styleDetail);
|
|
|
+ cell = rowx.createCell(4);
|
|
|
+ cell.setCellValue(editString(paymentManagement1.getCustomerName()));
|
|
|
+ cell.setCellStyle(styleDetail);
|
|
|
+ cell = rowx.createCell(5);
|
|
|
+ cell.setCellValue(editString(paymentManagement1.getGoodsName()));
|
|
|
+ cell.setCellStyle(styleDetail);
|
|
|
+ cell = rowx.createCell(6);
|
|
|
+ cell.setCellValue(editString(paymentManagement1.getType()));
|
|
|
+ cell.setCellStyle(styleDetail);
|
|
|
+ cell = rowx.createCell(7);
|
|
|
+ cell.setCellValue(editString(paymentManagement1.getQualityInspectionManagement().getWaterContent()));
|
|
|
+ cell.setCellStyle(styleDetail);
|
|
|
+ cell = rowx.createCell(8);
|
|
|
+ cell.setCellValue(editString(paymentManagement1.getQualityInspectionManagement().getImpurity()));
|
|
|
+ cell.setCellStyle(styleDetail);
|
|
|
+ cell = rowx.createCell(9);
|
|
|
+ cell.setCellValue(editString(paymentManagement1.getCarNo()));
|
|
|
+ cell.setCellStyle(styleDetail);
|
|
|
+ cell = rowx.createCell(10);
|
|
|
+ cell.setCellValue(editFloat(paymentManagement1.getTidalGrainPrice()));
|
|
|
+ cell.setCellStyle(styleDetail);
|
|
|
+ cell = rowx.createCell(11);
|
|
|
+ cell.setCellValue(editFloat(paymentManagement1.getNetWeight()));
|
|
|
+ cell.setCellStyle(styleDetail);
|
|
|
+ cell = rowx.createCell(12);
|
|
|
+ cell.setCellValue(editFloat(paymentManagement1.getSolidGrainPrice()));
|
|
|
+ cell.setCellStyle(styleDetail);
|
|
|
+ cell = rowx.createCell(13);
|
|
|
+ cell.setCellValue(editFloat(paymentManagement1.getPureWeight()));
|
|
|
+ cell.setCellStyle(styleDetail);
|
|
|
+ cell = rowx.createCell(14);
|
|
|
+ cell.setCellValue(editFloat(paymentManagement1.getAmountIngPayable()));
|
|
|
+ cell.setCellStyle(styleDetail);
|
|
|
+ cell = rowx.createCell(15);
|
|
|
+ cell.setCellValue(editFloat(paymentManagement1.getAmountEdPayable()));
|
|
|
+ cell.setCellStyle(styleDetail);
|
|
|
+ cell = rowx.createCell(16);
|
|
|
+ cell.setCellValue(editString(paymentManagement1.getCustomerName()));
|
|
|
+ cell.setCellStyle(styleDetail);
|
|
|
+ cell = rowx.createCell(17);
|
|
|
+ cell.setCellValue(editString(paymentManagement1.getIdentityAuthenticationInfo().getBankCard()));
|
|
|
+ cell.setCellStyle(styleDetail);
|
|
|
+ cell = rowx.createCell(18);
|
|
|
+ cell.setCellValue(editString(paymentManagement1.getIdentityAuthenticationInfo().getBankDeposit()));
|
|
|
+ cell.setCellStyle(styleDetail);
|
|
|
+ rownum++;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ String path = null;
|
|
|
+ String tempPath = null;
|
|
|
+ String excelPath = null;
|
|
|
+
|
|
|
+ try {
|
|
|
+
|
|
|
+ // 取得绝对路径
|
|
|
+ tempPath = URLDecoder.decode((localPath), "utf-8");
|
|
|
+
|
|
|
+ // EXCEL路径
|
|
|
+ excelPath = "/web/temp/pay/" + DateUtil.formatDate(new Date(), DateUtils.DATE_FMT_YYYYMMDD_NS) + '/'
|
|
|
+ + UUID.randomUUID().toString().replaceAll("-", "");
|
|
|
+
|
|
|
+ path = tempPath + excelPath + '/' + "合同信息"
|
|
|
+ + ".xls";
|
|
|
+
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.debug(e.getMessage());
|
|
|
+ }
|
|
|
+ // 下载
|
|
|
+ download(path, response, wb);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ private Date addDateOneDay(Date date) {
|
|
|
+ if (null == date) {
|
|
|
+ return date;
|
|
|
+ }
|
|
|
+ Calendar c = Calendar.getInstance();
|
|
|
+ c.setTime(date); // 设置当前日期
|
|
|
+ c.add(Calendar.DATE, 1); // 日期加1天
|
|
|
+ date = c.getTime();
|
|
|
+ return date;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 判断浮点数
|
|
|
+ *
|
|
|
+ * @param example
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private Float editFloat(Float example) {
|
|
|
+ Float exampleOne = example != null ? example : 0f;
|
|
|
+ return exampleOne;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 判断字符串
|
|
|
+ *
|
|
|
+ * @param example
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private String editString(String example) {
|
|
|
+ String exampleOne = example != null ? example : "";
|
|
|
+ return exampleOne;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 下载
|
|
|
+ *
|
|
|
+ * @param path
|
|
|
+ * @param response
|
|
|
+ */
|
|
|
+ private void download(String path, HttpServletResponse response, Workbook wb) {
|
|
|
+
|
|
|
+ try {
|
|
|
+
|
|
|
+ // path是指欲下载的文件的路径。
|
|
|
+ File file = new File(path);
|
|
|
+ // 取得文件名。
|
|
|
+ String fileName = file.getName();
|
|
|
+ // 给文件名编码
|
|
|
+ fileName = new String(fileName.getBytes("GBK"), "ISO-8859-1");
|
|
|
+
|
|
|
+ response.setContentType("application/vnd.ms-excel");
|
|
|
+ response.addHeader("Content-Disposition", "attachment;filename=" + fileName);
|
|
|
+
|
|
|
+ // 定义byte输出流
|
|
|
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
|
|
|
+
|
|
|
+ // 写导出文件
|
|
|
+ wb.write(out);
|
|
|
+
|
|
|
+ // 取得模板文件中的数据
|
|
|
+ byte[] result = out.toByteArray();
|
|
|
+
|
|
|
+ // 设置输出数据类型
|
|
|
+ response.setContentType("application/vnd.ms-excel");
|
|
|
+ // 设置输出数据长度
|
|
|
+ response.setContentLength(result.length);
|
|
|
+
|
|
|
+ // 设置文件名称
|
|
|
+ response.setHeader("Content-Disposition", "attachment; filename=\"" + fileName + "\"");
|
|
|
+ // 将文件流输出到画面
|
|
|
+ response.getOutputStream().write(result);
|
|
|
+
|
|
|
+ out.flush();
|
|
|
+ out.close();
|
|
|
+
|
|
|
+ } catch (IOException ex) {
|
|
|
+ log.debug(ex.getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
}
|