This commit is contained in:
lvleigang 2025-07-03 10:41:29 +08:00
parent 0723988a25
commit 7f3a7b73f2
10 changed files with 363 additions and 9 deletions

View File

@ -5,5 +5,6 @@ import com.hzya.frame.plugin.nuonuo.entity.NuoNuoEntity;
public interface INuoNuoDao extends IBaseDao<NuoNuoEntity, String> { public interface INuoNuoDao extends IBaseDao<NuoNuoEntity, String> {
int updateHpdata(NuoNuoEntity nuoNuoEntity);
} }

View File

@ -1,11 +1,18 @@
package com.hzya.frame.plugin.nuonuo.dao.impl; package com.hzya.frame.plugin.nuonuo.dao.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.hzya.frame.basedao.dao.MybatisGenericDao; import com.hzya.frame.basedao.dao.MybatisGenericDao;
import com.hzya.frame.plugin.nuonuo.dao.INuoNuoDao; import com.hzya.frame.plugin.nuonuo.dao.INuoNuoDao;
import com.hzya.frame.plugin.nuonuo.entity.NuoNuoEntity; import com.hzya.frame.plugin.nuonuo.entity.NuoNuoEntity;
import com.hzya.frame.seeyon.entity.NuoNuoCallbackEntity;
public class NuoNuoDaoImpl extends MybatisGenericDao<NuoNuoEntity, String> implements INuoNuoDao { public class NuoNuoDaoImpl extends MybatisGenericDao<NuoNuoEntity, String> implements INuoNuoDao {
@DS("#entity.dataSourceCode")
@Override
public int updateHpdata(NuoNuoEntity entity) {
return super.update(getSqlIdPrifx()+"updateHpdata",entity);
}
} }

View File

@ -4,5 +4,62 @@ import com.hzya.frame.web.entity.BaseEntity;
public class NuoNuoEntity extends BaseEntity { public class NuoNuoEntity extends BaseEntity {
private String id;
private String field0191;//申请编号
private String field0192;//红字确认单状态
private String field0193;//红字确认单描述
private String field0194;//红冲状态
private String field0195;//红冲描述
@Override
public String getId() {
return id;
}
@Override
public void setId(String id) {
this.id = id;
}
public String getField0191() {
return field0191;
}
public void setField0191(String field0191) {
this.field0191 = field0191;
}
public String getField0192() {
return field0192;
}
public void setField0192(String field0192) {
this.field0192 = field0192;
}
public String getField0193() {
return field0193;
}
public void setField0193(String field0193) {
this.field0193 = field0193;
}
public String getField0194() {
return field0194;
}
public void setField0194(String field0194) {
this.field0194 = field0194;
}
public String getField0195() {
return field0195;
}
public void setField0195(String field0195) {
this.field0195 = field0195;
}
} }

View File

@ -2,5 +2,18 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hzya.frame.plugin.nuonuo.dao.impl.NuoNuoDaoImpl"> <mapper namespace="com.hzya.frame.plugin.nuonuo.dao.impl.NuoNuoDaoImpl">
<update id="updateHpdata" parameterType="com.hzya.frame.plugin.nuonuo.entity.NuoNuoEntity">
update formmain_11970 set
<trim suffix="" suffixOverrides=",">
<if test="field0191 != null and field0191 !='' "> field0191 = #{field0191},</if>
<if test="field0192 != null and field0192 !='' "> field0192 = #{field0192},</if>
<if test="field0193 != null and field0193 !='' "> field0193 = #{field0193},</if>
<if test="field0194 != null and field0194 !='' "> field0194 = #{field0194},</if>
<if test="field0195 != null and field0195 !='' "> field0195 = #{field0195},</if>
</trim>
where id = #{id}
</update>
</mapper> </mapper>

View File

