Compare commits
3 Commits
ba5b344b9e
...
271243ee4f
Author | SHA1 | Date |
---|---|---|
|
271243ee4f | |
|
4e8cb29710 | |
|
8bc54721ed |
|
@ -14,6 +14,10 @@ public class CInvoiceImportHEntity extends BaseEntity {
|
||||||
private String bill_type;
|
private String bill_type;
|
||||||
//单据编码
|
//单据编码
|
||||||
private String bill_code;
|
private String bill_code;
|
||||||
|
//有度发票导入结果字段名
|
||||||
|
private String yd_res_field;
|
||||||
|
//有度发票导入接口返回的id
|
||||||
|
private String yd_result;
|
||||||
|
|
||||||
public String getTab_name() {
|
public String getTab_name() {
|
||||||
return tab_name;
|
return tab_name;
|
||||||
|
@ -38,4 +42,20 @@ public class CInvoiceImportHEntity extends BaseEntity {
|
||||||
public void setBill_code(String bill_code) {
|
public void setBill_code(String bill_code) {
|
||||||
this.bill_code = bill_code;
|
this.bill_code = bill_code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getYd_res_field() {
|
||||||
|
return yd_res_field;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setYd_res_field(String yd_res_field) {
|
||||||
|
this.yd_res_field = yd_res_field;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getYd_result() {
|
||||||
|
return yd_result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setYd_result(String yd_result) {
|
||||||
|
this.yd_result = yd_result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
<resultMap id="get-CInvoiceImportHEntity-result" type="com.hzya.frame.plugin.cinvoice.entity.CInvoiceImportHEntity">
|
<resultMap id="get-CInvoiceImportHEntity-result" type="com.hzya.frame.plugin.cinvoice.entity.CInvoiceImportHEntity">
|
||||||
<result property="id" column="id" />
|
<result property="id" column="id" />
|
||||||
<result property="tab_name" column="tab_name" />
|
<result property="tab_name" column="tab_name" />
|
||||||
|
<result property="yd_res_field" column="yd_res_field" />
|
||||||
<result property="bill_type" column="bill_type" />
|
<result property="bill_type" column="bill_type" />
|
||||||
<result property="bill_code" column="bill_code" />
|
<result property="bill_code" column="bill_code" />
|
||||||
|
|
||||||
|
@ -14,49 +15,59 @@
|
||||||
SELECT
|
SELECT
|
||||||
id,
|
id,
|
||||||
'formmain_0327' as tab_name,
|
'formmain_0327' as tab_name,
|
||||||
|
'field0370' as yd_res_field,
|
||||||
'对公付款单' as bill_type,
|
'对公付款单' as bill_type,
|
||||||
field0146 as bill_code
|
field0146 as bill_code
|
||||||
FROM
|
FROM
|
||||||
formmain_0327
|
formmain_0327
|
||||||
WHERE
|
WHERE
|
||||||
1 = 1
|
finishedflag = 1
|
||||||
-- and finishedflag = 1
|
|
||||||
|
|
||||||
UNION ALL
|
UNION ALL
|
||||||
|
|
||||||
SELECT
|
SELECT
|
||||||
id,
|
id,
|
||||||
'formmain_0533' as tab_name,
|
'formmain_0533' as tab_name,
|
||||||
|
'field0383' as yd_res_field,
|
||||||
'差旅费报销单' as bill_type,
|
'差旅费报销单' as bill_type,
|
||||||
field0094 as bill_code
|
field0094 as bill_code
|
||||||
FROM
|
FROM
|
||||||
formmain_0533
|
formmain_0533
|
||||||
WHERE
|
WHERE
|
||||||
1 = 1
|
finishedflag = 1
|
||||||
-- and finishedflag = 1
|
|
||||||
UNION ALL
|
UNION ALL
|
||||||
-- 日常费用报销
|
-- 日常费用报销
|
||||||
SELECT
|
SELECT
|
||||||
id,
|
id,
|
||||||
'formmain_0314' as tab_name,
|
'formmain_0314' as tab_name,
|
||||||
|
'field0338' as yd_res_field,
|
||||||
'日常报销单' as bill_type,
|
'日常报销单' as bill_type,
|
||||||
field0220 as bill_code
|
field0220 as bill_code
|
||||||
FROM
|
FROM
|
||||||
formmain_0314
|
formmain_0314
|
||||||
|
WHERE
|
||||||
|
finishedflag = 1
|
||||||
|
|
||||||
UNION ALL
|
UNION ALL
|
||||||
-- 业务招待费
|
-- 业务招待费
|
||||||
SELECT
|
SELECT
|
||||||
id,
|
id,
|
||||||
'formmain_0294' as tab_name,
|
'formmain_0294' as tab_name,
|
||||||
|
'field0218' as yd_res_field,
|
||||||
'招待报销单' as bill_type,
|
'招待报销单' as bill_type,
|
||||||
field0053 as bill_code
|
field0053 as bill_code
|
||||||
FROM
|
FROM
|
||||||
formmain_0294
|
formmain_0294
|
||||||
|
WHERE
|
||||||
|
finishedflag = 1
|
||||||
) f
|
) f
|
||||||
<trim prefix="where" prefixOverrides="and">
|
<trim prefix="where" prefixOverrides="and">
|
||||||
<if test="id != null and id != ''">f.id = #{id}</if>
|
<if test="id != null and id != ''">f.id = #{id}</if>
|
||||||
<if test="bill_code != null and bill_code != ''">and f.bill_code = #{bill_code}</if>
|
<if test="bill_code != null and bill_code != ''">and f.bill_code = #{bill_code}</if>
|
||||||
</trim>
|
</trim>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<update id="entity_update" parameterType="com.hzya.frame.plugin.cinvoice.entity.CInvoiceImportHEntity">
|
||||||
|
update ${tab_name} set ${yd_res_field} = #{yd_result} where id = #{id}
|
||||||
|
</update>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
@ -3,6 +3,7 @@ package com.hzya.frame.plugin.cinvoice.plugin;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.hzya.frame.base.PluginBaseEntity;
|
import com.hzya.frame.base.PluginBaseEntity;
|
||||||
import com.hzya.frame.plugin.cinvoice.service.ICInvoiceImportPluginService;
|
import com.hzya.frame.plugin.cinvoice.service.ICInvoiceImportPluginService;
|
||||||
|
import com.hzya.frame.web.entity.BaseResult;
|
||||||
import com.hzya.frame.web.entity.JsonResultEntity;
|
import com.hzya.frame.web.entity.JsonResultEntity;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
@ -94,8 +95,8 @@ public class CInvoiceImportPluginInitializer extends PluginBaseEntity {
|
||||||
**/
|
**/
|
||||||
@Override
|
@Override
|
||||||
public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception {
|
public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception {
|
||||||
logger.info("======开始执OA发票批量导入有度税务插件======");
|
logger.info("======开始执OA发票批量导入有度税务插件======:{}",requestJson.toString());
|
||||||
pluginService.importInvoice(requestJson);
|
pluginService.importInvoice(requestJson);
|
||||||
return null;
|
return BaseResult.getSuccessMessageEntity("执行成功");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,4 +19,11 @@ public interface ICInvoiceImportHService extends IBaseService<CInvoiceImportHEnt
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
List<CInvoiceImportHEntity> queryInvoiceList(CInvoiceImportHEntity entity) throws Exception;
|
List<CInvoiceImportHEntity> queryInvoiceList(CInvoiceImportHEntity entity) throws Exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新有度导入接口返回的id
|
||||||
|
* @param entity
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
int updateResultId(CInvoiceImportHEntity entity);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.hzya.frame.plugin.cinvoice.service.impl;
|
package com.hzya.frame.plugin.cinvoice.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||||
import com.hzya.frame.basedao.service.impl.BaseService;
|
import com.hzya.frame.basedao.service.impl.BaseService;
|
||||||
import com.hzya.frame.plugin.cinvoice.dao.ICInvoiceImportHDao;
|
import com.hzya.frame.plugin.cinvoice.dao.ICInvoiceImportHDao;
|
||||||
|
@ -42,4 +43,22 @@ public class CInvoiceImportHServiceImpl extends BaseService<CInvoiceImportHEntit
|
||||||
List<CInvoiceImportHEntity> list = cInvoiceImportHDao.queryList(entity, "com.hzya.frame.plugin.cinvoice.dao.impl.CInvoiceImportHDaoImpl.entity_list_base");
|
List<CInvoiceImportHEntity> list = cInvoiceImportHDao.queryList(entity, "com.hzya.frame.plugin.cinvoice.dao.impl.CInvoiceImportHDaoImpl.entity_list_base");
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新有度导入接口返回的id
|
||||||
|
*
|
||||||
|
* @param entity
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@DS("#entity.dataSourceCode")
|
||||||
|
@Override
|
||||||
|
public int updateResultId(CInvoiceImportHEntity entity) {
|
||||||
|
if (null != entity
|
||||||
|
&& StrUtil.isNotEmpty(entity.getTab_name())
|
||||||
|
&& StrUtil.isNotEmpty(entity.getYd_res_field()) && StrUtil.isNotEmpty(entity.getYd_result())){
|
||||||
|
int updateRows = cInvoiceImportHDao.update("com.hzya.frame.plugin.cinvoice.dao.impl.CInvoiceImportHDaoImpl.entity_update", entity);
|
||||||
|
return updateRows;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,7 @@ import com.hzya.frame.plugin.cinvoice.service.ICInvoiceImportPluginService;
|
||||||
import com.hzya.frame.seeyon.util.YzfSignUtil;
|
import com.hzya.frame.seeyon.util.YzfSignUtil;
|
||||||
import com.hzya.frame.sysnew.integtationTaskLivingDetails.entity.IntegrationTaskLivingDetailsEntity;
|
import com.hzya.frame.sysnew.integtationTaskLivingDetails.entity.IntegrationTaskLivingDetailsEntity;
|
||||||
import com.hzya.frame.sysnew.integtationTaskLivingDetails.service.IIntegrationTaskLivingDetailsService;
|
import com.hzya.frame.sysnew.integtationTaskLivingDetails.service.IIntegrationTaskLivingDetailsService;
|
||||||
|
import com.hzya.frame.web.exception.BaseSystemException;
|
||||||
import org.apache.commons.collections.CollectionUtils;
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
@ -71,10 +72,16 @@ public class CInvoiceImportPluginServiceImpl implements ICInvoiceImportPluginSer
|
||||||
|
|
||||||
//1、 查OA主表
|
//1、 查OA主表
|
||||||
String dataSourceCode = requestJson.getString("sourceCode");
|
String dataSourceCode = requestJson.getString("sourceCode");
|
||||||
|
if (StrUtil.isEmpty(dataSourceCode)){
|
||||||
|
dataSourceCode = requestJson.getString("apiDataSourceCode");
|
||||||
|
}
|
||||||
String id = requestJson.getString("id");//主表id
|
String id = requestJson.getString("id");//主表id
|
||||||
|
if (StrUtil.isEmpty(id)){
|
||||||
|
throw new BaseSystemException("id不能为空");
|
||||||
|
}
|
||||||
CInvoiceImportHEntity importHEntity = new CInvoiceImportHEntity();
|
CInvoiceImportHEntity importHEntity = new CInvoiceImportHEntity();
|
||||||
importHEntity.setDataSourceCode(dataSourceCode);
|
importHEntity.setDataSourceCode(dataSourceCode);
|
||||||
importHEntity.setId("6286766887088770238");
|
importHEntity.setId(id);
|
||||||
List<CInvoiceImportHEntity> cInvoiceImportHList = cInvoiceImportHService.queryInvoiceList(importHEntity);
|
List<CInvoiceImportHEntity> cInvoiceImportHList = cInvoiceImportHService.queryInvoiceList(importHEntity);
|
||||||
if (CollectionUtils.isNotEmpty(cInvoiceImportHList)){
|
if (CollectionUtils.isNotEmpty(cInvoiceImportHList)){
|
||||||
ParamAssembler assembler = null;
|
ParamAssembler assembler = null;
|
||||||
|
@ -83,7 +90,7 @@ public class CInvoiceImportPluginServiceImpl implements ICInvoiceImportPluginSer
|
||||||
//3、 查迈瑞思发票表
|
//3、 查迈瑞思发票表
|
||||||
//迈锐思发票公共信息表
|
//迈锐思发票公共信息表
|
||||||
LexmisPublicinfoEntity lexmisPublicinfoEntity = new LexmisPublicinfoEntity(cInvoiceH.getId(),dataSourceCode);
|
LexmisPublicinfoEntity lexmisPublicinfoEntity = new LexmisPublicinfoEntity(cInvoiceH.getId(),dataSourceCode);
|
||||||
lexmisPublicinfoEntity.setPI_ID("-95056949260236712");
|
//lexmisPublicinfoEntity.setPI_ID("6952494198841691018");
|
||||||
List<LexmisPublicinfoEntity> lexmisPublicinfoEntityList = lexmisPublicinfoService.query(lexmisPublicinfoEntity);
|
List<LexmisPublicinfoEntity> lexmisPublicinfoEntityList = lexmisPublicinfoService.query(lexmisPublicinfoEntity);
|
||||||
if (CollectionUtils.isNotEmpty(lexmisPublicinfoEntityList)){
|
if (CollectionUtils.isNotEmpty(lexmisPublicinfoEntityList)){
|
||||||
//税务接口每次最多传50张发票
|
//税务接口每次最多传50张发票
|
||||||
|
@ -155,6 +162,15 @@ public class CInvoiceImportPluginServiceImpl implements ICInvoiceImportPluginSer
|
||||||
if (StrUtil.isNotEmpty(body)){
|
if (StrUtil.isNotEmpty(body)){
|
||||||
JSONObject jsonObject = JSONObject.parseObject(body);
|
JSONObject jsonObject = JSONObject.parseObject(body);
|
||||||
Boolean flag = jsonObject.getBoolean("flag");
|
Boolean flag = jsonObject.getBoolean("flag");
|
||||||
|
JSONObject resObj = jsonObject.getJSONObject("attribute");
|
||||||
|
if (null != resObj && "0".equals(resObj.getString("code"))){
|
||||||
|
String result = resObj.getString("result");
|
||||||
|
if (StrUtil.isNotEmpty(result)){
|
||||||
|
cInvoiceH.setDataSourceCode(dataSourceCode);
|
||||||
|
cInvoiceH.setYd_result(result);
|
||||||
|
cInvoiceImportHService.updateResultId(cInvoiceH);
|
||||||
|
}
|
||||||
|
}
|
||||||
//保存日志
|
//保存日志
|
||||||
IntegrationTaskLivingDetailsEntity taskLivingDetail = new IntegrationTaskLivingDetailsEntity();
|
IntegrationTaskLivingDetailsEntity taskLivingDetail = new IntegrationTaskLivingDetailsEntity();
|
||||||
taskLivingDetail.setCreate_time(new Date());
|
taskLivingDetail.setCreate_time(new Date());
|
||||||
|
@ -167,6 +183,7 @@ public class CInvoiceImportPluginServiceImpl implements ICInvoiceImportPluginSer
|
||||||
taskLivingDetail.setNewPushDate(new Date());
|
taskLivingDetail.setNewPushDate(new Date());
|
||||||
this.saveLog(id,flag,taskLivingDetail);
|
this.saveLog(id,flag,taskLivingDetail);
|
||||||
}
|
}
|
||||||
|
return body;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -217,6 +217,7 @@ public abstract class MybatisGenericDao<E extends Serializable, PK extends Seria
|
||||||
return this.sqlSession.delete(id, param);
|
return this.sqlSession.delete(id, param);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@DS("#param.dataSourceCode")
|
||||||
@Override
|
@Override
|
||||||
public int update(String id, Object param) {
|
public int update(String id, Object param) {
|
||||||
return this.sqlSession.update(id, param);
|
return this.sqlSession.update(id, param);
|
||||||
|
|
Loading…
Reference in New Issue