Browse Source

结清管理打印下载

zhanglei
fanzongzhe 9 months ago
parent
commit
dbfd60fe3a
  1. 8
      anrui-riskcenter/anrui-riskcenter-api/src/main/java/com/yxt/anrui/riskcenter/api/loansettleapply/LoanSettleApplyFeign.java
  2. 3
      anrui-riskcenter/anrui-riskcenter-biz/src/main/java/com/yxt/anrui/riskcenter/biz/loanrepaymentplandetails/LoanRepaymentPlanDetailsMapper.xml
  3. 7
      anrui-riskcenter/anrui-riskcenter-biz/src/main/java/com/yxt/anrui/riskcenter/biz/loansettleapply/LoanSettleApplyRest.java
  4. 342
      anrui-riskcenter/anrui-riskcenter-biz/src/main/java/com/yxt/anrui/riskcenter/biz/loansettleapply/LoanSettleApplyService.java
  5. 4828
      anrui-riskcenter/anrui-riskcenter-biz/src/main/resources/ftl/jqsq2.ftl

8
anrui-riskcenter/anrui-riskcenter-api/src/main/java/com/yxt/anrui/riskcenter/api/loansettleapply/LoanSettleApplyFeign.java

@ -44,6 +44,12 @@ public interface LoanSettleApplyFeign {
@DeleteMapping("/delBySids")
ResultBean delBySids(@RequestBody String[] sids);
@ApiOperation("下载结清审批pdf")
@PostMapping("/downloadPdf")
ResultBean<String> downloadPdf(@RequestParam("sid") String sid);
@ApiOperation("提交")
@PostMapping("/submitApply")
public ResultBean submitApply(@Valid @RequestBody SubmitSettleApplyDto dto);
@ -88,5 +94,5 @@ public interface LoanSettleApplyFeign {
@ApiOperation(value = "结清确认")
@PostMapping(value = "/confirmAtn")
ResultBean confirmAtn(@RequestParam("sid")String sid);
ResultBean confirmAtn(@RequestParam("sid") String sid);
}

3
anrui-riskcenter/anrui-riskcenter-biz/src/main/java/com/yxt/anrui/riskcenter/biz/loanrepaymentplandetails/LoanRepaymentPlanDetailsMapper.xml

@ -844,8 +844,7 @@
resultType="com.yxt.anrui.riskcenter.api.loanrepaymentplandetails.LoanRepaymentPlanDetails">
select *
from loan_repayment_plan_details
where busVinSid = #{busVinSid}
and policyOrOther = '0' limit 1
where busVinSid = #{busVinSid} limit 1
</select>
<select id="fetchCwDeptCodeByBusVinSid" resultType="java.lang.String">
SELECT s.cwDeptNo

7
anrui-riskcenter/anrui-riskcenter-biz/src/main/java/com/yxt/anrui/riskcenter/biz/loansettleapply/LoanSettleApplyRest.java

@ -22,7 +22,7 @@ import java.util.List;
@RestController
@RequestMapping("v1/LoanSettleApply")
@Api(tags = "结清申请")
public class LoanSettleApplyRest implements LoanSettleApplyFeign {
public abstract class LoanSettleApplyRest implements LoanSettleApplyFeign {
@Autowired
private LoanSettleApplyService loanSettleApplyService;
@ -56,6 +56,11 @@ public class LoanSettleApplyRest implements LoanSettleApplyFeign {
return loanSettleApplyService.delAllBySids(sids);
}
@Override
public ResultBean<String> downloadPdf(String sid) {
return loanSettleApplyService.downloadPdf(sid);
}
@Override
public ResultBean submitApply(SubmitSettleApplyDto dto) {
return loanSettleApplyService.submitApply(dto);

342
anrui-riskcenter/anrui-riskcenter-biz/src/main/java/com/yxt/anrui/riskcenter/biz/loansettleapply/LoanSettleApplyService.java

@ -6,11 +6,24 @@ import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
import com.yxt.anrui.base.api.basemiddleman.BaseMiddlemanDetailsVo;
import com.yxt.anrui.base.api.commoncontract.CommonContract;
import com.yxt.anrui.base.common.enums.BillTypeEnum;
import com.yxt.anrui.base.common.utils.Rule;
import com.yxt.anrui.base.common.utils.domain.BillNo;
import com.yxt.anrui.buscenter.api.busdeposit.BusDeposit;
import com.yxt.anrui.buscenter.api.busdepositfictitious.BusDepositFictitious;
import com.yxt.anrui.buscenter.api.bussalesorder.BusSalesOrder;
import com.yxt.anrui.buscenter.api.bussalesorder.BusSalesOrderFL;
import com.yxt.anrui.buscenter.api.bussalesorder.BusSalesOrderSourceLCVo;
import com.yxt.anrui.buscenter.api.bussalesorder.app.order.AppOrderDiscountListVo;
import com.yxt.anrui.buscenter.api.bussalesorder.flowable.BusSalesOrderDelegateQuery;
import com.yxt.anrui.buscenter.api.bussalesorderdeposit.BusSalesOrderDeposit;
import com.yxt.anrui.buscenter.api.bussalesorderinsurance.BusSalesOrderInsuranceDetailsVo;
import com.yxt.anrui.buscenter.api.bussalesordermodel.BusSalesOrderModel;
import com.yxt.anrui.buscenter.api.bussalesorderprice.BusSalesOrderPrice;
import com.yxt.anrui.buscenter.api.bussalesordersubmit.BusSalesOrderSubmit;
import com.yxt.anrui.buscenter.api.bussalesordervehicle.BusSalesOrderVehicle;
import com.yxt.anrui.fin.api.finpaymentrecord.FinPaymentrecordDto;
import com.yxt.anrui.fin.api.finpaymentrecord.FinPaymentrecordFeign;
import com.yxt.anrui.fin.api.finselectedreceivablesdetailed.FinSelectedReceivablesDetailed;
@ -27,10 +40,13 @@ import com.yxt.anrui.flowable.api.flowtask.FlowTaskVo;
import com.yxt.anrui.flowable.api.flowtask.LatestTaskVo;
import com.yxt.anrui.flowable.api.utils.ProcDefEnum;
import com.yxt.anrui.flowable.sqloperationsymbol.BusinessVariables;
import com.yxt.anrui.portal.api.flow.PCHistTaskListAndCommentList;
import com.yxt.anrui.portal.api.sysorganization.SysOrganization;
import com.yxt.anrui.portal.api.sysorganization.SysOrganizationFeign;
import com.yxt.anrui.portal.api.sysorganization.SysOrganizationVo;
import com.yxt.anrui.portal.api.sysparameter.SysParameterFeign;
import com.yxt.anrui.portal.api.sysstafforg.SysStaffOrgFeign;
import com.yxt.anrui.portal.api.sysstafforg.SysStaffOrgVo;
import com.yxt.anrui.portal.api.sysuser.PrivilegeQuery;
import com.yxt.anrui.portal.api.sysuser.SysUserFeign;
import com.yxt.anrui.portal.api.sysuser.SysUserVo;
@ -48,6 +64,7 @@ import com.yxt.anrui.riskcenter.api.loansettlecompanyreduction.LoanSettleCompany
import com.yxt.anrui.riskcenter.api.loansettlecompanyreduction.LoanSettleCompanyReductionVo;
import com.yxt.anrui.riskcenter.api.loansettlevehicle.LoanSettleVehicleDto;
import com.yxt.anrui.riskcenter.api.loansolutions.LoanSolutions;
import com.yxt.anrui.riskcenter.api.loansolutions.app.SolutionsDetailsVo;
import com.yxt.anrui.riskcenter.api.loansolutionsdetail.LoanSolutionsDetail;
import com.yxt.anrui.riskcenter.biz.loanrepaymenthistory.LoanRepaymentHistoryService;
import com.yxt.anrui.riskcenter.biz.loanrepaymentplandetails.LoanRepaymentPlanDetailsService;
@ -61,28 +78,39 @@ import com.yxt.anrui.riskcenter.biz.loansettlecompanyreduction.LoanSettleCompany
import com.yxt.anrui.riskcenter.biz.loansettlevehicle.LoanSettleVehicleService;
import com.yxt.anrui.riskcenter.biz.loansolutions.LoanSolutionsMapper;
import com.yxt.anrui.riskcenter.biz.loansolutionsdetail.LoanSolutionsDetailService;
import com.yxt.common.base.config.component.DocPdfComponent;
import com.yxt.common.base.config.component.FileUploadComponent;
import com.yxt.common.base.service.MybatisBaseService;
import com.yxt.common.base.utils.PagerUtil;
import com.yxt.common.base.utils.*;
import com.yxt.common.base.utils.Base64;
import com.yxt.common.core.query.PagerQuery;
import com.yxt.common.core.result.ResultBean;
import com.yxt.common.core.vo.PagerVo;
import com.yxt.messagecenter.api.message.Message;
import com.yxt.messagecenter.api.message.MessageFeign;
import com.yxt.messagecenter.api.message.MessageFlowVo;
import com.yxt.messagecenter.api.message.MessageFlowableQuery;
import com.yxt.messagecenter.api.messagelist.MessageList;
import com.yxt.messagecenter.api.messagelist.MessageListFeign;
import org.apache.commons.lang3.StringUtils;
import org.apache.tomcat.util.threads.ThreadPoolExecutor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.io.*;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.*;
import java.util.stream.Collectors;
import static java.util.Comparator.comparing;
/**
* @description:
* @author: dimengzhe
@ -91,6 +119,8 @@ import java.util.stream.Collectors;
@Service
public class LoanSettleApplyService extends MybatisBaseService<LoanSettleApplyMapper, LoanSettleApply> {
@Autowired
private com.yxt.anrui.portal.api.flow.FlowableFeign flowableFeignPro;
@Autowired
private FinPaymentrecordFeign finPaymentrecordFeign;
@Autowired
@ -139,7 +169,10 @@ public class LoanSettleApplyService extends MybatisBaseService<LoanSettleApplyMa
private LoanRepaymentHistoryService loanRepaymentHistoryService;
@Autowired
private LoanRepaymentPlanDetailsService loanRepaymentPlanDetailsService;
@Autowired
private MessageListFeign messageListFeign;
@Autowired
private DocPdfComponent docPdfComponent;
public PagerVo<LoanSettleApplyVo> listPageVo(PagerQuery<LoanSettleApplyQuery> pq) {
LoanSettleApplyQuery query = pq.getParams();
QueryWrapper<LoanSettleApply> qw = new QueryWrapper<>();
@ -2467,4 +2500,309 @@ public class LoanSettleApplyService extends MybatisBaseService<LoanSettleApplyMa
public void updatePaymentStateByBusVinSid(String busVinSid) {
baseMapper.updatePaymentStateByBusVinSid(busVinSid);
}
public ResultBean<String> downloadPdf(String sid) {
ResultBean rb = ResultBean.fireFail();
String finalPath = "";
String filePath = "";
List<String> photoList = new ArrayList<>();
List<String> imgList = new ArrayList<>();
SettleApplyAppVo data = getAppDetails(sid).getData();
Map<String, Object> dataMap = new HashMap();
LoanSettleApply loanSettleApply = fetchBySid(sid);
if (null != data) {
dataMap.put("useOrgName", loanSettleApply.getUseOrgName());
dataMap.put("createTime", data.getCreateTime());
dataMap.put("billNo", loanSettleApply.getBillNo());
//创建人
dataMap.put("createByName", data.getCreateByName());
//创建部门
dataMap.put("createDept", data.getCreateDept());
dataMap.put("typeStateValue", loanSettleApply.getTypeStateValue());
if (StringUtils.isNotBlank(data.getVinNo())) {
dataMap.put("vinNo", data.getVinNo());
}
if (StringUtils.isNotBlank(data.getVehMark())) {
dataMap.put("vehMark", data.getVehMark());
}
if (StringUtils.isNotBlank(data.getCustomerName())) {
dataMap.put("customerName", data.getCustomerName());
}
if (StringUtils.isNotBlank(data.getLoanName())) {
dataMap.put("loanName", data.getLoanName());
}
if (StringUtils.isNotBlank(data.getLoanContractNo())) {
dataMap.put("loanContractNo", data.getLoanContractNo());
}
//资方
if (StringUtils.isNotBlank(data.getBankName())) {
dataMap.put("bankName", data.getBankName());
}
if (StringUtils.isNotBlank(data.getBankContractNo())) {
dataMap.put("bankContractNo", data.getBankContractNo());
}
if (StringUtils.isNotBlank(data.getSettingDate())) {
dataMap.put("settingDate", data.getSettingDate());
}
if (StringUtils.isNotBlank(data.getOverdueMonthPrice())) {
dataMap.put("overdueMonthPrice", data.getOverdueMonthPrice());
}
if (StringUtils.isNotBlank(data.getCurrentNotDuePrice())) {
dataMap.put("currentNotDuePrice", data.getCurrentNotDuePrice());
}
if (StringUtils.isNotBlank(data.getNotDuePrice())) {
dataMap.put("notDuePrice", data.getNotDuePrice());
}
if (StringUtils.isNotBlank(loanSettleApply.getRemarks())) {
dataMap.put("remarks", loanSettleApply.getRemarks());
}
if (StringUtils.isNotBlank(data.getLoanDepositBank())) {
dataMap.put("loanDepositBank", data.getLoanDepositBank());
}
if (StringUtils.isNotBlank(data.getTopping())) {
dataMap.put("topping", data.getTopping());
}
if (StringUtils.isNotBlank(data.getPrice())) {
dataMap.put("price", data.getPrice());
}
if (StringUtils.isNotBlank(data.getCurrentNotDuePriceBank())) {
dataMap.put("currentNotDuePriceBank", data.getCurrentNotDuePriceBank());
}
if (StringUtils.isNotBlank(data.getNotDuePriceBank())) {
dataMap.put("notDuePriceBank", data.getNotDuePriceBank());
}
if (StringUtils.isNotBlank(data.getBankInterest())) {
dataMap.put("bankInterest", data.getBankInterest());
}
if (StringUtils.isNotBlank(data.getBankNominalPrice())) {
dataMap.put("bankNominalPrice", data.getBankNominalPrice());
}
if (StringUtils.isNotBlank(data.getBankContractLiquidated())) {
dataMap.put("bankContractLiquidated", data.getBankContractLiquidated());
}
if (StringUtils.isNotBlank(data.getBankOtherReceivable())) {
dataMap.put("bankOtherReceivable", data.getBankOtherReceivable());
}
if (StringUtils.isNotBlank(data.getOtherReceivableRemarks())) {
dataMap.put("otherReceivableRemarks", data.getOtherReceivableRemarks());
}
if (StringUtils.isNotBlank(data.getBankSettlePrice())) {
dataMap.put("bankSettlePrice", data.getBankSettlePrice());
}
if (StringUtils.isNotBlank(data.getBankAccount())) {
dataMap.put("bankAccount", data.getBankAccount());
}
if (StringUtils.isNotBlank(data.getAccountName())) {
dataMap.put("accountName", data.getAccountName());
}
if (StringUtils.isNotBlank(data.getLoanDeposit())) {
dataMap.put("loanDeposit", data.getLoanDeposit());
}
if (StringUtils.isNotBlank(data.getOverduePrice())) {
dataMap.put("overduePrice", data.getOverduePrice());
}
if (StringUtils.isNotBlank(data.getPutBankInterest())) {
dataMap.put("putBankInterest", data.getPutBankInterest());
}
if (StringUtils.isNotBlank(data.getFunfCost())) {
dataMap.put("funfCost", data.getFunfCost());
}
if (StringUtils.isNotBlank(data.getBankOverInterest())) {
dataMap.put("bankOverInterest", data.getBankOverInterest());
}
if (StringUtils.isNotBlank(data.getCompanyCurrentNotPrice())) {
dataMap.put("companyCurrentNotPrice", data.getCompanyCurrentNotPrice());
}
if (StringUtils.isNotBlank(data.getBankNotPrice())) {
dataMap.put("bankNotPrice", data.getBankNotPrice());
}
if (StringUtils.isNotBlank(data.getDeductionAmount())) {
dataMap.put("deductionAmount", data.getDeductionAmount());
}
if (StringUtils.isNotBlank(data.getCompanyNominalPrice())) {
dataMap.put("companyNominalPrice", data.getCompanyNominalPrice());
}
if (StringUtils.isNotBlank(data.getContractLiquidated())) {
dataMap.put("contractLiquidated", data.getContractLiquidated());
}
if (StringUtils.isNotBlank(data.getCompanyOtherPrice())) {
dataMap.put("companyOtherPrice", data.getCompanyOtherPrice());
}
if (StringUtils.isNotBlank(data.getOtherCostRemarks())) {
dataMap.put("otherCostRemarks", data.getOtherCostRemarks());
}
if (StringUtils.isNotBlank(data.getSettleAll())) {
dataMap.put("settleAll", data.getSettleAll());
}
if (StringUtils.isNotBlank(data.getFundPenalty())) {
dataMap.put("fundPenalty", data.getFundPenalty());
}
if (StringUtils.isNotBlank(data.getDepositPenalty())) {
dataMap.put("depositPenalty", data.getDepositPenalty());
}
if (StringUtils.isNotBlank(data.getOtherCost())) {
dataMap.put("otherCost", data.getOtherCost());
}
if (StringUtils.isNotBlank(data.getAmountTo())) {
dataMap.put("amountTo", data.getAmountTo());
}
if (StringUtils.isNotBlank(data.getProfit())) {
dataMap.put("profit", data.getProfit());
}
}
//获取审批记录
List<PCHistTaskListAndCommentList> flowRecordVo = flowableFeignPro.flowRecordAndComment(loanSettleApply.getProcInstId(), "1").getData();
List<BusSalesOrderSourceLCVo> busSalesOrderSourceLCVos = new ArrayList<>();
for (PCHistTaskListAndCommentList flowTask : flowRecordVo) {
if (flowTask.getFlowableRecordVo() != null) {
Map<String, Object> flowableRecordVo = flowTask.getFlowableRecordVo();
BusSalesOrderSourceLCVo busSalesOrderSourceLCVo = new BusSalesOrderSourceLCVo();
List<Map<String, Object>> taskUserInfos = ConstantUtils.getListData(flowableRecordVo, "taskUserInfos");
Map<String, Object> comment = ConstantUtils.getMap(flowableRecordVo, "comment");
String assigneeName = (String) taskUserInfos.get(0).get("assigneeName");
String comment1 = (String) comment.get("comment");
busSalesOrderSourceLCVo.setName(assigneeName);
busSalesOrderSourceLCVo.setComment(comment1);
busSalesOrderSourceLCVo.setSpsj(flowableRecordVo.get("finishTime").toString());
busSalesOrderSourceLCVos.add(busSalesOrderSourceLCVo);
} else {
Map<String, Object> processCommentVo = flowTask.getProcessCommentVo();
BusSalesOrderSourceLCVo busSalesOrderSourceLCVo = new BusSalesOrderSourceLCVo();
busSalesOrderSourceLCVo.setName(processCommentVo.get("title").toString());
busSalesOrderSourceLCVo.setComment(processCommentVo.get("content").toString());
busSalesOrderSourceLCVo.setSpsj(processCommentVo.get("time").toString());
busSalesOrderSourceLCVos.add(busSalesOrderSourceLCVo);
List<String> fileList = (List) processCommentVo.get("fileList");
if (fileList.size() > 0) {
for (String s : fileList) {
imgList.add(s);
}
}
}
}
List<Message> messages = messageFeign.selectByBusinessSid(loanSettleApply.getSid()).getData();
if (messages.size() > 0) {
for (Message message : messages) {
BusSalesOrderSourceLCVo busSalesOrderSourceLCVo = new BusSalesOrderSourceLCVo();
String receiverNames = "";
List<MessageList> messageLists = messageListFeign.fetchByMainSid(message.getSid()).getData();
if (messageLists.size() > 0) {
for (MessageList messageList : messageLists) {
receiverNames = receiverNames + messageList.getReceiverName() + ",";
}
}
busSalesOrderSourceLCVo.setName("系统");
busSalesOrderSourceLCVo.setComment("抄送 " + receiverNames.substring(0, receiverNames.lastIndexOf(",")));
busSalesOrderSourceLCVo.setSpsj(DateUtil.format(message.getCreateTime(), "yyyy-MM-dd HH:mm:ss"));
busSalesOrderSourceLCVos.add(busSalesOrderSourceLCVo);
}
}
busSalesOrderSourceLCVos.sort(comparing(BusSalesOrderSourceLCVo::getSpsj));
dataMap.put("lcList", busSalesOrderSourceLCVos);
//获取图片路径
LoanSettleBankCost loanSettleBankCost = loanSettleBankCostService.selectByMainSid(loanSettleApply.getSid());
if (null != loanSettleBankCost) {
if (StringUtils.isNotBlank(loanSettleBankCost.getFiles())) {
String notesImage = loanSettleBankCost.getFiles();
String[] notesImages = notesImage.split(",");
for (String image : notesImages) {
String urlPrefix = fileUploadComponent.getUrlPrefix();
try {
image = urlPrefix + URLEncoder.encode(image, "utf-8");
String image2Base64 = image2Base64(image);
photoList.add(image2Base64);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
}
}
}
if (imgList.size() > 0) {
for (String image : imgList) {
if (image.contains(fileUploadComponent.getUrlPrefix())) {
image = image.replace(fileUploadComponent.getUrlPrefix(), "");
try {
image = fileUploadComponent.getUrlPrefix() + URLEncoder.encode(image, "utf-8");
String image2Base64 = image2Base64(image);
photoList.add(image2Base64);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
}
}
}
dataMap.put("photoPath64", photoList);
//获取模板
String temp = "/template/";
String targetPath = docPdfComponent.getUploadTemplateUrl();
try {
//获取模板
InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream("ftl/jqsq2.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 rb.success().setData(finalPath);
}
public static String image2Base64(String imgUrl) {
URL url = null;
InputStream is = null;
ByteArrayOutputStream outStream = null;
HttpURLConnection httpUrl = null;
try {
url = new URL(imgUrl);
httpUrl = (HttpURLConnection) url.openConnection();
httpUrl.connect();
httpUrl.getInputStream();
is = httpUrl.getInputStream();
outStream = new ByteArrayOutputStream();
//创建一个Buffer字符串
byte[] buffer = new byte[1024];
//每次读取的字符串长度,如果为-1,代表全部读取完毕
int len = 0;
//使用一个输入流从buffer里把数据读取出来
while ((len = is.read(buffer)) != -1) {
//用输出流往buffer里写入数据,中间参数代表从哪个位置开始读,len代表读取的长度
outStream.write(buffer, 0, len);
}
// 对字节数组Base64编码
return Base64.encode(outStream.toByteArray());
} catch (Exception e) {
e.printStackTrace();
} finally {
if (is != null) {
try {
is.close();
} catch (IOException e) {
e.printStackTrace();
}
}
if (outStream != null) {
try {
outStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
if (httpUrl != null) {
httpUrl.disconnect();
}
}
return imgUrl;
}
}

4828
anrui-riskcenter/anrui-riskcenter-biz/src/main/resources/ftl/jqsq2.ftl

File diff suppressed because it is too large
Loading…
Cancel
Save