Compare commits

...

3 Commits

7 changed files with 84 additions and 8 deletions

View File

@ -14,6 +14,10 @@ public class CInvoiceImportHEntity extends BaseEntity {
private String bill_type;
//单据编码
private String bill_code;
//有度发票导入结果字段名
private String yd_res_field;
//有度发票导入接口返回的id
private String yd_result;
public String getTab_name() {
return tab_name;
@ -38,4 +42,20 @@ public class CInvoiceImportHEntity extends BaseEntity {
public void setBill_code(String 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;
}
}

View File

@ -4,6 +4,7 @@
<resultMap id="get-CInvoiceImportHEntity-result" type="com.hzya.frame.plugin.cinvoice.entity.CInvoiceImportHEntity">
<result property="id" column="id" />
<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_code" column="bill_code" />
@ -14,49 +15,59 @@
SELECT
id,
'formmain_0327' as tab_name,
'field0370' as yd_res_field,
'对公付款单' as bill_type,
field0146 as bill_code
FROM
formmain_0327
WHERE
1 = 1
-- and finishedflag = 1
finishedflag = 1
UNION ALL
SELECT
id,
'formmain_0533' as tab_name,
'field0383' as yd_res_field,
'差旅费报销单' as bill_type,
field0094 as bill_code
FROM
formmain_0533
WHERE
1 = 1
-- and finishedflag = 1
finishedflag = 1
UNION ALL
-- 日常费用报销
SELECT
id,
'formmain_0314' as tab_name,
'field0338' as yd_res_field,
'日常报销单' as bill_type,
field0220 as bill_code
FROM
formmain_0314
WHERE
finishedflag = 1
UNION ALL
-- 业务招待费
SELECT
id,
'formmain_0294' as tab_name,
'field0218' as yd_res_field,
'招待报销单' as bill_type,
field0053 as bill_code
FROM
formmain_0294
WHERE
finishedflag = 1
) f
<trim prefix="where" prefixOverrides="and">
<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>
</trim>
</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>

View File

@ -3,6 +3,7 @@ package com.hzya.frame.plugin.cinvoice.plugin;
import com.alibaba.fastjson.JSONObject;
import com.hzya.frame.base.PluginBaseEntity;
import com.hzya.frame.plugin.cinvoice.service.ICInvoiceImportPluginService;
import com.hzya.frame.web.entity.BaseResult;
import com.hzya.frame.web.entity.JsonResultEntity;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -94,8 +95,8 @@ public class CInvoiceImportPluginInitializer extends PluginBaseEntity {
**/
@Override
public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception {
logger.info("======开始执OA发票批量导入有度税务插件======");
logger.info("======开始执OA发票批量导入有度税务插件======:{}",requestJson.toString());
pluginService.importInvoice(requestJson);
return null;
return BaseResult.getSuccessMessageEntity("执行成功");
}
}

View File

@ -19,4 +19,11 @@ public interface ICInvoiceImportHService extends IBaseService<CInvoiceImportHEnt
* @throws Exception
*/
List<CInvoiceImportHEntity> queryInvoiceList(CInvoiceImportHEntity entity) throws Exception;
/**
* 更新有度导入接口返回的id
* @param entity
* @return
*/
int updateResultId(CInvoiceImportHEntity entity);
}

View File

@ -1,5 +1,6 @@
package com.hzya.frame.plugin.cinvoice.service.impl;
import cn.hutool.core.util.StrUtil;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.hzya.frame.basedao.service.impl.BaseService;
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");
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;
}
}

View File

@ -16,6 +16,7 @@ import com.hzya.frame.plugin.cinvoice.service.ICInvoiceImportPluginService;
import com.hzya.frame.seeyon.util.YzfSignUtil;
import com.hzya.frame.sysnew.integtationTaskLivingDetails.entity.IntegrationTaskLivingDetailsEntity;
import com.hzya.frame.sysnew.integtationTaskLivingDetails.service.IIntegrationTaskLivingDetailsService;
import com.hzya.frame.web.exception.BaseSystemException;
import org.apache.commons.collections.CollectionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -71,10 +72,16 @@ public class CInvoiceImportPluginServiceImpl implements ICInvoiceImportPluginSer
//1 查OA主表
String dataSourceCode = requestJson.getString("sourceCode");
if (StrUtil.isEmpty(dataSourceCode)){
dataSourceCode = requestJson.getString("apiDataSourceCode");
}
String id = requestJson.getString("id");//主表id
if (StrUtil.isEmpty(id)){
throw new BaseSystemException("id不能为空");
}
CInvoiceImportHEntity importHEntity = new CInvoiceImportHEntity();
importHEntity.setDataSourceCode(dataSourceCode);
importHEntity.setId("6286766887088770238");
importHEntity.setId(id);
List<CInvoiceImportHEntity> cInvoiceImportHList = cInvoiceImportHService.queryInvoiceList(importHEntity);
if (CollectionUtils.isNotEmpty(cInvoiceImportHList)){
ParamAssembler assembler = null;
@ -83,7 +90,7 @@ public class CInvoiceImportPluginServiceImpl implements ICInvoiceImportPluginSer
//3 查迈瑞思发票表
//迈锐思发票公共信息表
LexmisPublicinfoEntity lexmisPublicinfoEntity = new LexmisPublicinfoEntity(cInvoiceH.getId(),dataSourceCode);
lexmisPublicinfoEntity.setPI_ID("-95056949260236712");
//lexmisPublicinfoEntity.setPI_ID("6952494198841691018");
List<LexmisPublicinfoEntity> lexmisPublicinfoEntityList = lexmisPublicinfoService.query(lexmisPublicinfoEntity);
if (CollectionUtils.isNotEmpty(lexmisPublicinfoEntityList)){
//税务接口每次最多传50张发票
@ -155,6 +162,15 @@ public class CInvoiceImportPluginServiceImpl implements ICInvoiceImportPluginSer
if (StrUtil.isNotEmpty(body)){
JSONObject jsonObject = JSONObject.parseObject(body);
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();
taskLivingDetail.setCreate_time(new Date());
@ -167,6 +183,7 @@ public class CInvoiceImportPluginServiceImpl implements ICInvoiceImportPluginSer
taskLivingDetail.setNewPushDate(new Date());
this.saveLog(id,flag,taskLivingDetail);
}
return body;
}
}
}

View File

@ -217,6 +217,7 @@ public abstract class MybatisGenericDao<E extends Serializable, PK extends Seria
return this.sqlSession.delete(id, param);
}
@DS("#param.dataSourceCode")
@Override
public int update(String id, Object param) {
return this.sqlSession.update(id, param);