|
|
@ -61,7 +61,9 @@ import com.yxt.anrui.as.feign.wms.wmsoldinventory.WmsOldInventoryFeign; |
|
|
|
import com.yxt.anrui.as.feign.wms.wmsoldinventory.WmsOldInventoryPush; |
|
|
|
import com.yxt.common.base.config.component.FileUploadComponent; |
|
|
|
import com.yxt.common.base.service.MybatisBaseService; |
|
|
|
import com.yxt.common.base.utils.ConstantUtils; |
|
|
|
import com.yxt.common.base.utils.PagerUtil; |
|
|
|
import com.yxt.common.base.utils.WordConvertUtils; |
|
|
|
import com.yxt.common.core.query.PagerQuery; |
|
|
|
import com.yxt.common.core.result.ResultBean; |
|
|
|
import com.yxt.common.core.vo.PagerVo; |
|
|
@ -71,12 +73,16 @@ import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
|
import java.io.File; |
|
|
|
import java.io.InputStream; |
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
import java.time.LocalDate; |
|
|
|
import java.time.ZoneId; |
|
|
|
import java.util.*; |
|
|
|
|
|
|
|
import static java.util.Comparator.comparing; |
|
|
|
|
|
|
|
/** |
|
|
|
* @description: |
|
|
|
* @author: dimengzhe |
|
|
@ -131,6 +137,7 @@ public class AsBusrepairBillService extends MybatisBaseService<AsBusrepairBillMa |
|
|
|
private CrmCustomerTempFeign crmCustomerTempFeign; |
|
|
|
@Autowired |
|
|
|
private AsServiceItemService asServiceItemService; |
|
|
|
|
|
|
|
/** |
|
|
|
* 维修领料获取派工单 |
|
|
|
* |
|
|
@ -828,6 +835,7 @@ public class AsBusrepairBillService extends MybatisBaseService<AsBusrepairBillMa |
|
|
|
} else if (asBusrepairBill.getNodeCode() == 2) { |
|
|
|
nodeCode = 3; |
|
|
|
nodeName = "维修"; |
|
|
|
asBusrepairBill.setRepairState(1); |
|
|
|
} else if (asBusrepairBill.getNodeCode() == 3) { |
|
|
|
nodeCode = 4; |
|
|
|
nodeName = "竣工"; |
|
|
@ -1299,7 +1307,7 @@ public class AsBusrepairBillService extends MybatisBaseService<AsBusrepairBillMa |
|
|
|
//获取索赔单
|
|
|
|
List<String> claimNos = asBusclaimBillService.selectByRepairBillSid(sid); |
|
|
|
if (!claimNos.isEmpty()) { |
|
|
|
vo.setClaimNo(String.join(",",claimNos)); |
|
|
|
vo.setClaimNo(String.join(",", claimNos)); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(detailsVo.getVinNo())) { |
|
|
|
vo.setVinNo(detailsVo.getVinNo()); |
|
|
@ -1327,15 +1335,15 @@ public class AsBusrepairBillService extends MybatisBaseService<AsBusrepairBillMa |
|
|
|
for (int i = 0; i < sitemVos.size(); i++) { |
|
|
|
SitemVo sitemVo = sitemVos.get(i); |
|
|
|
SettleItemPdfVo itemPdfVo = new SettleItemPdfVo(); |
|
|
|
BeanUtil.copyProperties(sitemVo,itemPdfVo); |
|
|
|
itemPdfVo.setSortNo(String.valueOf(i+1)); |
|
|
|
BeanUtil.copyProperties(sitemVo, itemPdfVo); |
|
|
|
itemPdfVo.setSortNo(String.valueOf(i + 1)); |
|
|
|
String serviceItemSid = sitemVo.getServiceItemSid(); |
|
|
|
AsServiceItem item = asServiceItemService.fetchBySid(serviceItemSid); |
|
|
|
if (null != item) { |
|
|
|
itemPdfVo.setServiceItemCode(item.getSitemCode()); |
|
|
|
} |
|
|
|
if (!sitemVo.getStaffNameList().isEmpty()) { |
|
|
|
itemPdfVo.setRepairerName(String.join(",",sitemVo.getStaffNameList())); |
|
|
|
itemPdfVo.setRepairerName(String.join(",", sitemVo.getStaffNameList())); |
|
|
|
} |
|
|
|
BigDecimal price = BigDecimal.ZERO; |
|
|
|
BigDecimal amount = BigDecimal.ZERO; |
|
|
@ -1358,12 +1366,146 @@ public class AsBusrepairBillService extends MybatisBaseService<AsBusrepairBillMa |
|
|
|
vo.setSumMoney1(sumMoney1.toString()); |
|
|
|
String caps1 = bigDecimalToLocalStr(sumMoney1); |
|
|
|
vo.setCaps1(caps1); |
|
|
|
List<GoodsDetailsVo> detailsVos = detailsVo.getGoodsDetailsVos(); |
|
|
|
if (!detailsVos.isEmpty()) { |
|
|
|
List<SettleGoodsPdfVo> goodsPdfVos = new ArrayList<>(); |
|
|
|
for (int i = 0; i < detailsVos.size(); i++) { |
|
|
|
GoodsDetailsVo goodsDetailsVo = detailsVos.get(i); |
|
|
|
SettleGoodsPdfVo goodsPdfVo = new SettleGoodsPdfVo(); |
|
|
|
BeanUtil.copyProperties(goodsDetailsVo, goodsPdfVo); |
|
|
|
goodsPdfVo.setSortNo(String.valueOf(i + 1)); |
|
|
|
BigDecimal price = BigDecimal.ZERO; |
|
|
|
BigDecimal amount = BigDecimal.ZERO; |
|
|
|
if (StringUtils.isNotBlank(goodsDetailsVo.getPrice())) { |
|
|
|
price = new BigDecimal(goodsDetailsVo.getPrice()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(goodsDetailsVo.getAmount())) { |
|
|
|
amount = new BigDecimal(goodsDetailsVo.getAmount()); |
|
|
|
} |
|
|
|
goodsPdfVos.add(goodsPdfVo); |
|
|
|
if (subject.equals("保内")) { |
|
|
|
sumMoney2.add(price); |
|
|
|
} |
|
|
|
if (subject.equals("保外")) { |
|
|
|
sumMoney2.add(amount); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
vo.setSumMoney2(sumMoney2.toString()); |
|
|
|
String caps2 = bigDecimalToLocalStr(sumMoney2); |
|
|
|
vo.setCaps2(caps2); |
|
|
|
if (StringUtils.isNotBlank(detailsVo.getSubsidyAmount())) { |
|
|
|
vo.setSubsidyAmount(detailsVo.getSubsidyAmount()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(detailsVo.getOutAmount())) { |
|
|
|
vo.setOutAmount(detailsVo.getOutAmount()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(detailsVo.getRescueAmount())) { |
|
|
|
vo.setRescueAmount(detailsVo.getRescueAmount()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(detailsVo.getReceivableAmount())) { |
|
|
|
vo.setReceivableAmount(detailsVo.getReceivableAmount()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(detailsVo.getActualAmount())) { |
|
|
|
vo.setActualAmount(detailsVo.getActualAmount()); |
|
|
|
} |
|
|
|
vo.setUserName(userName); |
|
|
|
String path = createSettlePdf(vo, type, subject); |
|
|
|
} |
|
|
|
return rb.success().setData(filePath); |
|
|
|
} |
|
|
|
|
|
|
|
private String createSettlePdf(SettlePdfVo vo, String type, String subject) { |
|
|
|
String finalPath = ""; |
|
|
|
Map<String, Object> dataMap = new HashMap(); |
|
|
|
List<Map<String, Object>> list = new ArrayList<>(); |
|
|
|
List<Map<String, Object>> newList = new ArrayList<>(); |
|
|
|
dataMap.put("company", vo.getCompany()); |
|
|
|
dataMap.put("dept", vo.getDept()); |
|
|
|
dataMap.put("settleTime", vo.getSettleTime()); |
|
|
|
dataMap.put("customer", vo.getCustomer()); |
|
|
|
dataMap.put("mobile", vo.getCompany()); |
|
|
|
dataMap.put("billNo", vo.getCompany()); |
|
|
|
dataMap.put("billType", vo.getCompany()); |
|
|
|
dataMap.put("vehModel", vo.getCompany()); |
|
|
|
dataMap.put("claimManufacturer", vo.getCompany()); |
|
|
|
dataMap.put("claimNo", vo.getCompany()); |
|
|
|
dataMap.put("vinNo", vo.getCompany()); |
|
|
|
dataMap.put("vehMark", vo.getCompany()); |
|
|
|
dataMap.put("isKp", vo.getCompany()); |
|
|
|
dataMap.put("caps1", vo.getCompany()); |
|
|
|
dataMap.put("sumMoney1", vo.getCompany()); |
|
|
|
dataMap.put("caps2", vo.getCompany()); |
|
|
|
dataMap.put("sumMoney2", vo.getCompany()); |
|
|
|
dataMap.put("outAmount", vo.getCompany()); |
|
|
|
dataMap.put("subsidyAmount", vo.getCompany()); |
|
|
|
dataMap.put("rescueAmount", vo.getCompany()); |
|
|
|
dataMap.put("receivableAmount", vo.getCompany()); |
|
|
|
dataMap.put("actualAmount", vo.getCompany()); |
|
|
|
dataMap.put("userName", vo.getCompany()); |
|
|
|
//
|
|
|
|
// private String sortNo; //序号
|
|
|
|
// private String serviceItem; //维修项目
|
|
|
|
// private String serviceItemCode; //维修项目编码
|
|
|
|
// private String serviceType; //工种
|
|
|
|
// private String hourPrice; //工时单价
|
|
|
|
// private String hours; //工时数量
|
|
|
|
// private String price; //维修金额
|
|
|
|
// private String discount; //折扣
|
|
|
|
// private String discountAmount; //优惠
|
|
|
|
// private String amount; //销售金额
|
|
|
|
// private String repairerName; //维修技师
|
|
|
|
// private String remarks; //备注
|
|
|
|
//
|
|
|
|
// private List<SettleGoodsPdfVo> goods = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<SettleItemPdfVo> items = vo.getItems(); |
|
|
|
if (!items.isEmpty()) { |
|
|
|
for (SettleItemPdfVo itemPdfVo : items) { |
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
|
map.put("sortNo", itemPdfVo.getSortNo()); |
|
|
|
map.put("sortNo", itemPdfVo.getSortNo()); |
|
|
|
map.put("sortNo", itemPdfVo.getSortNo()); |
|
|
|
map.put("sortNo", itemPdfVo.getSortNo()); |
|
|
|
map.put("sortNo", itemPdfVo.getSortNo()); |
|
|
|
map.put("sortNo", itemPdfVo.getSortNo()); |
|
|
|
map.put("sortNo", itemPdfVo.getSortNo()); |
|
|
|
map.put("sortNo", itemPdfVo.getSortNo()); |
|
|
|
map.put("sortNo", itemPdfVo.getSortNo()); |
|
|
|
map.put("sortNo", itemPdfVo.getSortNo()); |
|
|
|
map.put("sortNo", itemPdfVo.getSortNo()); |
|
|
|
map.put("sortNo", itemPdfVo.getSortNo()); |
|
|
|
map.put("sortNo", itemPdfVo.getSortNo()); |
|
|
|
map.put("sortNo", itemPdfVo.getSortNo()); |
|
|
|
list.add(map); |
|
|
|
} |
|
|
|
} |
|
|
|
return rb.success().setData(filePath); |
|
|
|
// dataMap.put("list", list);
|
|
|
|
// String temp = "/template/";
|
|
|
|
// String targetPath = docPdfComponent.getUploadTemplateUrl();
|
|
|
|
// try {
|
|
|
|
// //获取模板
|
|
|
|
// InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream("ftl/vouchers/yhjt.ftl");
|
|
|
|
// //生成word文件名
|
|
|
|
// String dateStr = DateUtil.format(new Date(), "yyyyMMdd");
|
|
|
|
// long seconds = System.currentTimeMillis();
|
|
|
|
// String typeName = dateStr + seconds + ".doc";
|
|
|
|
// File file = new File(targetPath + "templateVouchers" + seconds + ".ftl");
|
|
|
|
// File dir = new File(targetPath);
|
|
|
|
// WordConvertUtils.inputStreamToFile(inputStream, file);
|
|
|
|
// WordConvertUtils.creatWord1(dataMap, file, targetPath, typeName, dir);
|
|
|
|
// //新生成的word路径
|
|
|
|
// String wordPath = targetPath + typeName;
|
|
|
|
// String pdfName = "月还计提审批" + dateStr + seconds + ".pdf";
|
|
|
|
// WordConvertUtils.doc2pdf(wordPath, targetPath, pdfName);
|
|
|
|
// finalPath = temp + pdfName;
|
|
|
|
// } catch (NoClassDefFoundError e) {
|
|
|
|
// e.printStackTrace();
|
|
|
|
// finalPath = targetPath;
|
|
|
|
// }
|
|
|
|
|
|
|
|
return finalPath; |
|
|
|
} |
|
|
|
|
|
|
|
public static String bigDecimalToLocalStr(BigDecimal bigDecimal) { |
|
|
|