@ -0,0 +1,60 @@
package com.hzya.frame.plugin.nuonuo.plugin;
import com.alibaba.fastjson.JSONObject;
import com.hzya.frame.base.PluginBaseEntity;
import com.hzya.frame.plugin.nuonuo.service.INuoNuoService;
import com.hzya.frame.web.entity.JsonResultEntity;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
/**
* 诺诺发票
*
* @author makejava
* @since 2024-06-21 13:52:35
*/
public class NuoNuoHcPluginInitializer extends PluginBaseEntity{
Logger logger = LoggerFactory.getLogger(NuoNuoHcPluginInitializer.class);
@Autowired
private INuoNuoService nuoNuoService;
@Override
public void initialize() {
logger.info(getPluginLabel() + "执行初始化方法initialize()");
}
@Override
public void destroy() {
logger.info(getPluginLabel() + "执行销毁方法destroy()");
}
@Override
public String getPluginId() {
return "NuoNuoHcPlugin";
}
@Override
public String getPluginName() {
return "NuoNuoHcPlugin插件";
}
@Override
public String getPluginLabel() {
return "NuoNuoHcPlugin";
}
@Override
public String getPluginType() {
return "1";
}
@Override
public JsonResultEntity executeBusiness(JSONObject requestJson) {
try {
logger.info("======开始执行诺诺发票红冲同步========");
return nuoNuoService.sendNuoNuoFaPiaoHc(requestJson);
}catch (Exception e){
logger.info("======执行诺诺发票红冲同步失败:{}========",e.getMessage());
}
return null;
}
}

View File

@ -0,0 +1,60 @@
package com.hzya.frame.plugin.nuonuo.plugin;
import com.alibaba.fastjson.JSONObject;
import com.hzya.frame.base.PluginBaseEntity;
import com.hzya.frame.plugin.nuonuo.service.INuoNuoService;
import com.hzya.frame.web.entity.JsonResultEntity;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
/**
* 诺诺发票
*
* @author makejava
* @since 2024-06-21 13:52:35
*/
public class NuoNuoQrdPluginInitializer extends PluginBaseEntity{
Logger logger = LoggerFactory.getLogger(NuoNuoQrdPluginInitializer.class);
@Autowired
private INuoNuoService nuoNuoService;
@Override
public void initialize() {
logger.info(getPluginLabel() + "执行初始化方法initialize()");
}
@Override
public void destroy() {
logger.info(getPluginLabel() + "执行销毁方法destroy()");
}
@Override
public String getPluginId() {
return "NuoNuoQrdPlugin";
}
@Override
public String getPluginName() {
return "NuoNuoQrdPlugin插件";
}
@Override
public String getPluginLabel() {
return "NuoNuoQrdPlugin";
}
@Override
public String getPluginType() {
return "1";
}
@Override
public JsonResultEntity executeBusiness(JSONObject requestJson) {
try {
logger.info("======开始执行诺诺发票确认单同步========");
return nuoNuoService.sendNuoNuoFaPiaoQrd(requestJson);
}catch (Exception e){
logger.info("======执行诺诺发票确认单同步失败:{}========",e.getMessage());
}
return null;
}
}

View File

@ -8,10 +8,28 @@ import com.hzya.frame.web.entity.JsonResultEntity;
public interface INuoNuoService extends IBaseService<NuoNuoEntity, String>{ public interface INuoNuoService extends IBaseService<NuoNuoEntity, String>{
/** /**
* @Author lvleigang * @Author lvleigang
* @Description 同步诺诺发票 * @Description 同步诺诺发票蓝字
* @Date 5:31 下午 2025/6/26 * @Date 5:31 下午 2025/6/26
* @param requestJson * @param requestJson
* @return com.hzya.frame.web.entity.JsonResultEntity * @return com.hzya.frame.web.entity.JsonResultEntity
**/ **/
JsonResultEntity sendNuoNuoFaPiao(JSONObject requestJson); JsonResultEntity sendNuoNuoFaPiao(JSONObject requestJson);
/**
* @Author lvleigang
* @Description 诺诺发票确认单
* @Date 4:35 下午 2025/7/2
* @param requestJson
* @return com.hzya.frame.web.entity.JsonResultEntity
**/
JsonResultEntity sendNuoNuoFaPiaoQrd(JSONObject requestJson);
/**
* @Author lvleigang
* @Description 诺诺发票红冲
* @Date 4:35 下午 2025/7/2
* @param requestJson
* @return com.hzya.frame.web.entity.JsonResultEntity
**/
JsonResultEntity sendNuoNuoFaPiaoHc(JSONObject requestJson);
} }

