|
|
@ -1,6 +1,5 @@
|
|
|
|
package com.hzya.frame.grpU8.nxproof.glPzml.service.impl;
|
|
|
|
package com.hzya.frame.grpU8.nxproof.glPzml.service.impl;
|
|
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
|
|
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
import cn.hutool.http.HttpRequest;
|
|
|
|
import cn.hutool.http.HttpRequest;
|
|
|
@ -8,8 +7,6 @@ import com.alibaba.fastjson.JSON;
|
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
import com.hzya.frame.basedao.service.impl.BaseService;
|
|
|
|
import com.hzya.frame.basedao.service.impl.BaseService;
|
|
|
|
import com.hzya.frame.grpU8.nxproof.gbizbxmb.dao.IGbiZbxmbDao;
|
|
|
|
|
|
|
|
import com.hzya.frame.grpU8.nxproof.gbizbxmb.entity.GbiZbxmbEntity;
|
|
|
|
|
|
|
|
import com.hzya.frame.grpU8.nxproof.glPzml.dao.ISenderGlPzmlDao;
|
|
|
|
import com.hzya.frame.grpU8.nxproof.glPzml.dao.ISenderGlPzmlDao;
|
|
|
|
import com.hzya.frame.grpU8.nxproof.glPzml.entity.SenderGlPzmlEntity;
|
|
|
|
import com.hzya.frame.grpU8.nxproof.glPzml.entity.SenderGlPzmlEntity;
|
|
|
|
import com.hzya.frame.grpU8.nxproof.glPzml.service.ISenderGlPzmlService;
|
|
|
|
import com.hzya.frame.grpU8.nxproof.glPzml.service.ISenderGlPzmlService;
|
|
|
@ -18,10 +15,7 @@ import com.hzya.frame.grpU8.nxproof.glPznr.entity.SenderGlPznrEntity;
|
|
|
|
import com.hzya.frame.web.entity.BaseResult;
|
|
|
|
import com.hzya.frame.web.entity.BaseResult;
|
|
|
|
import com.hzya.frame.web.entity.JsonResultEntity;
|
|
|
|
import com.hzya.frame.web.entity.JsonResultEntity;
|
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
|
import org.mybatis.spring.SqlSessionTemplate;
|
|
|
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.beans.factory.annotation.Qualifier;
|
|
|
|
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
import java.math.BigDecimal;
|
|
|
@ -45,8 +39,6 @@ public class SenderGlPzmlServiceImpl extends BaseService<SenderGlPzmlEntity, Str
|
|
|
|
private static String URL="http://192.168.42.22/";//正式环境
|
|
|
|
private static String URL="http://192.168.42.22/";//正式环境
|
|
|
|
|
|
|
|
|
|
|
|
private ISenderGlPzmlDao senderGlPzmlDao;
|
|
|
|
private ISenderGlPzmlDao senderGlPzmlDao;
|
|
|
|
@Autowired
|
|
|
|
|
|
|
|
private IGbiZbxmbDao gbiZbxmbDao;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
@Autowired
|
|
|
|
public void setSenderGlPzmlDao(ISenderGlPzmlDao dao) {
|
|
|
|
public void setSenderGlPzmlDao(ISenderGlPzmlDao dao) {
|
|
|
@ -681,6 +673,7 @@ public class SenderGlPzmlServiceImpl extends BaseService<SenderGlPzmlEntity, Str
|
|
|
|
if(StrUtil.isEmpty(glPzmlEntity.getKjqj())){
|
|
|
|
if(StrUtil.isEmpty(glPzmlEntity.getKjqj())){
|
|
|
|
glPzmlEntity.setKjqj(DateUtil.format(new Date(),"yyyyMM"));
|
|
|
|
glPzmlEntity.setKjqj(DateUtil.format(new Date(),"yyyyMM"));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//glPzmlEntity.setIdpzh("0C69E35D-912A-48F7-A5D4-F73227CC75B6");
|
|
|
|
//获取token
|
|
|
|
//获取token
|
|
|
|
String token = getToken();
|
|
|
|
String token = getToken();
|
|
|
|
if(StrUtil.isEmpty(token)){
|
|
|
|
if(StrUtil.isEmpty(token)){
|
|
|
@ -708,29 +701,26 @@ public class SenderGlPzmlServiceImpl extends BaseService<SenderGlPzmlEntity, Str
|
|
|
|
jsonObjectParams.put("code",pzmlEntity.getIdpzh());//pzid
|
|
|
|
jsonObjectParams.put("code",pzmlEntity.getIdpzh());//pzid
|
|
|
|
jsonObjectParams.put("budgetYear",pzmlEntity.getKjqj().substring(0,4));//预算年度
|
|
|
|
jsonObjectParams.put("budgetYear",pzmlEntity.getKjqj().substring(0,4));//预算年度
|
|
|
|
jsonObjectParams.put("applyDate",outputDateString);//日期
|
|
|
|
jsonObjectParams.put("applyDate",outputDateString);//日期
|
|
|
|
jsonObjectParams.put("userCode",pzmlEntity.getSrid());//用户编码
|
|
|
|
|
|
|
|
jsonObjectParams.put("depCode","A518");//部门编码
|
|
|
|
|
|
|
|
jsonObjectParams.put("description",pzmlEntity.getPzzy());//说明
|
|
|
|
jsonObjectParams.put("description",pzmlEntity.getPzzy());//说明
|
|
|
|
jsonObjectParams.put("amount",roundedValue.doubleValue());//金额
|
|
|
|
jsonObjectParams.put("amount",roundedValue.doubleValue());//金额
|
|
|
|
jsonObjectParams.put("pzNum",pzNum);//凭证号 例如:公司代码+账套号+会计期间+凭证号:001_001_202408_付款_1
|
|
|
|
jsonObjectParams.put("pzNum",pzNum);//凭证号 例如:公司代码+账套号+会计期间+凭证号:001_001_202408_付款_1
|
|
|
|
//根据idpzh查询指标id和指标金额
|
|
|
|
//根据idpzh查询指标id和指标金额以及部门经济科目
|
|
|
|
GbiZbxmbEntity gbiZbxmbEntity=new GbiZbxmbEntity();
|
|
|
|
SenderGlPznrEntity senderGlPznrEntity=new SenderGlPznrEntity();
|
|
|
|
gbiZbxmbEntity.setDjId(pzmlEntity.getIdpzh());
|
|
|
|
senderGlPznrEntity.setIdpzh(pzmlEntity.getIdpzh());
|
|
|
|
gbiZbxmbEntity.setKjnd(pzmlEntity.getKjqj().substring(0,4));
|
|
|
|
senderGlPznrEntity.setDataSourceCode(glPzmlEntity.getDataSourceCode());
|
|
|
|
gbiZbxmbEntity.setDataSourceCode(glPzmlEntity.getDataSourceCode());
|
|
|
|
List<SenderGlPznrEntity> senderGlPznrEntities = senderGlPznrDao.queryGlPznrSxy(senderGlPznrEntity);
|
|
|
|
List<GbiZbxmbEntity> gbiZbsyrecEntities = gbiZbxmbDao.queryZbxmbByIdpzh(gbiZbxmbEntity);
|
|
|
|
logger.info("=======根据凭证idpzh:{}查询的指标金额和指标id以及部门经济科目数据有{}条",pzmlEntity.getIdpzh(),senderGlPznrEntities.size());
|
|
|
|
logger.info("=======根据凭证idpzh:{}查询的指标金额和指标id数据有{}条",pzmlEntity.getIdpzh(),gbiZbsyrecEntities.size());
|
|
|
|
if(CollectionUtils.isEmpty(senderGlPznrEntities)){
|
|
|
|
if(CollectionUtils.isEmpty(gbiZbsyrecEntities)){
|
|
|
|
|
|
|
|
jsonObjectParams.put("reimburseItems",new ArrayList<>());
|
|
|
|
jsonObjectParams.put("reimburseItems",new ArrayList<>());
|
|
|
|
}else{
|
|
|
|
}else{
|
|
|
|
JSONArray jsonArray=new JSONArray();
|
|
|
|
JSONArray jsonArray=new JSONArray();
|
|
|
|
for (GbiZbxmbEntity zbxmbEntity : gbiZbsyrecEntities) {
|
|
|
|
for (SenderGlPznrEntity glPznrEntity : senderGlPznrEntities) {
|
|
|
|
BigDecimal bigDecimalValueZbxmb = new BigDecimal(zbxmbEntity.getJe());
|
|
|
|
BigDecimal bigDecimalValueZbxmb = new BigDecimal(glPznrEntity.getJe());
|
|
|
|
BigDecimal roundedValueZbxmb = bigDecimalValueZbxmb.setScale(2, RoundingMode.HALF_UP);
|
|
|
|
BigDecimal roundedValueZbxmb = bigDecimalValueZbxmb.setScale(2, RoundingMode.HALF_UP);
|
|
|
|
JSONObject jsonObjectZbxm=new JSONObject();
|
|
|
|
JSONObject jsonObjectZbxm=new JSONObject();
|
|
|
|
jsonObjectZbxm.put("thirdProjectCode",zbxmbEntity.getZbid());
|
|
|
|
jsonObjectZbxm.put("thirdProjectCode",glPznrEntity.getZbid());
|
|
|
|
jsonObjectZbxm.put("amount",roundedValueZbxmb);
|
|
|
|
jsonObjectZbxm.put("amount",roundedValueZbxmb);
|
|
|
|
jsonObjectZbxm.put("financialCode",zbxmbEntity.getJjkmdm());
|
|
|
|
jsonObjectZbxm.put("financialCode",glPznrEntity.getFzdm5());
|
|
|
|
jsonArray.add(jsonObjectZbxm);
|
|
|
|
jsonArray.add(jsonObjectZbxm);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
jsonObjectParams.put("reimburseItems",jsonArray);
|
|
|
|
jsonObjectParams.put("reimburseItems",jsonArray);
|
|
|
@ -763,7 +753,7 @@ public class SenderGlPzmlServiceImpl extends BaseService<SenderGlPzmlEntity, Str
|
|
|
|
String params = jsonObject.toJSONString();
|
|
|
|
String params = jsonObject.toJSONString();
|
|
|
|
logger.info("=========获取凭证token请求参数:{}========",params);
|
|
|
|
logger.info("=========获取凭证token请求参数:{}========",params);
|
|
|
|
String urlToken="nky/service/session/getAccessToken";
|
|
|
|
String urlToken="nky/service/session/getAccessToken";
|
|
|
|
String result = HttpRequest.post(URLTest + urlToken).header("Content-Type", "soap/xml").timeout(30000).body(params).execute().body();
|
|
|
|
String result = HttpRequest.post(URLTest + urlToken).header("Content-Type", "application/json;charset=UTF-8").timeout(30000).body(params).execute().body();
|
|
|
|
logger.info("=========获取凭证token返回结果:{}========",result);
|
|
|
|
logger.info("=========获取凭证token返回结果:{}========",result);
|
|
|
|
JSONObject jsonObjectResult=JSONObject.parseObject(result);
|
|
|
|
JSONObject jsonObjectResult=JSONObject.parseObject(result);
|
|
|
|
String value=jsonObjectResult.getString("value");
|
|
|
|
String value=jsonObjectResult.getString("value");
|
|
|
@ -774,7 +764,6 @@ public class SenderGlPzmlServiceImpl extends BaseService<SenderGlPzmlEntity, Str
|
|
|
|
return accessToken;
|
|
|
|
return accessToken;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
return null;
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|