| | |
| | | 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.AjaxResult; |
| | |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.bean.DtoConversionUtils; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.common.utils.uuid.IdUtils; |
| | | import com.ruoyi.project.domain.*; |
| | | import com.ruoyi.project.domain.vo.*; |
| | | import com.ruoyi.project.mapper.*; |
| | |
| | | import com.ruoyi.system.mapper.SysUserMapper; |
| | | import com.ruoyi.system.mapper.SysUserRoleMapper; |
| | | import com.ruoyi.system.service.ISysUserService; |
| | | import com.taobao.api.ApiException; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang3.ObjectUtils; |
| | | import org.apache.poi.ss.usermodel.*; |
| | |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | |
| | | import java.io.File; |
| | | import java.io.FileInputStream; |
| | | import java.io.FileOutputStream; |
| | | import java.io.InputStream; |
| | | import java.math.BigDecimal; |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.util.concurrent.ConcurrentHashMap; |
| | |
| | | Long flowlevel = null; |
| | | if (serviceProcessVO.getApplytype().equals("0")) { |
| | | ServiceReimbursement serviceReimbursement = new ServiceReimbursement(); |
| | | serviceReimbursement.setId(serviceProcessVO.getBackCode()); |
| | | serviceReimbursement.setId(StringUtils.isNotEmpty(serviceProcessVO.getBackCode()) ? Long.valueOf(serviceProcessVO.getBackCode()) : null); |
| | | List<ServiceReimbursement> serviceReimbursementList = iServiceReimbursementService.queryList(serviceReimbursement); |
| | | if (CollectionUtils.isEmpty(serviceReimbursementList)) { |
| | | log.error("serviceReimbursementList没有查到数据:{}", serviceProcessVO.getBackCode()); |
| | |
| | | applytype = "0"; |
| | | } else { |
| | | ServiceFund serviceFund = new ServiceFund(); |
| | | serviceFund.setId(serviceProcessVO.getBackCode()); |
| | | serviceFund.setId(StringUtils.isNotEmpty(serviceProcessVO.getBackCode()) ? Long.valueOf(serviceProcessVO.getBackCode()) : null); |
| | | List<ServiceFund> serviceFunds = queryInfoById(serviceFund); |
| | | if (CollectionUtils.isEmpty(serviceFunds)) { |
| | | log.error("serviceFunds没有查到数据:{}", serviceProcessVO.getBackCode()); |
| | |
| | | applytype = serviceFunds.get(0).getApplytype(); |
| | | } |
| | | |
| | | //将操作保存到fundflow表中 |
| | | ServiceFundflow serviceFundflow = new ServiceFundflow(); |
| | | serviceFundflow.setCreateBy("admin"); |
| | | serviceFundflow.setCreateTime(new Date()); |
| | | serviceFundflow.setUpdateBy("admin"); |
| | | serviceFundflow.setUpdateTime(new Date()); |
| | | serviceFundflow.setCheckusername(serviceProcessVO.getCheckusername()); |
| | | serviceFundflow.setFlowcontent(serviceProcessVO.getFlowcontent()); |
| | | serviceFundflow.setFlowconclusion(1); |
| | | serviceFundflow.setFundtype(2); |
| | | serviceFundflow.setFlowlevel(flowlevel.intValue()); |
| | | if (serviceProcessVO.getFlowconclusion() == 3) serviceFundflow.setFlowlevel(999); |
| | | serviceFundflow.setApplytype(applytype); |
| | | serviceFundflow.setFundid(serviceProcessVO.getBackCode()); |
| | | serviceFundflow.setCheckTime(serviceProcessVO.getCheckTime()); |
| | | fundflowService.save(serviceFundflow); |
| | | // //将操作保存到fundflow表中 |
| | | // ServiceFundflow serviceFundflow = new ServiceFundflow(); |
| | | // serviceFundflow.setCreateBy("admin"); |
| | | // serviceFundflow.setCreateTime(new Date()); |
| | | // serviceFundflow.setUpdateBy("admin"); |
| | | // serviceFundflow.setUpdateTime(new Date()); |
| | | // serviceFundflow.setCheckusername(serviceProcessVO.getCheckusername()); |
| | | // serviceFundflow.setFlowcontent(serviceProcessVO.getFlowcontent()); |
| | | // serviceFundflow.setFlowconclusion(1); |
| | | // serviceFundflow.setFundtype(2); |
| | | // serviceFundflow.setFlowlevel(flowlevel.intValue()); |
| | | // if (StringUtils.isNotEmpty(serviceProcessVO.getFlowconclusion()) && serviceProcessVO.getFlowconclusion().equals("3")) |
| | | // serviceFundflow.setFlowlevel(999); |
| | | // serviceFundflow.setApplytype(applytype); |
| | | // serviceFundflow.setFundid(StringUtils.isNotEmpty(serviceProcessVO.getBackCode()) ? Long.valueOf(serviceProcessVO.getBackCode()) : null); |
| | | // serviceFundflow.setCheckTime(serviceProcessVO.getCheckTime()); |
| | | // fundflowService.save(serviceFundflow); |
| | | |
| | | |
| | | SysUser sysUser = sysUserService.selectUserByUserName(userNo); |
| | |
| | | serviceSystemmessage.setMessagecontent(serviceProcessVO.getFlowcontent()); |
| | | iServiceSystemmessageService.save(serviceSystemmessage); |
| | | |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | public Boolean updatecodepay(ServiceCodeAndPyaWay serviceCodeAndPyaWay) { |
| | | Integer i = null; |
| | | if (StringUtils.isNotEmpty(serviceCodeAndPyaWay.getApplytype()) && !serviceCodeAndPyaWay.getApplytype().equals("0")) { |
| | | ServiceFund serviceFund = new ServiceFund(); |
| | | serviceFund.setId(serviceCodeAndPyaWay.getBackCode()); |
| | | serviceFund.setBh(serviceCodeAndPyaWay.getBh()); |
| | | serviceFund.setZffs(serviceCodeAndPyaWay.getZffs()); |
| | | serviceFund.setRiqi(serviceCodeAndPyaWay.getRiqi()); |
| | | i = serviceFundMapper.updateById(serviceFund); |
| | | |
| | | ServiceFundShared serviceFundShared = new ServiceFundShared(); |
| | | serviceFundShared.setSerfunid(serviceFund.getId()); |
| | | serviceFundShared.setZffs(serviceFund.getZffs()); |
| | | serviceFundShared.setRiqi(serviceFund.getRiqi()); |
| | | serviceFundShared.setBh(serviceFund.getBh()); |
| | | serviceFundSharedMapper.updateShareByfundid(serviceFundShared); |
| | | } else { |
| | | ServiceReimbursement serviceReimbursement = new ServiceReimbursement(); |
| | | serviceReimbursement.setId(serviceCodeAndPyaWay.getBackCode()); |
| | | serviceReimbursement.setBh(serviceCodeAndPyaWay.getBh()); |
| | | serviceReimbursement.setZffs(serviceCodeAndPyaWay.getZffs()); |
| | | serviceReimbursement.setRiqi(serviceCodeAndPyaWay.getRiqi()); |
| | | i = serviceReimbursementMapper.updateById(serviceReimbursement); |
| | | |
| | | ServiceReimbursementShared serviceReimbursementShared = new ServiceReimbursementShared(); |
| | | serviceReimbursementShared.setReimid(serviceReimbursement.getId()); |
| | | serviceReimbursementShared.setBh(serviceReimbursement.getBh()); |
| | | serviceReimbursementShared.setZffs(serviceReimbursement.getZffs()); |
| | | serviceReimbursementShared.setRiqi(serviceReimbursement.getRiqi()); |
| | | serviceReimbursementSharedMapper.updateReimShareByfundid(serviceReimbursementShared); |
| | | } |
| | | if (i == 0) return false; |
| | | return true; |
| | | } |
| | | |
| | |
| | | |
| | | data.put("data", data2); |
| | | //模板编号,由致远方提供,该参数决定发起协同系统中哪个流程 |
| | | data.put("templateCode", "001"); |
| | | data.put("templateCode", "fybxd_rzhc_ceshi"); |
| | | //是否为待发:0:新建-发送;1:新建-保存待发 |
| | | data.put("draft", "0"); |
| | | //协同标题区附件,Long型List,值为附件的Id。Id是附件接口响应结果中fileUrl字段的值 |
| | | data.put("attachments", null); |
| | | // data.put("attachments", null); |
| | | //协同公文的id |
| | | data.put("relateDoc", "col|123,456;doc|321,654"); |
| | | // data.put("relateDoc", "col|123,456;doc|321,654"); |
| | | //未设置取模板设置的标题 |
| | | data.put("subject", "null"); |
| | | ServiceFund serviceFund1 = serviceFundMapper.selectById(serviceFund.getId()); |
| | | data.put("summaryId", serviceFund1.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; |
| | | if (serviceFund.getBackflowlevel() == 100L) { |
| | | //再次发起 |
| | | strRes = HttpClientKit.postOpr(rexyurl, map.toString()); |
| | | try { |
| | | json = objectMapper.writeValueAsString(map); |
| | | log.error("-----------------再次发起的url为:{}, 入参为:{}", rexyurl + "?token=" + token, json); |
| | | } catch (JsonProcessingException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | strRes = HttpClientKit.postOpr(rexyurl + "?token=" + token, json); |
| | | } else { |
| | | //首次发起 |
| | | strRes = HttpClientKit.postOpr(xyurl, map.toString()); |
| | | try { |
| | | json = objectMapper.writeValueAsString(map); |
| | | log.error("-----------------首次发起的url为:{}, 入参为:{}", xyurl + "?token=" + token, json); |
| | | } catch (JsonProcessingException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | 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(); |
| | | serviceFund.setSummaryId(summaryId); |
| | | serviceFundMapper.updateById(serviceFund); |
| | | } |
| | | } |
| | | com.alibaba.fastjson2.JSONObject jsonObject = com.alibaba.fastjson2.JSONObject.parseObject(strRes); |
| | | String code = jsonObject.getJSONObject("code").toString(); |
| | | } |
| | | log.error("------------------strRes的值为:{}", strRes); |
| | | JSONObject jsonObject = JSONObject.parseObject(strRes); |
| | | String code = jsonObject.getString("code"); |
| | | if (!code.equals("0")) { |
| | | return false; |
| | | } |
| | |
| | | map.put("收益人家属或专家", serviceFunddetailShared.getBeneficiaryname()); |
| | | map.put("税后金额", serviceFunddetailShared.getTaxamount()); |
| | | map.put("作废最终金额", null); |
| | | String fpuuid = IdUtils.simpleUUID(); |
| | | Long fpuuid = System.currentTimeMillis() + 5; |
| | | map.put("发票附件", fpuuid); |
| | | map.put("发票识别", null); |
| | | map.put("识别人", null); |
| | | map.put("税额", null); |
| | | String qtuuid = IdUtils.simpleUUID(); |
| | | long qtuuid = System.currentTimeMillis() + 20; |
| | | map.put("其他附件", qtuuid); |
| | | map.put("项目编码", serviceFunddetailShared.getItemcode()); |
| | | map.put("预算项目", null); |
| | |
| | | formmain_0831.put("报销人员", serviceFundShared.getUsername()); |
| | | formmain_0831.put("业务区域", serviceFundShared.getDeptmentname()); |
| | | formmain_0831.put("经手人", serviceFundShared.getUsername()); |
| | | formmain_0831.put("填表时间", serviceFundShared.getApplyTime()); |
| | | formmain_0831.put("填表时间", new SimpleDateFormat("yyyy-MM-dd HH:mm").format(serviceFundShared.getApplyTime())); |
| | | formmain_0831.put("报销金额合计", serviceFundShared.getPretaxcost()); |
| | | formmain_0831.put("上传附件", null); |
| | | formmain_0831.put("备注", null); |
| | |
| | | formmain_0831.put("凭证类别", null); |
| | | formmain_0831.put("税后金额合计", serviceFundShared.getTaxedcost()); |
| | | formmain_0831.put("历史审批记录", null); |
| | | formmain_0831.put("表单编号", serviceFundShared.getBh()); |
| | | formmain_0831.put("表单编号", serviceFundShared.getSerfunid()); |
| | | formmain_0831.put("历史审批单查询", null); |
| | | return formmain_0831; |
| | | } |
| | |
| | | |
| | | int uploadOAFileAndUpdateDb(ServiceFunddetailShared remShare) throws Exception { |
| | | //上传OA文件 |
| | | String strUrl = "http://129.88.242.39: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"); |
| | | // String strUrl = "http://129.88.242.39: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 jsonObj = new JSONObject(map); |
| | | |
| | | System.out.println("uploadOAFileAndUpdateDb + jsonObject" + jsonObj.toString() + "\r\n" + jsonObj.toJSONString()); |
| | | String strRes = HttpClientKit.postOpr(strUrl, jsonObj.toString());// |
| | | //String strRes = HttpClientKit.postMsg(strUrl,jsonObj);//得到返回的token? |
| | | |
| | | JSONObject json1 = JSONObject.parseObject(strRes); |
| | | strRes = json1.get("id").toString(); |
| | |
| | | //发票附件 |
| | | uploadFile(filePath, strFUrl, invoicefilesList, invoicefilesArray, remShare, "2"); |
| | | return 0; |
| | | } |
| | | |
| | | private String getToken() { |
| | | //上传OA文件 |
| | | String strUrl = "http://129.88.242.39: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; |
| | | } |
| | | |
| | | |
| | |
| | | serviceFundflow.setCreateTime(new Date()); |
| | | serviceFundflow.setUpdateTime(new Date()); |
| | | serviceFundflow.setFlowcontent(serviceProcessVO.getFlowcontent()); |
| | | serviceFundflow.setFlowconclusion(serviceProcessVO.getFlowconclusion()); |
| | | serviceFundflow.setFlowconclusion(StringUtils.isNotEmpty(serviceProcessVO.getFlowconclusion()) ? Integer.valueOf(serviceProcessVO.getFlowconclusion()) : null); |
| | | if (serviceProcessVO.getApplytype() == "0") serviceFundflow.setFundtype(1); |
| | | if (serviceProcessVO.getApplytype() == "1") serviceFundflow.setFundtype(2); |
| | | serviceFundflow.setFlowlevel(100); |
| | | serviceFundflow.setApplytype(serviceProcessVO.getApplytype()); |
| | | serviceFundflow.setFundid(serviceProcessVO.getBackCode()); |
| | | serviceFundflow.setFundid(StringUtils.isNotEmpty(serviceProcessVO.getBackCode()) ? Long.valueOf(serviceProcessVO.getBackCode()) : null); |
| | | fundflowService.save(serviceFundflow); |
| | | |
| | | ArrayList<ConcurrentHashMap<String, Object>> contentList = new ArrayList<>(); |