无流程表单附件更新代码

This commit is contained in:
yuqh 2025-03-20 10:11:53 +08:00
parent 154949a1ec
commit 097cfa82e6
10 changed files with 170 additions and 6 deletions

View File

@ -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<CtpFileEntity,String> {
List<CtpFileEntity> queryFileById(CtpFileEntity ctpFileEntity);
}

View File

@ -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<SeeyonEntity,String> {
* **/
@DS("ht_oa_sqlserver")
int updatepush(SeeyonEntity seeyon);
List<HashMap<String, Object>> execSelectSql(String str , SeeyonEntity entity)throws Exception;
Integer updateFileBySqlSre(SeeyonEntity entity);
}

View File

@ -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<CtpFileEntity,String> implements ICtpFileDao {
@DS("WS_OA")
@Override
public List<CtpFileEntity> queryFileById(CtpFileEntity ctpFileEntity) {
return (List<CtpFileEntity>) super.selectList("com.hzya.frame.seeyon.entity.CtpFileEntity.CtpFileEntity_list_base",ctpFileEntity);
}
}

View File

@ -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<SeeyonEntity,String> implements ISeeYonDao {
@Autowired
private IExecSqlService execSqlService;
@DS("ht_oa_sqlserver")
@Override
public List<SeeyonEntity> selectOAListByTypeformson_0352(SeeyonEntity seeyon) {
@ -90,5 +95,14 @@ public class SeeYonDaoImpl extends MybatisGenericDao<SeeyonEntity,String> 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<HashMap<String, Object>> 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);
}
}

View File

@ -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;

View File

@ -246,5 +246,9 @@
update ${tableName} set ${pushField} = #{pushValue}
where id=#{id}
</update>
<!-- 修改 修改付款单报销单等单据的推送状态 -->
<update id="entity_update_file_by_id" parameterType="com.hzya.frame.seeyon.entity.SeeyonEntity">
${sqlStr}
</update>
</mapper>

View File

@ -16,5 +16,5 @@ public interface ICtpAttachmentService extends IBaseService<CtpAttachmentEntity,
* @param sub_reference 随机uuid
* @return
*/
CtpAttachmentEntity saveAttachment(String fileUrl, String col_summary_id, String sub_reference)throws Exception;
CtpAttachmentEntity saveAttachment(String fileUrl, String col_summary_id, String sub_reference,String dataSourceCode)throws Exception;
}

View File

@ -23,4 +23,14 @@ public interface INoProcessService {
*/
JsonResultEntity DeleteProcessField(JSONObject requestData);
/**
*
* @content 无流程表单更新附件接口
* @className: Administrator
* @author laborer
* @date 2025-03-19 11:53
*
*/
JsonResultEntity UpdateProcessField(JSONObject requestData);
}

View File

@ -3,6 +3,7 @@ package com.hzya.frame.seeyon.service.impl;
import cn.hutool.core.date.DateUtil;
import com.hzya.frame.basedao.service.impl.BaseService;
import com.hzya.frame.seeyon.dao.ICtpAttachmentDao;
import com.hzya.frame.seeyon.dao.ICtpFileDao;
import com.hzya.frame.seeyon.entity.CtpAttachmentEntity;
import com.hzya.frame.seeyon.entity.CtpFileEntity;
import com.hzya.frame.seeyon.service.ICtpAttachmentService;
@ -27,6 +28,8 @@ public class CtpAttachmentServiceImpl extends BaseService<CtpAttachmentEntity, S
@Autowired
private ICtpFileService ctpFileService;
@Autowired
private ICtpFileDao ctpFileDao;
@Autowired
public void setCtpAttachmentDao(ICtpAttachmentDao dao) {
this.ctpAttachmentDao = dao;
this.dao = dao;
@ -41,12 +44,12 @@ public class CtpAttachmentServiceImpl extends BaseService<CtpAttachmentEntity, S
* @return
*/
@Override
public CtpAttachmentEntity saveAttachment(String fileUrl, String col_summary_id, String sub_reference)throws Exception {
public CtpAttachmentEntity saveAttachment(String fileUrl, String col_summary_id, String sub_reference,String dataSourceCode)throws Exception {
//查一下附件
CtpFileEntity ctpFileEntity = new CtpFileEntity();
ctpFileEntity.setId(fileUrl);
ctpFileEntity.setDataSourceCode("");
List<CtpFileEntity> ctpFileList = ctpFileService.query(ctpFileEntity);
ctpFileEntity.setDataSourceCode(dataSourceCode);
List<CtpFileEntity> ctpFileList = ctpFileDao.queryFileById(ctpFileEntity);
if (CollectionUtils.isNotEmpty(ctpFileList)){
CtpFileEntity ctpFile = ctpFileList.get(0);
if (null != ctpFile){
@ -61,9 +64,12 @@ public class CtpAttachmentServiceImpl extends BaseService<CtpAttachmentEntity, S
ctpAttachmentEntity.setMime_type(ctpFile.getMime_type());
ctpAttachmentEntity.setAttachment_size(ctpFile.getFile_size());
ctpAttachmentEntity.setCreatedate(new Date());
this.save(ctpAttachmentEntity);
ctpAttachmentEntity.setDataSourceCode(dataSourceCode);
ctpAttachmentDao.saveCtpAttachment(ctpAttachmentEntity);
return ctpAttachmentEntity;
}
}else {
throw new Exception("附件不存在"+fileUrl);
}
return null;
}

View File

@ -1,11 +1,18 @@
package com.hzya.frame.seeyon.service.impl;
import cn.hutool.core.lang.UUID;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.hzya.frame.execsql.service.IExecSqlService;
import com.hzya.frame.seeyon.dao.ICapFormDefinitionDao;
import com.hzya.frame.seeyon.dao.ISeeYonDao;
import com.hzya.frame.seeyon.entity.CapFormDefinitionEntity;
import com.hzya.frame.seeyon.entity.CtpFileEntity;
import com.hzya.frame.seeyon.entity.SeeyonEntity;
import com.hzya.frame.seeyon.service.ICtpAttachmentService;
import com.hzya.frame.seeyon.service.INoProcessService;
import com.hzya.frame.web.entity.BaseResult;
import com.hzya.frame.web.entity.JsonResultEntity;
import org.apache.commons.collections.CollectionUtils;
import org.checkerframework.checker.units.qual.A;
@ -15,6 +22,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.concurrent.atomic.AtomicReference;
@ -32,6 +40,12 @@ public class NoProcessServiceImpl implements INoProcessService {
private static final Logger logger = LoggerFactory.getLogger(NoProcessServiceImpl.class);
@Autowired
private ICapFormDefinitionDao capFormDefinitionDao;
@Autowired
private ISeeYonDao seeYonDao;
@Autowired
private IExecSqlService execSqlService;
@Autowired
private ICtpAttachmentService ctpAttachmentService;
@Override
public JsonResultEntity DeleteProcessField(JSONObject requestData) {
List<String>count =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<HashMap<String,Object>> 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("更新失败,请联系管理员");
}
}
}