付款单模板,导入文件修复bug

product
chuang 2 years ago
parent b8d3e0c46b
commit 9e646d7f36

@ -52,10 +52,10 @@ public class MobilePortController {
* @param id id
* @throws Exception
*/
@GetMapping(value = "/getPaymentDocPdf/{id}", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public void getPaymentDocPdf(HttpServletResponse response,@PathVariable("id") String id) throws IOException {
@GetMapping(value = "/getPaymentDocPdf/{id}/{token}", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public void getPaymentDocPdf(HttpServletResponse response,@PathVariable("id") String id,@PathVariable("token") String token) throws IOException {
String idd="410787543580384837";
paymentdocService.getPaymentDocPdf(id);
paymentdocService.getPaymentDocPdf(id,token);
}

@ -155,7 +155,7 @@ public class FileCopy {
List<Object> objects2 = reader.readColumn(0, 0, 1);
// 公司名字
String companyStr = String.valueOf(objects2.get(0));
companyStr=companyStr.substring(0,companyStr.lastIndexOf("废钢收货"));
companyStr=companyStr.substring(0,companyStr.lastIndexOf("公司")+2);
// 销售合同编码
String infoStr = String.valueOf(objects2.get(1));

@ -3,6 +3,7 @@ package jnpf.paymentdoc.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import jnpf.paymentdoc.entity.PaymentdocEntity;
import jnpf.paymentdoc.model.paymentdoc.PaymentdocMessage;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -20,4 +21,5 @@ public interface PaymentdocMapper extends BaseMapper<PaymentdocEntity> {
List<Map<String, Object>> getPaymentDocNodeInfo(@Param("id") String id);
List<PaymentdocMessage> getPaymentDocMessage(@Param("id") String id);
}

@ -0,0 +1,54 @@
package jnpf.paymentdoc.model.paymentdoc;
import lombok.Data;
/**
* @Author: WangChuang
* @Date: 11/4/2023 10:14
* @Description //注释:
* @Version 1.0
*/
@Data
public class PaymentdocMessage {
/**付款请示**/
private String customerName;
/**供应商名称**/
private String supplierName;
/**申请金额**/
private String ramout;
/**已支付金额**/
private String paymentAmout;
/**账号**/
private String collectionAccout;
/**银行**/
private String colletionBank;
/**报告要点及备注**/
private String remark;
/**附件**/
private String enclosure;
/**付款类型**/
private String payType;
/**姓名**/
private String realName;
/**手机号**/
private String mobilePhone;
/**时间**/
private String nowTime;
/**拟稿单位**/
private String fullName;
}

@ -40,5 +40,5 @@ public interface PaymentdocService extends IService<PaymentdocEntity> {
//列表子表数据方法
void getPaymentDocPdf(String id) throws IOException;
void getPaymentDocPdf(String id,String token) throws IOException;
}

@ -1,29 +1,40 @@
package jnpf.paymentdoc.service.impl;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import jnpf.base.ActionResult;
import jnpf.base.UserInfo;
import jnpf.engine.controller.FlowBeforeController;
import jnpf.engine.model.flowbefore.FlowBeforeInfoVO;
import jnpf.engine.model.flowbefore.FlowTaskOperatorRecordModel;
import jnpf.exception.WorkFlowException;
import jnpf.mobilePort.utils.ExportPdf;
import jnpf.paymentdoc.entity.PaymentdocEntity;
import jnpf.paymentdoc.entity.PaymentdocItem0Entity;
import jnpf.paymentdoc.entity.PaymentdocItem1Entity;
import jnpf.paymentdoc.entity.PaymentdocItem2Entity;
import jnpf.paymentdoc.mapper.PaymentdocMapper;
import jnpf.paymentdoc.model.paymentdoc.PaymentdocMessage;
import jnpf.paymentdoc.model.paymentdoc.PaymentdocPagination;
import jnpf.paymentdoc.service.PaymentdocItem0Service;
import jnpf.paymentdoc.service.PaymentdocItem1Service;
import jnpf.paymentdoc.service.PaymentdocItem2Service;
import jnpf.paymentdoc.service.PaymentdocService;
import jnpf.permission.entity.UserEntity;
import jnpf.permission.mapper.UserMapper;
import jnpf.permission.model.authorize.AuthorizeConditionModel;
import jnpf.permission.service.AuthorizeService;
import jnpf.permission.service.OrganizeService;
import jnpf.permission.util.PermissionUtil;
import jnpf.supplier.entity.SupplierEntity;
import jnpf.supplier.service.SupplierService;
import jnpf.util.ServletUtil;
import jnpf.util.StringUtil;
import jnpf.util.UserProvider;
import jnpf.util.*;
import jnpf.util.context.SpringContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -35,10 +46,8 @@ import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.lang.reflect.Field;
import java.net.URLEncoder;
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;
/**
@ -362,15 +371,69 @@ public class PaymentdocServiceImpl extends ServiceImpl<PaymentdocMapper, Payment
return paymentdocItem2Service.list(queryWrapper);
}
@Resource
private UserMapper userMapper;
@Resource
private OrganizeService organizeService;
@Override
public void getPaymentDocPdf(String id) throws IOException {
public void getPaymentDocPdf(String id,String token) throws IOException {
List<PaymentdocItem2Entity> item2Entities = this.GetPaymentdocItem2List(id);
List<Map<String, Object>> paymentDocNodeInfo = paymentdocMapper.getPaymentDocNodeInfo(id);
List<PaymentdocMessage> paymentDocMessage = paymentdocMapper.getPaymentDocMessage(id);
PaymentdocMessage paymentdocMessage = null;
if (paymentDocMessage!=null&&paymentDocMessage.size()>0){
paymentdocMessage = paymentDocMessage.get(0);
}
// String id1=userProvider.get().getUserId();
UserProvider userProvider = SpringContext.getBean(UserProvider.class);
UserInfo userInfo = userProvider.get(token);
String id1 = userInfo.getUserId();
// String id1 = userProvider.get().getId();
if (id1!=null){
QueryWrapper<UserEntity> userEntityQueryWrapper = new QueryWrapper<>();
userEntityQueryWrapper.lambda().eq(UserEntity::getId,id1);
List<UserEntity> userEntities = userMapper.selectList(userEntityQueryWrapper);
UserEntity userEntity = userEntities.get(0);
paymentdocMessage.setRealName(userEntity.getRealName());
paymentdocMessage.setMobilePhone(userEntity.getMobilePhone());
paymentdocMessage.setNowTime(new SimpleDateFormat("YYYY-mm-dd HH:MM:SS").format(new Date()));
// 获取组织
if(StringUtil.isNotNull(userEntity.getOrganizeId())){
paymentdocMessage.setFullName(PermissionUtil.getLinkInfoByOrgId(userEntity.getOrganizeId(), organizeService, false));
}
}
// String templateFilePath = configValueUtil.getTemplateFilePath() +"paymentDocPdf//";
HashMap<String, Object> map = new HashMap<>();
map.put("reportList",paymentDocNodeInfo);
Map<String, Object> map = JsonUtil.stringToMap(JSONUtil.toJsonStr(paymentDocMessage));
// map.put("reportList",paymentDocNodeInfo);
FlowBeforeController bean = SpringContext.getBean(FlowBeforeController.class);
ActionResult info = null;
try {
info = bean.info(id, null, null);
} catch (WorkFlowException e) {
throw new RuntimeException(e);
}
FlowBeforeInfoVO data = (FlowBeforeInfoVO)info.getData();
List<FlowTaskOperatorRecordModel> recordList = data.getFlowTaskOperatorRecordList();
List<Map<String, Object>> maps = new ArrayList<>();
for (int i = 0; i < recordList.size(); i++) {
Map<String, Object> map1 = new HashMap<String, Object>();
FlowTaskOperatorRecordModel model = recordList.get(i);
Map<String, Object> map2 = paymentDocNodeInfo.get(i);
map1.put("realName",model.getUserName());
map1.put("nodeName",model.getNodeName());
map1.put("handleOpinion",model.getHandleOpinion());
map1.put("handleTime",DateUtil.daFormat(model.getHandleTime()));
map1.put("node",map2.get("node"));
maps.add(map1);
}
map.put("reportList",maps);
byte[] bytes = null;
ByteArrayOutputStream out = null;
ExportPdf exportPdf = new ExportPdf();
@ -396,6 +459,7 @@ public class PaymentdocServiceImpl extends ServiceImpl<PaymentdocMapper, Payment
// 设置response的Header
response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + filen );
response.setContentType("application/x-download;charset=utf-8");
BufferedOutputStream toClient = null;
try {
toClient = new BufferedOutputStream(response.getOutputStream());

@ -7,7 +7,8 @@
CONCAT( b.F_Account, '/', b.F_RealName ) realName,
a.F_NodeName nodeName,
a.F_HandleOpinion handleOpinion,
DATE_FORMAT(a.F_HandleTime, '%Y-%m-%d %T') handleTime
DATE_FORMAT(a.F_HandleTime, '%Y-%m-%d %T') handleTime,
( CASE a.F_NodeName WHEN '开始' THEN 'first' WHEN '最终审批' THEN 'last' ELSE 'node' END ) node
FROM
`flow_taskoperatorrecord` a
LEFT JOIN base_user b ON a.F_HandleId = b.F_Account
@ -26,5 +27,45 @@
<result property="handleOpinion" column="handleOpinion"/>
<!--节点时间-->
<result property="handleTime" column="handleTime"/>
<!--节点信息-->
<result property="node" column="node"/>
</resultMap>
<resultMap id="getPaymentDocMessageMap" type="jnpf.paymentdoc.model.paymentdoc.PaymentdocMessage">
<result column="customerName" property="customerName"/>
<result column="supplierName" property="supplierName"/>
<result column="ramout" property="ramout"/>
<result column="paymentAmout" property="paymentAmout"/>
<result column="collectionAccout" property="collectionAccout"/>
<result column="colletionBank" property="colletionBank"/>
<result column="remark" property="remark"/>
<result column="enclosure" property="enclosure"/>
<result column="payType" property="payType"/>
</resultMap>
<select id="getPaymentDocMessage" resultMap="getPaymentDocMessageMap">
SELECT
a.customer_name customerName,
b.supplier_name supplierName,
a.ramount ramout,
a.payment_amount paymentAmout,
a.collection_account collectionAccout,
a.colection_bank colletionBank,
a.remark remark,
c.enclosure enclosure,
( CASE a.payment_type
WHEN '0' THEN
'贷款'
WHEN '1' THEN
'运费'
WHEN '2' THEN
'仓储'
END) payType
FROM
jg_paymentdoc a
LEFT JOIN jg_supplier b ON a.supplier_id = b.id
LEFT JOIN jg_paymentdoc_item2 c ON a.id = c.paymentdoc_id
WHERE
a.ID = #{id}
</select>
</mapper>

@ -28,7 +28,7 @@
class="el-descriptions-item__cell el-descriptions-item__label is-bordered-label "
style="text-align: center; background-color: rgb(231, 242, 251); color: black;">标题</th>
<td colspan="3" class="el-descriptions-item__cell el-descriptions-item__content"
style="color: black;">再生资源关于支付采购贷款的请示2023年3月28日</td>
style="color: black;">${customerName!""}的请示</td>
</tr>
</tbody>
<tbody>
@ -38,13 +38,13 @@
style="text-align: center; background-color: rgb(231, 242, 251); color: black;">拟稿单位
</th>
<td colspan="1" class="el-descriptions-item__cell el-descriptions-item__content"
style="color: black;">济钢集团有限公司-济钢城市矿产科技有限公司-再生资源事业部</td>
style="color: black;">${fullName!""}</td>
<th colspan="1"
class="el-descriptions-item__cell el-descriptions-item__label is-bordered-label "
style="text-align: center; background-color: rgb(231, 242, 251); color: black;">拟稿日期
</th>
<td colspan="1" class="el-descriptions-item__cell el-descriptions-item__content"
style="color: black;">2023年3月28日</td>
style="color: black;">${nowTime!""}</td>
</tr>
</tbody>
<tbody>
@ -53,14 +53,13 @@
class="el-descriptions-item__cell el-descriptions-item__label is-bordered-label "
style="text-align: center; background-color: rgb(231, 242, 251); color: black;">拟稿人</th>
<td colspan="1" class="el-descriptions-item__cell el-descriptions-item__content"
style="color: black;">马继林</td>
style="color: black;">${realName!""}</td>
<th colspan="1"
class="el-descriptions-item__cell el-descriptions-item__label is-bordered-label "
style="text-align: center; background-color: rgb(231, 242, 251); color: black;">联系电话
</th>
<td colspan="1" class="el-descriptions-item__cell el-descriptions-item__content"
style="color: black;"> 88888888 <span
class="el-tag el-tag--small el-tag--light">学校</span></td>
style="color: black;"> ${mobilePhone!""}</td>
</tr>
</tbody>
<tbody>
@ -70,13 +69,13 @@
style="text-align: center; background-color: rgb(231, 242, 251); color: black;">供应商名称
</th>
<td colspan="1" class="el-descriptions-item__cell el-descriptions-item__content"
style="color: black;">普通</td>
style="color: black;">${supplierName!""}</td>
<th colspan="1"
class="el-descriptions-item__cell el-descriptions-item__label is-bordered-label "
style="text-align: center; background-color: rgb(231, 242, 251); color: black;">申请金额
</th>
<td colspan="1" class="el-descriptions-item__cell el-descriptions-item__content"
style="color: black;">普通</td>
style="color: black;">${ramout!""}</td>
</tr>
</tbody>
<tbody>
@ -86,12 +85,12 @@
style="text-align: center; background-color: rgb(231, 242, 251); color: black;">已支付金额
</th>
<td colspan="1" class="el-descriptions-item__cell el-descriptions-item__content"
style="color: black;"></td>
style="color: black;">${paymentAmout!""}</td>
<th colspan="1"
class="el-descriptions-item__cell el-descriptions-item__label is-bordered-label "
style="text-align: center; background-color: rgb(231, 242, 251); color: black;">账号</th>
<td colspan="1" class="el-descriptions-item__cell el-descriptions-item__content"
style="color: black;"></td>
style="color: black;">${collectionAccout!""}</td>
</tr>
</tbody>
<tbody>
@ -100,13 +99,13 @@
class="el-descriptions-item__cell el-descriptions-item__label is-bordered-label "
style="text-align: center; background-color: rgb(231, 242, 251); color: black;">银行</th>
<td colspan="1" class="el-descriptions-item__cell el-descriptions-item__content"
style="color: black;"></td>
style="color: black;">${colletionBank!""}</td>
<th colspan="1"
class="el-descriptions-item__cell el-descriptions-item__label is-bordered-label "
style="text-align: center; background-color: rgb(231, 242, 251); color: black;">付款类型
</th>
<td colspan="1" class="el-descriptions-item__cell el-descriptions-item__content"
style="color: black;"></td>
style="color: black;">${payType!""}</td>
</tr>
</tbody>
<tbody>
@ -116,7 +115,7 @@
style="text-align: center; background-color: rgb(231, 242, 251); color: black;">报告要点及备注
</th>
<td colspan="3" class="el-descriptions-item__cell el-descriptions-item__content"
style="color: black;">dsadsa</td>
style="color: black;">${remark!""}</td>
</tr>
</tbody>
<tbody>
@ -125,7 +124,7 @@
class="el-descriptions-item__cell el-descriptions-item__label is-bordered-label "
style="text-align: center; background-color: rgb(231, 242, 251); color: black;">附件</th>
<td colspan="3" class="el-descriptions-item__cell el-descriptions-item__content"
style="color: black;">dsadsa</td>
style="color: black;">${enclosure!""}</td>
</tr>
</tbody>
<div class="pageNext" ></div>
@ -141,8 +140,7 @@
<#if reportList?? && (reportList?size>0)>
<#list reportList as reportData>
<#if reportData??>
<#if reportData?is_last>
<#if reportData?is_first && (reportData.node=="first")>
<li class="el-timeline-item">
<div class="el-timeline-item__tail"></div>
<div
@ -157,14 +155,14 @@
<div class="el-card box-card is-always-shadow"><!---->
<div class="el-card__body">
<div class="text item">
流程结束
发起人:${reportData.realName!""}
</div>
</div>
</div>
</div><!---->
</div>
</li>
<#elseif reportData?is_first >
<#elseif reportData?is_last && (reportData.node=="last")>
<li class="el-timeline-item">
<div class="el-timeline-item__tail"></div>
<div
@ -179,7 +177,7 @@
<div class="el-card box-card is-always-shadow"><!---->
<div class="el-card__body">
<div class="text item">
发起人:${reportData.realName!""}
流程结束
</div>
</div>
</div>
@ -187,7 +185,7 @@
</div>
</li>
<#else >
<li class="el-timeline-item">
<li class="el-timeline-item" >
<div class="el-timeline-item__tail"></div>
<div
class="el-timeline-item__node el-timeline-item__node--normal el-timeline-item__node--">

@ -36,12 +36,7 @@
</head>
<body>
<div class='wrapper'>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<h1 style="text-align: center">${title!""}</h1>

Loading…
Cancel
Save