diff --git a/fw-oa/src/main/java/com/hzya/frame/seeyon/dao/ICtpFileDao.java b/fw-oa/src/main/java/com/hzya/frame/seeyon/dao/ICtpFileDao.java index 87961648..435016d2 100644 --- a/fw-oa/src/main/java/com/hzya/frame/seeyon/dao/ICtpFileDao.java +++ b/fw-oa/src/main/java/com/hzya/frame/seeyon/dao/ICtpFileDao.java @@ -3,10 +3,13 @@ package com.hzya.frame.seeyon.dao; import com.hzya.frame.basedao.dao.IBaseDao; import com.hzya.frame.seeyon.entity.CtpFileEntity; +import java.util.List; + /** * @Description seeyon 附件对象 * @Author xiangerlin * @Date 2024/6/17 15:21 **/ public interface ICtpFileDao extends IBaseDao { + List queryFileById(CtpFileEntity ctpFileEntity); } diff --git a/fw-oa/src/main/java/com/hzya/frame/seeyon/dao/ISeeYonDao.java b/fw-oa/src/main/java/com/hzya/frame/seeyon/dao/ISeeYonDao.java index 02d6888a..ae8750f8 100644 --- a/fw-oa/src/main/java/com/hzya/frame/seeyon/dao/ISeeYonDao.java +++ b/fw-oa/src/main/java/com/hzya/frame/seeyon/dao/ISeeYonDao.java @@ -4,6 +4,7 @@ import com.baomidou.dynamic.datasource.annotation.DS; import com.hzya.frame.basedao.dao.IBaseDao; import com.hzya.frame.seeyon.entity.SeeyonEntity; +import java.util.HashMap; import java.util.List; /** @@ -104,5 +105,7 @@ public interface ISeeYonDao extends IBaseDao { * **/ @DS("ht_oa_sqlserver") int updatepush(SeeyonEntity seeyon); + List> execSelectSql(String str , SeeyonEntity entity)throws Exception; + Integer updateFileBySqlSre(SeeyonEntity entity); } diff --git a/fw-oa/src/main/java/com/hzya/frame/seeyon/dao/impl/CtpFileDaoImpl.java b/fw-oa/src/main/java/com/hzya/frame/seeyon/dao/impl/CtpFileDaoImpl.java index 8b80d3d7..33742ebc 100644 --- a/fw-oa/src/main/java/com/hzya/frame/seeyon/dao/impl/CtpFileDaoImpl.java +++ b/fw-oa/src/main/java/com/hzya/frame/seeyon/dao/impl/CtpFileDaoImpl.java @@ -1,5 +1,6 @@ package com.hzya.frame.seeyon.dao.impl; +import com.baomidou.dynamic.datasource.annotation.DS; import com.hzya.frame.basedao.dao.MybatisGenericDao; import com.hzya.frame.seeyon.dao.ICtpAttachmentDao; import com.hzya.frame.seeyon.dao.ICtpFileDao; @@ -7,6 +8,8 @@ import com.hzya.frame.seeyon.entity.CtpAttachmentEntity; import com.hzya.frame.seeyon.entity.CtpFileEntity; import org.springframework.stereotype.Repository; +import java.util.List; + /** * @Description * @Author xiangerlin @@ -14,4 +17,10 @@ import org.springframework.stereotype.Repository; **/ @Repository() public class CtpFileDaoImpl extends MybatisGenericDao implements ICtpFileDao { + + @DS("WS_OA") + @Override + public List queryFileById(CtpFileEntity ctpFileEntity) { + return (List) super.selectList("com.hzya.frame.seeyon.entity.CtpFileEntity.CtpFileEntity_list_base",ctpFileEntity); + } } diff --git a/fw-oa/src/main/java/com/hzya/frame/seeyon/dao/impl/SeeYonDaoImpl.java b/fw-oa/src/main/java/com/hzya/frame/seeyon/dao/impl/SeeYonDaoImpl.java index 332ae7fc..34099350 100644 --- a/fw-oa/src/main/java/com/hzya/frame/seeyon/dao/impl/SeeYonDaoImpl.java +++ b/fw-oa/src/main/java/com/hzya/frame/seeyon/dao/impl/SeeYonDaoImpl.java @@ -2,10 +2,13 @@ package com.hzya.frame.seeyon.dao.impl; import com.baomidou.dynamic.datasource.annotation.DS; import com.hzya.frame.basedao.dao.MybatisGenericDao; +import com.hzya.frame.execsql.service.IExecSqlService; import com.hzya.frame.seeyon.dao.ISeeYonDao; import com.hzya.frame.seeyon.entity.SeeyonEntity; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Repository; +import java.util.HashMap; import java.util.List; /** @@ -17,6 +20,8 @@ import java.util.List; @DS("htsqlserver") @Repository(value = "seeYonDaoImpl") public class SeeYonDaoImpl extends MybatisGenericDao implements ISeeYonDao { + @Autowired + private IExecSqlService execSqlService; @DS("ht_oa_sqlserver") @Override public List selectOAListByTypeformson_0352(SeeyonEntity seeyon) { @@ -90,5 +95,14 @@ public class SeeYonDaoImpl extends MybatisGenericDao implem public int updatepush(SeeyonEntity seeyon) { return super.update("com.hzya.frame.seeyon.dao.impl.SeeYonDaoImpl.entity_update_push",seeyon); } - + @DS("WS_OA") + @Override + public List> execSelectSql(String str, SeeyonEntity entity)throws Exception { + return execSqlService.execSelectSql(str, entity.getDataSourceCode()); + } + @DS("WS_OA") + @Override + public Integer updateFileBySqlSre(SeeyonEntity entity) { + return super.update("com.hzya.frame.seeyon.dao.impl.SeeYonDaoImpl.entity_update_file_by_id",entity); + } } diff --git a/fw-oa/src/main/java/com/hzya/frame/seeyon/entity/SeeyonEntity.java b/fw-oa/src/main/java/com/hzya/frame/seeyon/entity/SeeyonEntity.java index 773386d0..abb73282 100644 --- a/fw-oa/src/main/java/com/hzya/frame/seeyon/entity/SeeyonEntity.java +++ b/fw-oa/src/main/java/com/hzya/frame/seeyon/entity/SeeyonEntity.java @@ -89,6 +89,15 @@ public class SeeyonEntity extends BaseEntity { private String field0047Id; private String field0034Id; private String field0103;//钉钉ID + private String sqlStr;// + + public String getSqlStr() { + return sqlStr; + } + + public void setSqlStr(String sqlStr) { + this.sqlStr = sqlStr; + } public String getField0103() { return field0103; diff --git a/fw-oa/src/main/java/com/hzya/frame/seeyon/entity/SeeyonEntity.xml b/fw-oa/src/main/java/com/hzya/frame/seeyon/entity/SeeyonEntity.xml index 83714c7d..4324efd7 100644 --- a/fw-oa/src/main/java/com/hzya/frame/seeyon/entity/SeeyonEntity.xml +++ b/fw-oa/src/main/java/com/hzya/frame/seeyon/entity/SeeyonEntity.xml @@ -246,5 +246,9 @@ update ${tableName} set ${pushField} = #{pushValue} where id=#{id} + + + ${sqlStr} + diff --git a/fw-oa/src/main/java/com/hzya/frame/seeyon/service/ICtpAttachmentService.java b/fw-oa/src/main/java/com/hzya/frame/seeyon/service/ICtpAttachmentService.java index 3af20d9d..d0523f62 100644 --- a/fw-oa/src/main/java/com/hzya/frame/seeyon/service/ICtpAttachmentService.java +++ b/fw-oa/src/main/java/com/hzya/frame/seeyon/service/ICtpAttachmentService.java @@ -16,5 +16,5 @@ public interface ICtpAttachmentService extends IBaseService ctpFileList = ctpFileService.query(ctpFileEntity); + ctpFileEntity.setDataSourceCode(dataSourceCode); + List ctpFileList = ctpFileDao.queryFileById(ctpFileEntity); if (CollectionUtils.isNotEmpty(ctpFileList)){ CtpFileEntity ctpFile = ctpFileList.get(0); if (null != ctpFile){ @@ -61,9 +64,12 @@ public class CtpAttachmentServiceImpl extends BaseServicecount =new ArrayList<>(); @@ -116,4 +130,96 @@ public class NoProcessServiceImpl implements INoProcessService { } return new JsonResultEntity("删除成功,删除的数据ID"+ JSON.toJSONString(count),true); } + + @Override + public JsonResultEntity UpdateProcessField(JSONObject requestData) { + SeeyonEntity entity = new SeeyonEntity(); + entity.setDataSourceCode("WS_OA"); + JSONObject jsonStrObj = requestData.getJSONObject("jsonStr"); + String billCode = jsonStrObj.getString("billCode"); + String field0018 = jsonStrObj.getString("field0018");//报关单附件 + String field0021 = jsonStrObj.getString("field0021");//放行通知书附件 + + String field0057 = jsonStrObj.getString("field0057");//委托报关协议附件 + String field0019 = jsonStrObj.getString("field0019");//合同附件 + String field0020 = jsonStrObj.getString("field0020");//提单附件 + String field0062 = jsonStrObj.getString("field0062");//国税要求的其他资料附件 + String field0022 = jsonStrObj.getString("field0022");//国税发票 + if(StrUtil.isEmpty(billCode)) { + return BaseResult.getFailureMessageEntity("单据编码不能为空:billCode"); + } + //如果附件信息全部为空,则直接提示更新成功 + if( + StrUtil.isEmpty(field0018) + &&StrUtil.isEmpty(field0021) + &&StrUtil.isEmpty(field0057) + &&StrUtil.isEmpty(field0019) + &&StrUtil.isEmpty(field0020) + &&StrUtil.isEmpty(field0062) + &&StrUtil.isEmpty(field0022) + ){ + return BaseResult.getFailureMessageEntity("更新失败,报关单附件、放行通知书附件、委托报关协议附件、合同附件、提单附件、国税要求的其他资料附件、国税发票:不能同时为空"); + } + //如果单据编号查询OA中是否存咋,如果存在则继续,如果不存在则直接返回 + String sqlSaleOutQty = "select id,field0015 as billCode from formmain_7676 where field0015 = '"+billCode+"'"; + String dataSourceCode = "WS_OA"; + try { + List> hashMaps = seeYonDao.execSelectSql(sqlSaleOutQty,entity); + if(CollectionUtils.isEmpty(hashMaps) || hashMaps.size() >1){ + return BaseResult.getFailureMessageEntity("该销售订单号在OA中不存在或存在多条请检查:"+billCode+"存在条数:"+hashMaps.size()); + } + HashMap hashMap = hashMaps.get(0); + String id = hashMap.get("id").toString(); + if(StrUtil.isEmpty(id)){ + return BaseResult.getFailureMessageEntity("该销售订单号在OA中不存在或存在多条请检查:"+billCode); + } + StringBuffer sb = new StringBuffer(); + sb.append("update formmain_7676 set "); + //处理附件与表单的关联关系 + if(StrUtil.isNotEmpty(field0018)){ + String uuid = String.valueOf(UUID.randomUUID().getLeastSignificantBits()); + ctpAttachmentService.saveAttachment(field0018,id,uuid ,dataSourceCode); + sb.append(" field0018 = '"+uuid+"',"); + } + if(StrUtil.isNotEmpty(field0021)){ + String uuid = String.valueOf(UUID.randomUUID().getLeastSignificantBits()); + ctpAttachmentService.saveAttachment(field0021,id,uuid ,dataSourceCode); + sb.append(" field0021 = '"+uuid+"',"); + } + if(StrUtil.isNotEmpty(field0057)){ + String uuid = String.valueOf(UUID.randomUUID().getLeastSignificantBits()); + ctpAttachmentService.saveAttachment(field0057,id,uuid ,dataSourceCode); + sb.append(" field0057 = '"+uuid+"',"); + } + if(StrUtil.isNotEmpty(field0019)){ + String uuid = String.valueOf(UUID.randomUUID().getLeastSignificantBits()); + ctpAttachmentService.saveAttachment(field0019,id,uuid ,dataSourceCode); + sb.append(" field0019 = '"+uuid+"',"); + } + if(StrUtil.isNotEmpty(field0020)){ + String uuid = String.valueOf(UUID.randomUUID().getLeastSignificantBits()); + ctpAttachmentService.saveAttachment(field0020,id,uuid ,dataSourceCode); + sb.append(" field0020 = '"+uuid+"',"); + } + if(StrUtil.isNotEmpty(field0062)){ + String uuid = String.valueOf(UUID.randomUUID().getLeastSignificantBits()); + ctpAttachmentService.saveAttachment(field0062,id,uuid ,dataSourceCode); + sb.append(" field0062 = '"+uuid+"',"); + } + if(StrUtil.isNotEmpty(field0022)){ + String uuid = String.valueOf(UUID.randomUUID().getLeastSignificantBits()); + ctpAttachmentService.saveAttachment(field0022,id,uuid ,dataSourceCode); + sb.append(" field0022 = '"+uuid+"',"); + } + sb.append(" field0070 = null"); + sb.append(" where id = '"+id+"'"); + logger.info("更新表单sql:"+sb.toString()); + entity.setSqlStr(sb.toString()); + Integer count = seeYonDao.updateFileBySqlSre(entity); + return BaseResult.getSuccessMessageEntity("更新成功"); + } catch (Exception e) { + logger.error(e.getMessage()); + return BaseResult.getFailureMessageEntity("更新失败,请联系管理员"); + } + } }