View File

@ -44,7 +44,7 @@ public class NuoNuoServiceImpl extends BaseService<NuoNuoEntity, String> impleme
**/ **/
@Override @Override
public JsonResultEntity sendNuoNuoFaPiao(JSONObject requestJson) { public JsonResultEntity sendNuoNuoFaPiao(JSONObject requestJson) {
logger.error(" 资金拨付流程结束回调:"+requestJson.toJSONString()); logger.error("同步诺诺发票蓝字:"+requestJson.toJSONString());
JSONObject jsonStr = requestJson.getJSONObject("jsonStr"); JSONObject jsonStr = requestJson.getJSONObject("jsonStr");
if(jsonStr == null ){ if(jsonStr == null ){
return BaseResult.getFailureMessageEntity("系统错误"); return BaseResult.getFailureMessageEntity("系统错误");
@ -186,4 +186,135 @@ public class NuoNuoServiceImpl extends BaseService<NuoNuoEntity, String> impleme
} }
return sendData; return sendData;
} }
/**
* @param requestJson
* @return com.hzya.frame.web.entity.JsonResultEntity
* @Author lvleigang
* @Description 诺诺发票确认单
* @Date 4:35 下午 2025/7/2
**/
@Override
public JsonResultEntity sendNuoNuoFaPiaoQrd(JSONObject requestJson) {
logger.error("同步诺诺发票确认单:"+requestJson.toJSONString());
JSONObject jsonStr = requestJson.getJSONObject("jsonStr");
if(jsonStr == null ){
return BaseResult.getFailureMessageEntity("系统错误");
}
JSONObject businessDataStr = jsonStr.getJSONObject("businessDataStr");
if(businessDataStr == null ){
return BaseResult.getFailureMessageEntity("系统错误");
}
JSONObject mainData = businessDataStr.getJSONObject("formmain_11970");
if(mainData == null ){
return BaseResult.getFailureMessageEntity("系统错误");
}
JSONArray detailArray = businessDataStr.getJSONArray("formson_11971");
if(mainData.getString("field0168") != null && "SJ".equals(mainData.getString("field0168"))){
return BaseResult.getSuccessMessageEntity("发票类型为SJ不传诺税通");
}
//组装发送数据
JSONObject sendData = getSendDataQrd(mainData,detailArray);
//发送数据
logger.error("推送诺诺发票确认单推送:"+sendData.toJSONString());
String tokenResult = HttpRequest.post(url).
header("appId", "800051").
header("apiCode", "8000510012").//todo 配置接口
header("publicKey", "ZJYAM2YFEIsIaI1e4wMagkS2Q7SFgGk0RvsPhEES45m/OVFCe7eDIk+3zDUT+v578prj").
header("secretKey", "lR6+uf94mvNMclAB43oIwmhJSMDzQaViTkfXLeNvmGdpLfbFiUvbgbU+p43zO25Zj3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=").
body(sendData.toJSONString()).
execute().
body();
logger.error("推送诺诺发票确认单返回:"+tokenResult);
JSONObject resoutJson = JSONObject.parseObject(tokenResult);
if(resoutJson.getBoolean("flag")){
JSONObject attribute = requestJson.getJSONObject("attribute");
NuoNuoEntity nuoNuoEntity = new NuoNuoEntity();
nuoNuoEntity.setDataSourceCode("SW-OA");
nuoNuoEntity.setId(mainData.getString("id"));
nuoNuoEntity.setField0191(attribute.getString("data"));
nuoNuoDao.updateHpdata(nuoNuoEntity);
return BaseResult.getSuccessMessageEntity("推送诺诺发票确认单成功");
}else {
return BaseResult.getFailureMessageEntity("推送诺诺发票确认单失败:"+resoutJson.getString("msg"));
}
}
private JSONObject getSendDataQrd(JSONObject mainData, JSONArray detailArray) {
JSONObject sendData = new JSONObject();
sendData.put("applySource",0);//申请方身份0 销方
sendData.put("taxNum",mainData.getString("field0162"));//销方税号
sendData.put("blueInvoiceNumber",mainData.getString("field0178"));//蓝子发票号
//可能需要转换
sendData.put("redReason",mainData.getString("field0190"));//冲红原因1销货退回2开票有误3服务中止4销售折让
//todo 切换地址
sendData.put("bizCallbackUrl","http://10.0.2.112:9021/kangarooDataCenterV3/entranceController/nuoNuoCallback");//回调地址测试
//sendData.put("bizCallbackUrl","http://10.0.2.112:9011/kangarooDataCenterV3/entranceController/nuoNuoCallback");//回调地址正式
return sendData;
}
/**
* @param requestJson
* @return com.hzya.frame.web.entity.JsonResultEntity
* @Author lvleigang
* @Description 诺诺发票红冲
* @Date 4:35 下午 2025/7/2
**/
@Override
public JsonResultEntity sendNuoNuoFaPiaoHc(JSONObject requestJson) {
logger.error("同步诺诺发票红冲:"+requestJson.toJSONString());
JSONObject jsonStr = requestJson.getJSONObject("jsonStr");
if(jsonStr == null ){
return BaseResult.getFailureMessageEntity("系统错误");
}
JSONObject businessDataStr = jsonStr.getJSONObject("businessDataStr");
if(businessDataStr == null ){
return BaseResult.getFailureMessageEntity("系统错误");
}
JSONObject mainData = businessDataStr.getJSONObject("formmain_11970");
if(mainData == null ){
return BaseResult.getFailureMessageEntity("系统错误");
}
JSONArray detailArray = businessDataStr.getJSONArray("formson_11971");
if(mainData.getString("field0168") != null && "SJ".equals(mainData.getString("field0168"))){
return BaseResult.getSuccessMessageEntity("发票类型为SJ不传诺税通");
}
//组装发送数据
JSONObject sendData = getSendDataHc(mainData,detailArray);
//发送数据
logger.error("推送诺诺发票红冲推送:"+sendData.toJSONString());
String tokenResult = HttpRequest.post(url).
header("appId", "800051").
header("apiCode", "8000510012").//todo 配置接口
header("publicKey", "ZJYAM2YFEIsIaI1e4wMagkS2Q7SFgGk0RvsPhEES45m/OVFCe7eDIk+3zDUT+v578prj").
header("secretKey", "lR6+uf94mvNMclAB43oIwmhJSMDzQaViTkfXLeNvmGdpLfbFiUvbgbU+p43zO25Zj3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=").
body(sendData.toJSONString()).
execute().
body();
logger.error("推送诺诺发票红冲返回:"+tokenResult);
JSONObject resoutJson = JSONObject.parseObject(tokenResult);
if(resoutJson.getBoolean("flag")){
return BaseResult.getSuccessMessageEntity("推送诺诺发票红冲成功");
}else {
return BaseResult.getFailureMessageEntity("推送诺诺发票红冲失败:"+resoutJson.getString("msg"));
}
}
private JSONObject getSendDataHc(JSONObject mainData, JSONArray detailArray) {
JSONObject sendData = new JSONObject();
sendData.put("fastRedType",1);//快捷冲红类型 不填或者0为普通快捷冲红 1:数电发票快捷冲红(数电发票必传1)
sendData.put("sellerTaxnum",mainData.getString("field0162"));//销方税号
sendData.put("invoiceNumber",mainData.getString("field0178"));//蓝票发票号码
//sendData.put("invoiceCode",mainData.getString("field0178"));//蓝票发票代码
//可能需要转换
sendData.put("billId",mainData.getString("field0191"));//红字确认单申请单号
//todo 切换地址
sendData.put("bizCallbackUrl","http://10.0.2.112:9021/kangarooDataCenterV3/entranceController/nuoNuoCallback");//回调地址测试
//sendData.put("bizCallbackUrl","http://10.0.2.112:9011/kangarooDataCenterV3/entranceController/nuoNuoCallback");//回调地址正式
return sendData;
}
} }

