|
|
|
@ -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());
|
|
|
|
|