| | |
| | | package com.ruoyi.project.service.impl; |
| | | |
| | | import java.io.File; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.util.concurrent.ConcurrentHashMap; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.fasterxml.jackson.core.JsonProcessingException; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import com.google.gson.JsonObject; |
| | | import com.google.gson.JsonParser; |
| | | import com.ruoyi.common.config.RuoYiConfig; |
| | | import com.ruoyi.common.constant.HttpStatus; |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.common.core.domain.model.LoginUser; |
| | | import com.ruoyi.common.utils.HttpClientKit; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.bean.DtoConversionUtils; |
| | | import com.ruoyi.common.utils.uuid.IdUtils; |
| | | import com.ruoyi.project.domain.*; |
| | |
| | | import com.ruoyi.project.domain.vo.SpFinancialExpensesReimbursementOut; |
| | | import com.ruoyi.project.mapper.*; |
| | | import com.ruoyi.project.service.*; |
| | | import com.ruoyi.system.domain.SysUserRole; |
| | | import com.ruoyi.system.mapper.SysUserRoleMapper; |
| | | import com.ruoyi.system.service.ISysPostService; |
| | | import com.ruoyi.system.service.ISysUserService; |
| | | import com.sun.org.apache.bcel.internal.generic.NEW; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.collections4.CollectionUtils; |
| | | import org.apache.commons.lang3.ObjectUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.io.File; |
| | | import java.math.BigDecimal; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.util.concurrent.ConcurrentHashMap; |
| | | |
| | | /** |
| | | * 报销申请Service业务层处理 |
| | |
| | | |
| | | data.put("data", data2); |
| | | //模板编号,由致远方提供,该参数决定发起协同系统中哪个流程 |
| | | data.put("templateCode", "001"); |
| | | data.put("templateCode", "cyfbxd_rzhc_ceshi"); |
| | | //是否为待发:0:新建-发送;1:新建-保存待发 |
| | | data.put("draft", "0"); |
| | | //协同标题区附件,Long型List,值为附件的Id。Id是附件接口响应结果中fileUrl字段的值 |
| | | data.put("attachments", null); |
| | | //协同公文的id |
| | | data.put("relateDoc", "col|123,456;doc|321,654"); |
| | | // data.put("attachments", null); |
| | | // //协同公文的id |
| | | // data.put("relateDoc", "col|123,456;doc|321,654"); |
| | | //未设置取模板设置的标题 |
| | | data.put("subject", "null"); |
| | | data.put("subject", ""); |
| | | ServiceReimbursement serviceReimbursement1 = serviceReimbursementMapper.selectById(serviceReimbursement.getId()); |
| | | data.put("summaryId", serviceReimbursement1.getSummaryId() == null ? "" : serviceReimbursement1.getSummaryId()); |
| | | |
| | | map.put("data", data); |
| | | String strRes = null; |
| | | if (!active.equals("druid")) { |
| | | //如果是本地环境,就不调这个了 |
| | | String token = getToken(); |
| | | JSONObject json1 = JSONObject.parseObject(token); |
| | | token = json1.get("id").toString(); |
| | | |
| | | ObjectMapper objectMapper = new ObjectMapper(); |
| | | String json = null; |
| | | try { |
| | | json = objectMapper.writeValueAsString(map); |
| | | } catch (JsonProcessingException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | if (serviceReimbursement.getBackflowlevel() == 100L) { |
| | | strRes = HttpClientKit.postOpr(rexyurl, map.toString()); |
| | | log.error("-----------------Reimbursement再次发起的url为:{}, 入参为:{}", rexyurl + "?token=" + token, json); |
| | | strRes = HttpClientKit.postOpr(rexyurl + "?token=" + token, json); |
| | | } else { |
| | | strRes = HttpClientKit.postOpr(xyurl, map.toString()); |
| | | log.error("-----------------Reimbursement首次发起的url为:{}, 入参为:{}", xyurl + "?token=" + token, json); |
| | | strRes = HttpClientKit.postOpr(xyurl + "?token=" + token, json); |
| | | // 将summaryId保存起来,并将该值保存到fund中,用于再次发起时,使用(协友要求,再次发起时,带上这个值) |
| | | JsonObject root = JsonParser.parseString(strRes).getAsJsonObject(); |
| | | String code = root.get("code").getAsString(); |
| | | if ("0".equals(code)) { |
| | | String appBusinessData = root.getAsJsonObject("data").get("app_bussiness_data").getAsString(); |
| | | JsonObject appDataObj = JsonParser.parseString(appBusinessData).getAsJsonObject(); |
| | | String summaryId = appDataObj.get("summaryId").getAsString(); |
| | | serviceReimbursement.setSummaryId(summaryId); |
| | | serviceReimbursementMapper.updateById(serviceReimbursement); |
| | | } |
| | | } |
| | | com.alibaba.fastjson2.JSONObject jsonObject = com.alibaba.fastjson2.JSONObject.parseObject(strRes); |
| | | String code = jsonObject.getJSONObject("code").toString(); |
| | | } |
| | | log.error("-----Reimbursement-------------strRes的值为:{}", strRes); |
| | | JSONObject jsonObject = JSONObject.parseObject(strRes); |
| | | String code = jsonObject.getString("code"); |
| | | if (!code.equals("0")) { |
| | | return false; |
| | | } |
| | |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("交通工具", reimbursementdetailShared.getTraffictype()); |
| | | map.put("交通费", reimbursementdetailShared.getTrafficexpense()); |
| | | map.put("市内交通", reimbursementdetailShared.getTraffictype2()); |
| | | map.put("市内交通", reimbursementdetailShared.getCityfee()); |
| | | map.put("住宿费", reimbursementdetailShared.getHotelexpense()); |
| | | map.put("杂费", reimbursementdetailShared.getOtherexpense()); |
| | | map.put("伙食费报销", reimbursementdetailShared.getFoodexpenses()); |
| | | map.put("伙食费补助", reimbursementdetailShared.getFoodallowance()); |
| | | map.put("其他费用", reimbursementdetailShared.getOtherfeeamount()); |
| | | map.put("其他费用说明", reimbursementdetailShared.getOtherfeedesc()); |
| | | map.put("金额合计", null); |
| | | map.put("出差时间起", reimbursementdetailShared.getStarttime()); |
| | | map.put("金额合计", ""); |
| | | map.put("出差时间起", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(reimbursementdetailShared.getStarttime())); |
| | | map.put("出发地点", reimbursementdetailShared.getDeparture()); |
| | | map.put("出差时间止", reimbursementdetailShared.getEndtime()); |
| | | map.put("出差时间止", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(reimbursementdetailShared.getEndtime())); |
| | | map.put("出差目的地", reimbursementdetailShared.getDestination()); |
| | | map.put("天数", reimbursementdetailShared.getDays()); |
| | | map.put("实际报销金额", null); |
| | | BigDecimal total = safe(reimbursementdetailShared.getCityfee()).add(safe(reimbursementdetailShared.getTrafficexpense())).add(safe(reimbursementdetailShared.getHotelexpense())).add(safe(reimbursementdetailShared.getOtherexpense())).add(safe(reimbursementdetailShared.getFoodexpenses())).add(safe(reimbursementdetailShared.getFoodallowance())).add(safe(reimbursementdetailShared.getOtherfeeamount())); |
| | | map.put("实际报销金额", total); |
| | | map.put("财务备注", reimbursementdetailShared.getRemark()); |
| | | map.put("id", reimbursementdetailShared.getRdid()); |
| | | map.put("出差人", reimbursementdetailShared.getPersonname()); |
| | | map.put("回交通工具", null); |
| | | map.put("回交通工具", ""); |
| | | map.put("人员类别", reimbursementdetailShared.getPersontype()); |
| | | map.put("住宿费标准", null); |
| | | map.put("住宿费标准", ""); |
| | | map.put("住宿费标准合计", reimbursementdetailShared.getHotelexpense()); |
| | | String fpuuid = IdUtils.simpleUUID(); |
| | | Long fpuuid = System.currentTimeMillis(); |
| | | map.put("发票附件", fpuuid); |
| | | map.put("票据识别", null); |
| | | map.put("识别人", null); |
| | | map.put("序号1", null); |
| | | String qtuuid = IdUtils.simpleUUID(); |
| | | map.put("票据识别", ""); |
| | | map.put("识别人", ""); |
| | | map.put("序号1", ""); |
| | | Long qtuuid = System.currentTimeMillis(); |
| | | map.put("其他附件", qtuuid); |
| | | map.put("个人票夹用户", null); |
| | | map.put("识别票据", null); |
| | | map.put("个人票夹用户", ""); |
| | | map.put("识别票据", ""); |
| | | |
| | | list.add(map); |
| | | |
| | |
| | | return allMap; |
| | | } |
| | | |
| | | private BigDecimal safe(BigDecimal val) { |
| | | return val == null ? BigDecimal.ZERO : val; |
| | | } |
| | | |
| | | private List<Map<String, Object>> formson_1211(List<ServiceReimbursementpayeeShared> serviceReimbursementpayeeShareds) { |
| | | Map<String, List<Map<String, Object>>> allMap = new HashMap<>(); |
| | | |
| | |
| | | map.put("开户银行", serviceReimbursementpayeeShared.getBankname()); |
| | | map.put("打款金额", serviceReimbursementpayeeShared.getAmount()); |
| | | map.put("人员类别打款", serviceReimbursementpayeeShared.getPersontype()); |
| | | map.put("核算项目", null); |
| | | map.put("预算项目", null); |
| | | map.put("借方摘要", null); |
| | | map.put("贷方摘要", null); |
| | | map.put("核算项目", ""); |
| | | map.put("预算项目", ""); |
| | | map.put("借方摘要", ""); |
| | | map.put("贷方摘要", ""); |
| | | list.add(map); |
| | | } |
| | | return list; |
| | |
| | | private Map<String, Object> formmain_1209(ServiceReimbursementShared serviceReimbursementShared) { |
| | | Map<String, Object> formmain_1209 = new HashMap<>(); |
| | | |
| | | formmain_1209.put("报销日期", serviceReimbursementShared.getApplyTime()); |
| | | formmain_1209.put("出差人-作废", null); |
| | | formmain_1209.put("报销日期", new SimpleDateFormat("yyyy-MM-dd HH:mm").format(serviceReimbursementShared.getApplyTime())); |
| | | formmain_1209.put("出差人-作废", ""); |
| | | formmain_1209.put("报销人", serviceReimbursementShared.getUsername()); |
| | | formmain_1209.put("区域组长", serviceReimbursementShared.getManagername()); |
| | | formmain_1209.put("出差事由", serviceReimbursementShared.getReason()); |
| | | formmain_1209.put("天数合计", null); |
| | | formmain_1209.put("天数合计", 0.00); |
| | | formmain_1209.put("交通费合计", serviceReimbursementShared.getTotalamount()); |
| | | formmain_1209.put("市内交通合计", null); |
| | | formmain_1209.put("住宿费合计", null); |
| | | formmain_1209.put("杂费合计", null); |
| | | formmain_1209.put("伙食费报销合计", null); |
| | | formmain_1209.put("伙食费补助合计", null); |
| | | formmain_1209.put("其他费用合计", null); |
| | | formmain_1209.put("市内交通合计", 0.00); |
| | | formmain_1209.put("住宿费合计", 0.00); |
| | | formmain_1209.put("杂费合计", 0.00); |
| | | formmain_1209.put("伙食费报销合计", 0.00); |
| | | formmain_1209.put("伙食费补助合计", 0.00); |
| | | formmain_1209.put("其他费用合计", 0.00); |
| | | formmain_1209.put("领款金额大写", serviceReimbursementShared.getBigstrmoney()); |
| | | formmain_1209.put("领款金额", serviceReimbursementShared.getTotalamount()); |
| | | formmain_1209.put("领款金额", serviceReimbursementShared.getAmountrequested()); |
| | | formmain_1209.put("财务审批", serviceReimbursementShared.getFinancechecher()); |
| | | formmain_1209.put("财务部负责人审批", serviceReimbursementShared.getFinancedirector()); |
| | | formmain_1209.put("办公室主任审批", serviceReimbursementShared.getOfficedirector()); |
| | |
| | | formmain_1209.put("业务副院长审批", serviceReimbursementShared.getBusvicepresident()); |
| | | formmain_1209.put("财务副院长审批", serviceReimbursementShared.getFinvicepresident()); |
| | | formmain_1209.put("中心负责人审批", serviceReimbursementShared.getOpochecker()); |
| | | formmain_1209.put("开户银行-作废", null); |
| | | formmain_1209.put("卡号-作废", null); |
| | | formmain_1209.put("开户银行-作废", ""); |
| | | formmain_1209.put("卡号-作废", ""); |
| | | formmain_1209.put("支付方式", serviceReimbursementShared.getZffs()); |
| | | formmain_1209.put("组长", null); |
| | | formmain_1209.put("审批人员", null); |
| | | formmain_1209.put("组长", ""); |
| | | formmain_1209.put("审批人员", ""); |
| | | formmain_1209.put("支付日期", serviceReimbursementShared.getRiqi()); |
| | | formmain_1209.put("上传附件", null); |
| | | formmain_1209.put("打款合计", null); |
| | | formmain_1209.put("发票识别-作废", null); |
| | | formmain_1209.put("识别人-作废", null); |
| | | formmain_1209.put("财务审批签字", null); |
| | | formmain_1209.put("上传附件", ""); |
| | | formmain_1209.put("打款合计", 0.00); |
| | | formmain_1209.put("发票识别-作废", ""); |
| | | formmain_1209.put("识别人-作废", ""); |
| | | formmain_1209.put("财务审批签字", ""); |
| | | formmain_1209.put("财务部负责人审批签字", serviceReimbursementShared.getFinancedirector()); |
| | | formmain_1209.put("表单编号1", null); |
| | | formmain_1209.put("CIF账套配置1", null); |
| | | formmain_1209.put("院区", null); |
| | | formmain_1209.put("业务区域", null); |
| | | formmain_1209.put("贷方科目", null); |
| | | formmain_1209.put("编码", null); |
| | | formmain_1209.put("是否支付", null); |
| | | formmain_1209.put("凭证号", null); |
| | | formmain_1209.put("银行回单", null); |
| | | formmain_1209.put("OFD", null); |
| | | formmain_1209.put("表单附件", null); |
| | | formmain_1209.put("10204", null); |
| | | formmain_1209.put("现金流量分析", null); |
| | | formmain_1209.put("表单编号1", ""); |
| | | formmain_1209.put("CIF账套配置1", ""); |
| | | formmain_1209.put("院区", ""); |
| | | formmain_1209.put("业务区域", ""); |
| | | formmain_1209.put("贷方科目", ""); |
| | | formmain_1209.put("编码", ""); |
| | | formmain_1209.put("是否支付", ""); |
| | | formmain_1209.put("凭证号", ""); |
| | | formmain_1209.put("银行回单", ""); |
| | | formmain_1209.put("OFD", ""); |
| | | formmain_1209.put("表单附件", ""); |
| | | formmain_1209.put("10204", ""); |
| | | formmain_1209.put("现金流量分析", ""); |
| | | formmain_1209.put("捐献者", serviceReimbursementShared.getDonorname()); |
| | | formmain_1209.put("凭证类别", null); |
| | | formmain_1209.put("合计", null); |
| | | formmain_1209.put("实际合计", null); |
| | | formmain_1209.put("伙食补助合计", null); |
| | | formmain_1209.put("历史审批记录", null); |
| | | formmain_1209.put("表单编号", serviceReimbursementShared.getBh()); |
| | | formmain_1209.put("历史审批巨鹿查询", null); |
| | | formmain_1209.put("凭证类别", ""); |
| | | formmain_1209.put("合计", 0.00); |
| | | formmain_1209.put("实际合计", 0.00); |
| | | formmain_1209.put("伙食补助合计", 0.00); |
| | | formmain_1209.put("历史审批记录", ""); |
| | | formmain_1209.put("表单编号", serviceReimbursementShared.getReimid()); |
| | | formmain_1209.put("历史审批巨鹿查询", ""); |
| | | return formmain_1209; |
| | | } |
| | | |
| | |
| | | log.info("uploadOAFileAndUpdate方法的入参:{}", remShare); |
| | | System.out.println("uploadOAFileAndUpdate方法的入参:" + remShare); |
| | | //上传OA文件 |
| | | //String strUrl = "http://129.88.242.39:8899/seeyon/rest/token?userName=opo&password=127814f8-84e8-4304-84a5-a71573567efd&loginName=demo3"; |
| | | String strUrl = "http://129.88.242.39:8899/seeyon/rest/token"; |
| | | //String strUrl = "http://slb.hospitalstar.com:8899/seeyon/rest/token"; |
| | | //上传文件成功后,去更新相关的数据库 |
| | | |
| | | Map<String, Object> map = new HashMap<String, Object>(); |
| | | map.put("userName", "opo"); |
| | | map.put("password", "4126407a-9821-4874-be41-6568abd6dbe5"); |
| | | map.put("loginName", "demo3"); |
| | | |
| | | JSONObject jsonObj = new JSONObject(map); |
| | | |
| | | System.out.println("uploadOAFileAndUpdateDb + jsonObject" + jsonObj.toString() + "\r\n" + jsonObj.toJSONString()); |
| | | String strRes = HttpClientKit.postOpr(strUrl, jsonObj.toString()); |
| | | String strRes = getToken(); |
| | | |
| | | JSONObject json1 = JSONObject.parseObject(strRes); |
| | | strRes = json1.get("id").toString(); |
| | |
| | | return 0; |
| | | } |
| | | |
| | | private String getToken() { |
| | | String strUrl = "http://129.88.242.39:8899/seeyon/rest/token"; |
| | | //String strUrl = "http://slb.hospitalstar.com:8899/seeyon/rest/token"; |
| | | //上传文件成功后,去更新相关的数据库 |
| | | |
| | | Map<String, Object> map = new HashMap<String, Object>(); |
| | | map.put("userName", "opo"); |
| | | map.put("password", "4126407a-9821-4874-be41-6568abd6dbe5"); |
| | | map.put("loginName", "demo"); |
| | | |
| | | JSONObject jsonObj = new JSONObject(map); |
| | | |
| | | System.out.println("uploadOAFileAndUpdateDb + jsonObject" + jsonObj.toString() + "\r\n" + jsonObj.toJSONString()); |
| | | String strRes = HttpClientKit.postOpr(strUrl, jsonObj.toString()); |
| | | return strRes; |
| | | } |
| | | |
| | | private Integer uploadFile(String filePath, String strFUrl, List<RbDetailFile> parseArray2, List<RbDetailFile> parseArray, ServiceReimbursementdetailShared remShare, String flag) throws Exception { |
| | | if (!CollectionUtils.isEmpty(parseArray)) { |
| | | for (int i = 0; i < parseArray.size(); i++) { |