View File

@ -65,8 +65,11 @@
LEFT JOIN org_member m4 ON m4.id=field0081 LEFT JOIN org_member m4 ON m4.id=field0081
WHERE 1=1 WHERE 1=1
and CTP_AFFAIR.node_policy = '审计完成' AND CTP_AFFAIR.complete_time is not null and CTP_AFFAIR.node_policy = '审计完成' AND CTP_AFFAIR.complete_time is not null
and CTP_AFFAIR.state = '4' and CTP_AFFAIR.sub_state = '0' and field0427 is null and CTP_AFFAIR.state = '4' and CTP_AFFAIR.sub_state = '0'
and rownum &lt; 100 -- and field0274 in ('浙S-QZWLJS2402YXZ001-05','浙S-QZWLJS2402YXZ001-04','浙D-NB2412TH15001') and field0427 is null
and rownum &lt; 100
AND TO_CHAR(CTP_AFFAIR.complete_time,'yyyy-MM-dd hh:mm:ss')>'2025-03-01 00:00:00'
-- and field0007 in ('AHHF2024110178','浙S-QZWLJS2402YXZ001-04','浙D-NB2412TH15001')
<trim prefix="where" prefixOverrides="and"> <trim prefix="where" prefixOverrides="and">
<if test="id != null and id != ''"> and id = #{id} </if> <if test="id != null and id != ''"> and id = #{id} </if>
</trim> </trim>
@ -86,7 +89,9 @@
WHERE 1=1 WHERE 1=1
and CTP_AFFAIR.node_policy = '归档' AND CTP_AFFAIR.complete_time is not null and CTP_AFFAIR.node_policy = '归档' AND CTP_AFFAIR.complete_time is not null
and CTP_AFFAIR.state = '4' and CTP_AFFAIR.sub_state = '0' and field0425 is null and CTP_AFFAIR.state = '4' and CTP_AFFAIR.sub_state = '0' and field0425 is null
and rownum &lt; 100 -- and field0274 in ('浙S-QZWLJS2402YXZ001-05','浙S-QZWLJS2402YXZ001-04','浙D-NB2412TH15001') and rownum &lt; 100
AND TO_CHAR(CTP_AFFAIR.complete_time,'yyyy-MM-dd hh:mm:ss')>'2025-03-01 00:00:00'
-- and field0007 in ('AHHF2024110178','浙S-QZWLJS2402YXZ001-04','浙D-NB2412TH15001')
<trim prefix="where" prefixOverrides="and"> <trim prefix="where" prefixOverrides="and">
<if test="id != null and id != ''"> and id = #{id} </if> <if test="id != null and id != ''"> and id = #{id} </if>
</trim> </trim>

View File

@ -2,4 +2,6 @@
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd"> <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans default-autowire="byName"> <beans default-autowire="byName">
<bean name="nuoNuoPluginInitializer" class="com.hzya.frame.plugin.nuonuo.plugin.NuoNuoPluginInitializer" /> <bean name="nuoNuoPluginInitializer" class="com.hzya.frame.plugin.nuonuo.plugin.NuoNuoPluginInitializer" />
<bean name="nuoNuoQrdPluginInitializer" class="com.hzya.frame.plugin.nuonuo.plugin.NuoNuoQrdPluginInitializer" />
<bean name="nuoNuoHcPluginInitializer" class="com.hzya.frame.plugin.nuonuo.plugin.NuoNuoHcPluginInitializer" />
</beans> </beans>