@@ -13,6 +13,7 @@ import com.point.strategy.oaDocking.service.DocSimpleOaService;
import com.point.strategy.oaDocking.service.DocTraditionFileOaService ;
import com.point.strategy.oaDocking.service.DocTraditionVolumeOaService ;
import com.point.strategy.oaDocking.service.YcjSystemIntegration ;
import com.point.strategy.oaDocking.service.CityBusinessSystemIntegration ;
import com.point.strategy.oaDocking.util.FileUtils ;
import com.point.strategy.service.OperLoggerService ;
import com.point.strategy.user.bean.User ;
@@ -390,7 +391,7 @@ public class ArchivesUploadController {
log . info ( " [DOC] fawen_index={} 对应的记录数量: {} " , indexComment , recordCount ) ;
}
}
Ycj SystemIntegration. closeResources ( null , null , countResult ) ;
CityBusiness SystemIntegration. closeResources ( null , null , countResult ) ;
resultSetFile = YcjSystemIntegration . executeQuery ( sqlFile ) ;
while ( resultSetFile . next ( ) ) {
@@ -515,10 +516,10 @@ public class ArchivesUploadController {
}
json = AjaxJson . returnExceptionInfo ( e . toString ( ) ) ;
} finally {
Ycj SystemIntegration. closeResources ( null , null , resultSet ) ;
Ycj SystemIntegration. closeResources ( null , null , resultSetFile ) ;
Ycj SystemIntegration. closeResources ( null , null , resultSetDisposal ) ;
Ycj SystemIntegration. closeResources ( null , null , resultSetCount ) ;
CityBusiness SystemIntegration. closeResources ( null , null , resultSet ) ;
CityBusiness SystemIntegration. closeResources ( null , null , resultSetFile ) ;
CityBusiness SystemIntegration. closeResources ( null , null , resultSetDisposal ) ;
CityBusiness SystemIntegration. closeResources ( null , null , resultSetCount ) ;
}
return json ;
@@ -782,7 +783,7 @@ public class ArchivesUploadController {
log . info ( " [CONTRACT] fawen_index={} 对应的记录数量: {} " , indexComment , recordCount ) ;
}
}
Ycj SystemIntegration. closeResources ( null , null , countResult ) ;
CityBusiness SystemIntegration. closeResources ( null , null , countResult ) ;
resultSetFile = YcjSystemIntegration . executeQuery ( sqlFile ) ;
while ( resultSetFile . next ( ) ) {
String fileName = resultSetFile . getString ( " file_path " ) ;
@@ -964,14 +965,878 @@ public class ArchivesUploadController {
operLoggerService . addEntity ( entity ) ;
}
} finally {
Ycj SystemIntegration. closeResources ( null , null , resultSet ) ;
Ycj SystemIntegration. closeResources ( null , null , resultSetFile ) ;
Ycj SystemIntegration. closeResources ( null , null , resultSetDisposal ) ;
Ycj SystemIntegration. closeResources ( null , null , resultSetCount ) ;
CityBusiness SystemIntegration. closeResources ( null , null , resultSet ) ;
CityBusiness SystemIntegration. closeResources ( null , null , resultSetFile ) ;
CityBusiness SystemIntegration. closeResources ( null , null , resultSetDisposal ) ;
CityBusiness SystemIntegration. closeResources ( null , null , resultSetCount ) ;
}
return json ;
}
@RequestMapping ( value = " /productSalesDocking " , method = RequestMethod . POST )
@ApiOperation ( value = " 在销品牌对接 " )
public AjaxJson productSalesDocking ( ) {
AjaxJson json = new AjaxJson ( ) ;
if ( log . isInfoEnabled ( ) ) {
log . info ( " [PRODUCT_SALES] 在销品牌对接开始, archiveXMLGenerate={}, uploadPath={} " , archiveXMLGenerate , uploadPath ) ;
}
//查询在销品牌数据, 从2025-01-01开始的全量数据
String sql = " select * from CC_TBC_PRODUCT_ez where 1=1 " ;
ResultSet resultSet = null ;
ResultSet resultSetFile = null ;
ResultSet resultSetCount = null ;
int j = 0 ;
int totalPending = 0 ;
String product_uuid = " " ;
try {
// 统计总条数
String countSql = " select count(1) as CNT from CC_TBC_PRODUCT_ez where 1=1 " ;
resultSetCount = CityBusinessSystemIntegration . executeQuery ( countSql ) ;
if ( resultSetCount . next ( ) ) {
totalPending = resultSetCount . getInt ( " CNT " ) ;
}
if ( log . isInfoEnabled ( ) ) {
log . info ( " [PRODUCT_SALES] 总条数 totalPending={} " , totalPending ) ;
}
String tableName = " product_sales_ " + new SimpleDateFormat ( " yyyyMMdd " ) . format ( new Date ( ) ) + " _temp " ;
String tempTableName = tableName + " _temp " ;
String fileTableName = tableName + " _temp_file " ;
if ( log . isDebugEnabled ( ) ) {
log . debug ( " [PRODUCT_SALES] 执行源库查询: {} " , sql ) ;
}
resultSet = CityBusinessSystemIntegration . executeQuery ( sql ) ;
//把数据添加到简化表中
String fieldName = " product_uuid,product_code,product_name,factory_simple_name,brand_name,is_abnormity,length,width,height,tar_qty,bar_code,package_qty,bar_code2,package_qty2,bar_code3,package_qty3,price_type_code,direct_whole_price,direct_retail_price,is_province,is_seized,adjust_price,retail_price,whole_sale_price,in_begin_date,sale_begin_date,out_begin_date,fonds_no,retention,archive_ctg_no,created_date,maintitle,responsibleby,archive_flag,batch_id " ;
String valueName = " " ;
// 遍历结果集
while ( resultSet . next ( ) ) {
// 获取每一行的数据
product_uuid = nvl ( resultSet . getString ( " product_uuid " ) ) ;
String product_code = nvl ( resultSet . getString ( " product_code " ) ) ;
String product_name = nvl ( resultSet . getString ( " product_name " ) ) ;
String factory_simple_name = nvl ( resultSet . getString ( " factory_simple_name " ) ) ;
String brand_name = nvl ( resultSet . getString ( " brand_name " ) ) ;
String is_abnormity = nvl ( resultSet . getString ( " is_abnormity " ) ) ;
BigDecimal length = resultSet . getBigDecimal ( " length " ) ;
BigDecimal width = resultSet . getBigDecimal ( " width " ) ;
BigDecimal height = resultSet . getBigDecimal ( " height " ) ;
BigDecimal tar_qty = resultSet . getBigDecimal ( " tar_qty " ) ;
String bar_code = nvl ( resultSet . getString ( " bar_code " ) ) ;
BigDecimal package_qty = resultSet . getBigDecimal ( " package_qty " ) ;
String bar_code2 = nvl ( resultSet . getString ( " bar_code2 " ) ) ;
BigDecimal package_qty2 = resultSet . getBigDecimal ( " package_qty2 " ) ;
String bar_code3 = nvl ( resultSet . getString ( " bar_code3 " ) ) ;
BigDecimal package_qty3 = resultSet . getBigDecimal ( " package_qty3 " ) ;
String price_type_code = nvl ( resultSet . getString ( " price_type_code " ) ) ;
BigDecimal direct_whole_price = resultSet . getBigDecimal ( " direct_whole_price " ) ;
BigDecimal direct_retail_price = resultSet . getBigDecimal ( " direct_retail_price " ) ;
String is_province = nvl ( resultSet . getString ( " is_province " ) ) ;
String is_seized = nvl ( resultSet . getString ( " is_seized " ) ) ;
BigDecimal adjust_price = resultSet . getBigDecimal ( " adjust_price " ) ;
BigDecimal retail_price = resultSet . getBigDecimal ( " retail_price " ) ;
BigDecimal whole_sale_price = resultSet . getBigDecimal ( " whole_sale_price " ) ;
String in_begin_date = nvl ( resultSet . getString ( " in_begin_date " ) ) ;
String sale_begin_date = nvl ( resultSet . getString ( " sale_begin_date " ) ) ;
String out_begin_date = nvl ( resultSet . getString ( " out_begin_date " ) ) ;
String fonds_no = " 0240 " ; // 固定全宗号
String retention = " 永久 " ; // 默认保管期限
String archive_ctg_no = " CP " ; // 产品档案分类
String created_date = new SimpleDateFormat ( " yyyyMMdd " ) . format ( new Date ( ) ) ;
String maintitle = product_name ;
String responsibleby = " 系统管理员 " ;
valueName = " ' " + product_uuid + " ', " +
" ' " + product_code + " ', " +
" ' " + product_name + " ', " +
" ' " + factory_simple_name + " ', " +
" ' " + brand_name + " ', " +
" ' " + is_abnormity + " ', " +
( length ! = null ? length : " NULL " ) + " , " +
( width ! = null ? width : " NULL " ) + " , " +
( height ! = null ? height : " NULL " ) + " , " +
( tar_qty ! = null ? tar_qty : " NULL " ) + " , " +
" ' " + bar_code + " ', " +
( package_qty ! = null ? package_qty : " NULL " ) + " , " +
" ' " + bar_code2 + " ', " +
( package_qty2 ! = null ? package_qty2 : " NULL " ) + " , " +
" ' " + bar_code3 + " ', " +
( package_qty3 ! = null ? package_qty3 : " NULL " ) + " , " +
" ' " + price_type_code + " ', " +
( direct_whole_price ! = null ? direct_whole_price : " NULL " ) + " , " +
( direct_retail_price ! = null ? direct_retail_price : " NULL " ) + " , " +
" ' " + is_province + " ', " +
" ' " + is_seized + " ', " +
( adjust_price ! = null ? adjust_price : " NULL " ) + " , " +
( retail_price ! = null ? retail_price : " NULL " ) + " , " +
( whole_sale_price ! = null ? whole_sale_price : " NULL " ) + " , " +
" ' " + in_begin_date + " ', " +
" ' " + sale_begin_date + " ', " +
" ' " + out_begin_date + " ', " +
" ' " + fonds_no + " ', " +
" ' " + retention + " ', " +
" ' " + archive_ctg_no + " ', " +
" ' " + created_date + " ', " +
" ' " + maintitle + " ', " +
" ' " + responsibleby + " ', " +
" '预归档未完成', " +
" ' " + product_uuid + " ' " ;
if ( log . isInfoEnabled ( ) ) {
log . info ( " [PRODUCT_SALES] 处理记录 product_uuid={}, product_code={}, product_name={} " , product_uuid , product_code , product_name ) ;
}
// 幂等:优先检查是否已存在相同 product_uuid 记录
Integer jhId ;
String whereSql = " 1=1 and product_uuid=' " + product_uuid + " ' " ;
if ( existsInTemp ( tempTableName , whereSql ) ) {
jhId = findSingleId ( tempTableName , whereSql ) ;
if ( log . isDebugEnabled ( ) ) {
log . debug ( " [PRODUCT_SALES] 命中幂等: 复用已有记录 id={}, where={} " , jhId , whereSql ) ;
}
} else {
Map < String , Object > mapTwo = new HashMap < String , Object > ( ) ;
mapTwo . put ( " tableName " , tempTableName ) ;
mapTwo . put ( " fieldName " , fieldName ) ;
mapTwo . put ( " valueName " , valueName ) ;
danganguanliService . saveObject ( mapTwo ) ;
jhId = Integer . parseInt ( mapTwo . get ( " id " ) . toString ( ) ) ;
if ( log . isInfoEnabled ( ) ) {
log . info ( " [PRODUCT_SALES] 新增主表记录 id={} (temp={}) " , jhId , tempTableName ) ;
}
}
String filePath = " uploadFile/ " + fileTableName + " / " + jhId ;
Path dirPath = ensureDir ( uploadPath , filePath ) ;
String dir = dirPath . toString ( ) ;
if ( log . isDebugEnabled ( ) ) {
log . debug ( " [PRODUCT_SALES] 目标目录: {} " , dir ) ;
}
//是否生成归档xml
if ( archiveXMLGenerate ) {
String head = " <?xml version= \" 1.0 \" encoding= \" UTF-8 \" ?> " ;
String xml = " <目录> " +
" <卷烟标识> " + xmlEscape ( product_uuid ) + " </卷烟标识> " +
" <卷烟编码> " + xmlEscape ( product_code ) + " </卷烟编码> " +
" <卷烟名称> " + xmlEscape ( product_name ) + " </卷烟名称> " +
" <厂家简称> " + xmlEscape ( factory_simple_name ) + " </厂家简称> " +
" <品牌名称> " + xmlEscape ( brand_name ) + " </品牌名称> " +
" <是否异形包装> " + xmlEscape ( is_abnormity ) + " </是否异形包装> " +
" <包装长度> " + ( length ! = null ? length . toString ( ) : " " ) + " </包装长度> " +
" <包装宽度> " + ( width ! = null ? width . toString ( ) : " " ) + " </包装宽度> " +
" <包装高度> " + ( height ! = null ? height . toString ( ) : " " ) + " </包装高度> " +
" <焦油含量> " + ( tar_qty ! = null ? tar_qty . toString ( ) : " " ) + " </焦油含量> " +
" <包条形码> " + xmlEscape ( bar_code ) + " </包条形码> " +
" <包包装支数> " + ( package_qty ! = null ? package_qty . toString ( ) : " " ) + " </包包装支数> " +
" <条条形码> " + xmlEscape ( bar_code2 ) + " </条条形码> " +
" <条包装支数> " + ( package_qty2 ! = null ? package_qty2 . toString ( ) : " " ) + " </条包装支数> " +
" <件条形码> " + xmlEscape ( bar_code3 ) + " </件条形码> " +
" <件包装支数> " + ( package_qty3 ! = null ? package_qty3 . toString ( ) : " " ) + " </件包装支数> " +
" <卷烟价类> " + xmlEscape ( price_type_code ) + " </卷烟价类> " +
" <批发指导价> " + ( direct_whole_price ! = null ? direct_whole_price . toString ( ) : " " ) + " </批发指导价> " +
" <零售指导价> " + ( direct_retail_price ! = null ? direct_retail_price . toString ( ) : " " ) + " </零售指导价> " +
" <是否省内烟> " + xmlEscape ( is_province ) + " </是否省内烟> " +
" <是否查扣烟启用> " + xmlEscape ( is_seized ) + " </是否查扣烟启用> " +
" <调剂价> " + ( adjust_price ! = null ? adjust_price . toString ( ) : " " ) + " </调剂价> " +
" <零售价> " + ( retail_price ! = null ? retail_price . toString ( ) : " " ) + " </零售价> " +
" <批发价> " + ( whole_sale_price ! = null ? whole_sale_price . toString ( ) : " " ) + " </批发价> " +
" <引入日期> " + xmlEscape ( in_begin_date ) + " </引入日期> " +
" <上市日期> " + xmlEscape ( sale_begin_date ) + " </上市日期> " +
" <退出日期> " + xmlEscape ( out_begin_date ) + " </退出日期> " +
" <全宗号> " + xmlEscape ( fonds_no ) + " </全宗号> " +
" <保管期限> " + xmlEscape ( retention ) + " </保管期限> " +
" <归档分类> " + xmlEscape ( archive_ctg_no ) + " </归档分类> " +
" <归档时间> " + created_date + " </归档时间> " +
" <责任者> " + xmlEscape ( responsibleby ) + " </责任者> " +
" </目录> " ;
String content = head + xml ;
String newContent = FileTool . formatXml ( content ) ;
FileTool . write ( newContent , dirPath . resolve ( product_uuid + " .xml " ) . toString ( ) ) ;
String fileName = product_uuid + " .xml " ;
String fileNameServer = product_uuid + " .xml " ;
String type = " xml " ;
insertFileRecord ( fileTableName , jhId , fileName , fileNameServer , filePath , type , 1 , dir ) ;
if ( log . isInfoEnabled ( ) ) {
log . info ( " [PRODUCT_SALES] 生成XML文件并登记: {} " , dirPath . resolve ( fileName ) ) ;
}
}
//不需要更新源库状态,全量处理
j + + ;
//添加日志
ServletRequestAttributes servletRequestAttributes = ( ServletRequestAttributes ) RequestContextHolder . getRequestAttributes ( ) ;
User user = null ;
if ( servletRequestAttributes ! = null ) {
HttpServletRequest request = servletRequestAttributes . getRequest ( ) ;
UserRole userRole = userService . getUserRole ( request ) ;
if ( userRole ! = null ) user = userRole . getUser ( ) ;
}
if ( user ! = null ) {
//记录日志
java . util . Date date = new Date ( ) ;
OperLogger entity = new OperLogger ( ) ;
entity . setLogType ( " 7 " ) ;
entity . setOperator ( user . getUsername ( ) ) ;
entity . setOperatorChn ( user . getUserChnName ( ) ) ;
entity . setOperateDate ( date ) ;
entity . setDescription ( " 在销品牌系统成功归档 " + product_code + " 的卷烟编码 " ) ;
entity . setArgs ( " 在销品牌系统成功归档 " + product_code + " 的卷烟编码 " ) ;
operLoggerService . addEntity ( entity ) ;
}
}
if ( log . isInfoEnabled ( ) ) log . info ( " [PRODUCT_SALES] 在销品牌对接完成, 待处理条数={}, 成功处理条数={} " , totalPending , j ) ;
json = AjaxJson . returnInfo ( " 成功接收 " + j + " 条 " ) ;
} catch ( Exception e ) {
log . error ( " [PRODUCT_SALES] 在销品牌对接失败 product_uuid={} " , product_uuid , e ) ;
//添加日志
ServletRequestAttributes servletRequestAttributes = ( ServletRequestAttributes ) RequestContextHolder . getRequestAttributes ( ) ;
User user = null ;
if ( servletRequestAttributes ! = null ) {
HttpServletRequest request = servletRequestAttributes . getRequest ( ) ;
UserRole userRole = userService . getUserRole ( request ) ;
if ( userRole ! = null ) user = userRole . getUser ( ) ;
}
if ( user ! = null ) {
//记录日志
java . util . Date date = new Date ( ) ;
OperLogger entity = new OperLogger ( ) ;
entity . setLogType ( " 7 " ) ;
entity . setOperator ( user . getUsername ( ) ) ;
entity . setOperatorChn ( user . getUserChnName ( ) ) ;
entity . setOperateDate ( date ) ;
entity . setDescription ( " 在销品牌系统失败归档 " + product_uuid + " 的卷烟标识 " ) ;
entity . setArgs ( " 在销品牌系统失败归档 " + e . toString ( ) ) ;
operLoggerService . addEntity ( entity ) ;
}
json = AjaxJson . returnExceptionInfo ( e . toString ( ) ) ;
} finally {
CityBusinessSystemIntegration . closeResources ( null , null , resultSet ) ;
CityBusinessSystemIntegration . closeResources ( null , null , resultSetFile ) ;
CityBusinessSystemIntegration . closeResources ( null , null , resultSetCount ) ;
}
return json ;
}
@RequestMapping ( value = " /productExitDocking " , method = RequestMethod . POST )
@ApiOperation ( value = " 退出品规对接 " )
public AjaxJson productExitDocking ( ) {
AjaxJson json = new AjaxJson ( ) ;
if ( log . isInfoEnabled ( ) ) {
log . info ( " [PRODUCT_EXIT] 退出品规对接开始, archiveXMLGenerate={}, uploadPath={} " , archiveXMLGenerate , uploadPath ) ;
}
//查询退出品规数据, 从2025-01-01开始的全量数据
String sql = " select * from cc_tbc_drawout_ez where 1=1 " ;
ResultSet resultSet = null ;
ResultSet resultSetFile = null ;
ResultSet resultSetCount = null ;
int j = 0 ;
int totalPending = 0 ;
String drawout_uuid = " " ;
try {
// 统计总条数
String countSql = " select count(1) as CNT from cc_tbc_drawout_ez where 1=1 " ;
resultSetCount = CityBusinessSystemIntegration . executeQuery ( countSql ) ;
if ( resultSetCount . next ( ) ) {
totalPending = resultSetCount . getInt ( " CNT " ) ;
}
if ( log . isInfoEnabled ( ) ) {
log . info ( " [PRODUCT_EXIT] 总条数 totalPending={} " , totalPending ) ;
}
String tableName = " product_exit_ " + new SimpleDateFormat ( " yyyyMMdd " ) . format ( new Date ( ) ) + " _temp " ;
String tempTableName = tableName + " _temp " ;
String fileTableName = tableName + " _temp_file " ;
if ( log . isDebugEnabled ( ) ) {
log . debug ( " [PRODUCT_EXIT] 执行源库查询: {} " , sql ) ;
}
resultSet = CityBusinessSystemIntegration . executeQuery ( sql ) ;
//把数据添加到简化表中
String fieldName = " drawout_uuid,org_name,quit_uuid,drawout_date,quit_date,comment,creater_name,syscreatedate,fonds_no,retention,archive_ctg_no,created_date,maintitle,responsibleby,archive_flag,batch_id " ;
String valueName = " " ;
// 遍历结果集
while ( resultSet . next ( ) ) {
// 获取每一行的数据
drawout_uuid = nvl ( resultSet . getString ( " drawout_uuid " ) ) ;
String org_name = nvl ( resultSet . getString ( " org_name " ) ) ;
String quit_uuid = nvl ( resultSet . getString ( " quit_uuid " ) ) ;
String drawout_date = nvl ( resultSet . getString ( " drawout_date " ) ) ;
String quit_date = nvl ( resultSet . getString ( " quit_date " ) ) ;
String comment = nvl ( resultSet . getString ( " comment " ) ) ;
String creater_name = nvl ( resultSet . getString ( " creater_name " ) ) ;
String syscreatedate = nvl ( resultSet . getString ( " SYSCREATEDATE " ) ) ;
String fonds_no = " 0240 " ; // 固定全宗号
String retention = " 永久 " ; // 默认保管期限
String archive_ctg_no = " CE " ; // 退出品规分类
String created_date = new SimpleDateFormat ( " yyyyMMdd " ) . format ( new Date ( ) ) ;
String maintitle = " 退出品规- " + quit_uuid ;
String responsibleby = creater_name ;
valueName = " ' " + drawout_uuid + " ', " +
" ' " + org_name + " ', " +
" ' " + quit_uuid + " ', " +
" ' " + drawout_date + " ', " +
" ' " + quit_date + " ', " +
" ' " + comment + " ', " +
" ' " + creater_name + " ', " +
" ' " + syscreatedate + " ', " +
" ' " + fonds_no + " ', " +
" ' " + retention + " ', " +
" ' " + archive_ctg_no + " ', " +
" ' " + created_date + " ', " +
" ' " + maintitle + " ', " +
" ' " + responsibleby + " ', " +
" '预归档未完成', " +
" ' " + drawout_uuid + " ' " ;
if ( log . isInfoEnabled ( ) ) {
log . info ( " [PRODUCT_EXIT] 处理记录 drawout_uuid={}, quit_uuid={}, org_name={} " , drawout_uuid , quit_uuid , org_name ) ;
}
// 幂等:优先检查是否已存在相同 drawout_uuid 记录
Integer jhId ;
String whereSql = " 1=1 and drawout_uuid=' " + drawout_uuid + " ' " ;
if ( existsInTemp ( tempTableName , whereSql ) ) {
jhId = findSingleId ( tempTableName , whereSql ) ;
if ( log . isDebugEnabled ( ) ) {
log . debug ( " [PRODUCT_EXIT] 命中幂等: 复用已有记录 id={}, where={} " , jhId , whereSql ) ;
}
} else {
Map < String , Object > mapTwo = new HashMap < String , Object > ( ) ;
mapTwo . put ( " tableName " , tempTableName ) ;
mapTwo . put ( " fieldName " , fieldName ) ;
mapTwo . put ( " valueName " , valueName ) ;
danganguanliService . saveObject ( mapTwo ) ;
jhId = Integer . parseInt ( mapTwo . get ( " id " ) . toString ( ) ) ;
if ( log . isInfoEnabled ( ) ) {
log . info ( " [PRODUCT_EXIT] 新增主表记录 id={} (temp={}) " , jhId , tempTableName ) ;
}
}
String filePath = " uploadFile/ " + fileTableName + " / " + jhId ;
Path dirPath = ensureDir ( uploadPath , filePath ) ;
String dir = dirPath . toString ( ) ;
if ( log . isDebugEnabled ( ) ) {
log . debug ( " [PRODUCT_EXIT] 目标目录: {} " , dir ) ;
}
//是否生成归档xml
if ( archiveXMLGenerate ) {
String head = " <?xml version= \" 1.0 \" encoding= \" UTF-8 \" ?> " ;
String xml = " <目录> " +
" <退出标识> " + xmlEscape ( drawout_uuid ) + " </退出标识> " +
" <机构名称> " + xmlEscape ( org_name ) + " </机构名称> " +
" <退出品规标识> " + xmlEscape ( quit_uuid ) + " </退出品规标识> " +
" <退出日期> " + xmlEscape ( drawout_date ) + " </退出日期> " +
" <退出时间> " + xmlEscape ( quit_date ) + " </退出时间> " +
" <备注> " + xmlEscape ( comment ) + " </备注> " +
" <创建人> " + xmlEscape ( creater_name ) + " </创建人> " +
" <系统创建时间> " + xmlEscape ( syscreatedate ) + " </系统创建时间> " +
" <全宗号> " + xmlEscape ( fonds_no ) + " </全宗号> " +
" <保管期限> " + xmlEscape ( retention ) + " </保管期限> " +
" <归档分类> " + xmlEscape ( archive_ctg_no ) + " </归档分类> " +
" <归档时间> " + created_date + " </归档时间> " +
" <责任者> " + xmlEscape ( responsibleby ) + " </责任者> " +
" </目录> " ;
String content = head + xml ;
String newContent = FileTool . formatXml ( content ) ;
FileTool . write ( newContent , dirPath . resolve ( drawout_uuid + " .xml " ) . toString ( ) ) ;
String fileName = drawout_uuid + " .xml " ;
String fileNameServer = drawout_uuid + " .xml " ;
String type = " xml " ;
insertFileRecord ( fileTableName , jhId , fileName , fileNameServer , filePath , type , 1 , dir ) ;
if ( log . isInfoEnabled ( ) ) {
log . info ( " [PRODUCT_EXIT] 生成XML文件并登记: {} " , dirPath . resolve ( fileName ) ) ;
}
}
//不需要更新源库状态,全量处理
j + + ;
//添加日志
ServletRequestAttributes servletRequestAttributes = ( ServletRequestAttributes ) RequestContextHolder . getRequestAttributes ( ) ;
User user = null ;
if ( servletRequestAttributes ! = null ) {
HttpServletRequest request = servletRequestAttributes . getRequest ( ) ;
UserRole userRole = userService . getUserRole ( request ) ;
if ( userRole ! = null ) user = userRole . getUser ( ) ;
}
if ( user ! = null ) {
//记录日志
java . util . Date date = new Date ( ) ;
OperLogger entity = new OperLogger ( ) ;
entity . setLogType ( " 7 " ) ;
entity . setOperator ( user . getUsername ( ) ) ;
entity . setOperatorChn ( user . getUserChnName ( ) ) ;
entity . setOperateDate ( date ) ;
entity . setDescription ( " 退出品规系统成功归档 " + quit_uuid + " 的退出品规标识 " ) ;
entity . setArgs ( " 退出品规系统成功归档 " + quit_uuid + " 的退出品规标识 " ) ;
operLoggerService . addEntity ( entity ) ;
}
}
if ( log . isInfoEnabled ( ) ) log . info ( " [PRODUCT_EXIT] 退出品规对接完成, 待处理条数={}, 成功处理条数={} " , totalPending , j ) ;
json = AjaxJson . returnInfo ( " 成功接收 " + j + " 条 " ) ;
} catch ( Exception e ) {
log . error ( " [PRODUCT_EXIT] 退出品规对接失败 drawout_uuid={} " , drawout_uuid , e ) ;
//添加日志
ServletRequestAttributes servletRequestAttributes = ( ServletRequestAttributes ) RequestContextHolder . getRequestAttributes ( ) ;
User user = null ;
if ( servletRequestAttributes ! = null ) {
HttpServletRequest request = servletRequestAttributes . getRequest ( ) ;
UserRole userRole = userService . getUserRole ( request ) ;
if ( userRole ! = null ) user = userRole . getUser ( ) ;
}
if ( user ! = null ) {
//记录日志
java . util . Date date = new Date ( ) ;
OperLogger entity = new OperLogger ( ) ;
entity . setLogType ( " 7 " ) ;
entity . setOperator ( user . getUsername ( ) ) ;
entity . setOperatorChn ( user . getUserChnName ( ) ) ;
entity . setOperateDate ( date ) ;
entity . setDescription ( " 退出品规系统失败归档 " + drawout_uuid + " 的退出标识 " ) ;
entity . setArgs ( " 退出品规系统失败归档 " + e . toString ( ) ) ;
operLoggerService . addEntity ( entity ) ;
}
json = AjaxJson . returnExceptionInfo ( e . toString ( ) ) ;
} finally {
CityBusinessSystemIntegration . closeResources ( null , null , resultSet ) ;
CityBusinessSystemIntegration . closeResources ( null , null , resultSetFile ) ;
CityBusinessSystemIntegration . closeResources ( null , null , resultSetCount ) ;
}
return json ;
}
@RequestMapping ( value = " /monthlyInventoryDocking " , method = RequestMethod . POST )
@ApiOperation ( value = " 月度进销存对接 " )
public AjaxJson monthlyInventoryDocking ( ) {
AjaxJson json = new AjaxJson ( ) ;
if ( log . isInfoEnabled ( ) ) {
log . info ( " [MONTHLY_INVENTORY] 月度进销存对接开始, archiveXMLGenerate={}, uploadPath={} " , archiveXMLGenerate , uploadPath ) ;
}
//查询月度进销存数据, 从2025-01-01开始的全量数据, 按日期排序
String sql = " select * from SCM_RPT_BizStorDayReport_ez where biz_date >= '2025-01-01' order by biz_date " ;
ResultSet resultSet = null ;
ResultSet resultSetFile = null ;
ResultSet resultSetCount = null ;
int j = 0 ;
int totalPending = 0 ;
String id = " " ;
try {
// 统计总条数
String countSql = " select count(1) as CNT from SCM_RPT_BizStorDayReport_ez where biz_date >= '2025-01-01' " ;
resultSetCount = CityBusinessSystemIntegration . executeQuery ( countSql ) ;
if ( resultSetCount . next ( ) ) {
totalPending = resultSetCount . getInt ( " CNT " ) ;
}
if ( log . isInfoEnabled ( ) ) {
log . info ( " [MONTHLY_INVENTORY] 总条数 totalPending={} " , totalPending ) ;
}
String tableName = " monthly_inventory_ " + new SimpleDateFormat ( " yyyyMMdd " ) . format ( new Date ( ) ) + " _temp " ;
String tempTableName = tableName + " _temp " ;
String fileTableName = tableName + " _temp_file " ;
if ( log . isDebugEnabled ( ) ) {
log . debug ( " [MONTHLY_INVENTORY] 执行源库查询: {} " , sql ) ;
}
resultSet = CityBusinessSystemIntegration . executeQuery ( sql ) ;
//把数据添加到简化表中
String fieldName = " biz_date,stor_name,product_code,product_name,unit_name,last_qty,buy_qty,sale_qty,dec_qty,rest_qty,last_amount,buy_amount,sale_amount,dec_amount,rest_amount,fonds_no,retention,archive_ctg_no,created_date,maintitle,responsibleby,archive_flag,batch_id " ;
String valueName = " " ;
// 遍历结果集
while ( resultSet . next ( ) ) {
// 获取每一行的数据
id = String . valueOf ( resultSet . getLong ( " id " ) ) ;
String biz_date = nvl ( resultSet . getString ( " biz_date " ) ) ;
String stor_name = nvl ( resultSet . getString ( " stor_name " ) ) ;
String product_code = nvl ( resultSet . getString ( " product_code " ) ) ;
String product_name = nvl ( resultSet . getString ( " product_name " ) ) ;
String unit_name = nvl ( resultSet . getString ( " unit_name " ) ) ;
BigDecimal last_qty = resultSet . getBigDecimal ( " last_qty " ) ;
BigDecimal buy_qty = resultSet . getBigDecimal ( " buy_qty " ) ;
BigDecimal sale_qty = resultSet . getBigDecimal ( " sale_qty " ) ;
BigDecimal dec_qty = resultSet . getBigDecimal ( " dec_qty " ) ;
BigDecimal rest_qty = resultSet . getBigDecimal ( " rest_qty " ) ;
BigDecimal last_amount = resultSet . getBigDecimal ( " last_amount " ) ;
BigDecimal buy_amount = resultSet . getBigDecimal ( " buy_amount " ) ;
BigDecimal sale_amount = resultSet . getBigDecimal ( " sale_amount " ) ;
BigDecimal dec_amount = resultSet . getBigDecimal ( " dec_amount " ) ;
BigDecimal rest_amount = resultSet . getBigDecimal ( " rest_amount " ) ;
String fonds_no = " 0240 " ; // 固定全宗号
String retention = " 10年 " ; // 默认保管期限
String archive_ctg_no = " MI " ; // 月度进销存分类
String created_date = new SimpleDateFormat ( " yyyyMMdd " ) . format ( new Date ( ) ) ;
String maintitle = stor_name + " - " + biz_date + " - " + product_name ;
String responsibleby = " 系统管理员 " ;
valueName = " ' " + biz_date + " ', " +
" ' " + stor_name + " ', " +
" ' " + product_code + " ', " +
" ' " + product_name + " ', " +
" ' " + unit_name + " ', " +
( last_qty ! = null ? last_qty : " NULL " ) + " , " +
( buy_qty ! = null ? buy_qty : " NULL " ) + " , " +
( sale_qty ! = null ? sale_qty : " NULL " ) + " , " +
( dec_qty ! = null ? dec_qty : " NULL " ) + " , " +
( rest_qty ! = null ? rest_qty : " NULL " ) + " , " +
( last_amount ! = null ? last_amount : " NULL " ) + " , " +
( buy_amount ! = null ? buy_amount : " NULL " ) + " , " +
( sale_amount ! = null ? sale_amount : " NULL " ) + " , " +
( dec_amount ! = null ? dec_amount : " NULL " ) + " , " +
( rest_amount ! = null ? rest_amount : " NULL " ) + " , " +
" ' " + fonds_no + " ', " +
" ' " + retention + " ', " +
" ' " + archive_ctg_no + " ', " +
" ' " + created_date + " ', " +
" ' " + maintitle + " ', " +
" ' " + responsibleby + " ', " +
" '预归档未完成', " +
" ' " + id + " ' " ;
if ( log . isInfoEnabled ( ) ) {
log . info ( " [MONTHLY_INVENTORY] 处理记录 id={}, biz_date={}, stor_name={}, product_code={} " , id , biz_date , stor_name , product_code ) ;
}
// 幂等:优先检查是否已存在相同 id 记录
Integer jhId ;
String whereSql = " 1=1 and batch_id=' " + id + " ' " ;
if ( existsInTemp ( tempTableName , whereSql ) ) {
jhId = findSingleId ( tempTableName , whereSql ) ;
if ( log . isDebugEnabled ( ) ) {
log . debug ( " [MONTHLY_INVENTORY] 命中幂等: 复用已有记录 id={}, where={} " , jhId , whereSql ) ;
}
} else {
Map < String , Object > mapTwo = new HashMap < String , Object > ( ) ;
mapTwo . put ( " tableName " , tempTableName ) ;
mapTwo . put ( " fieldName " , fieldName ) ;
mapTwo . put ( " valueName " , valueName ) ;
danganguanliService . saveObject ( mapTwo ) ;
jhId = Integer . parseInt ( mapTwo . get ( " id " ) . toString ( ) ) ;
if ( log . isInfoEnabled ( ) ) {
log . info ( " [MONTHLY_INVENTORY] 新增主表记录 id={} (temp={}) " , jhId , tempTableName ) ;
}
}
String filePath = " uploadFile/ " + fileTableName + " / " + jhId ;
Path dirPath = ensureDir ( uploadPath , filePath ) ;
String dir = dirPath . toString ( ) ;
if ( log . isDebugEnabled ( ) ) {
log . debug ( " [MONTHLY_INVENTORY] 目标目录: {} " , dir ) ;
}
//是否生成归档xml
if ( archiveXMLGenerate ) {
String head = " <?xml version= \" 1.0 \" encoding= \" UTF-8 \" ?> " ;
String xml = " <目录> " +
" <日期> " + xmlEscape ( biz_date ) + " </日期> " +
" <仓库名称> " + xmlEscape ( stor_name ) + " </仓库名称> " +
" <商品编码> " + xmlEscape ( product_code ) + " </商品编码> " +
" <商品名称> " + xmlEscape ( product_name ) + " </商品名称> " +
" <计量单位名称> " + xmlEscape ( unit_name ) + " </计量单位名称> " +
" <期初数量> " + ( last_qty ! = null ? last_qty . toString ( ) : " " ) + " </期初数量> " +
" <购入数量> " + ( buy_qty ! = null ? buy_qty . toString ( ) : " " ) + " </购入数量> " +
" <销售数量> " + ( sale_qty ! = null ? sale_qty . toString ( ) : " " ) + " </销售数量> " +
" <报损数量> " + ( dec_qty ! = null ? dec_qty . toString ( ) : " " ) + " </报损数量> " +
" <期末数量> " + ( rest_qty ! = null ? rest_qty . toString ( ) : " " ) + " </期末数量> " +
" <期初金额> " + ( last_amount ! = null ? last_amount . toString ( ) : " " ) + " </期初金额> " +
" <购入金额> " + ( buy_amount ! = null ? buy_amount . toString ( ) : " " ) + " </购入金额> " +
" <销售金额> " + ( sale_amount ! = null ? sale_amount . toString ( ) : " " ) + " </销售金额> " +
" <报损金额> " + ( dec_amount ! = null ? dec_amount . toString ( ) : " " ) + " </报损金额> " +
" <期末金额> " + ( rest_amount ! = null ? rest_amount . toString ( ) : " " ) + " </期末金额> " +
" <全宗号> " + xmlEscape ( fonds_no ) + " </全宗号> " +
" <保管期限> " + xmlEscape ( retention ) + " </保管期限> " +
" <归档分类> " + xmlEscape ( archive_ctg_no ) + " </归档分类> " +
" <归档时间> " + created_date + " </归档时间> " +
" <责任者> " + xmlEscape ( responsibleby ) + " </责任者> " +
" </目录> " ;
String content = head + xml ;
String newContent = FileTool . formatXml ( content ) ;
FileTool . write ( newContent , dirPath . resolve ( id + " .xml " ) . toString ( ) ) ;
String fileName = id + " .xml " ;
String fileNameServer = id + " .xml " ;
String type = " xml " ;
insertFileRecord ( fileTableName , jhId , fileName , fileNameServer , filePath , type , 1 , dir ) ;
if ( log . isInfoEnabled ( ) ) {
log . info ( " [MONTHLY_INVENTORY] 生成XML文件并登记: {} " , dirPath . resolve ( fileName ) ) ;
}
}
//不需要更新源库状态,全量处理
j + + ;
//添加日志
ServletRequestAttributes servletRequestAttributes = ( ServletRequestAttributes ) RequestContextHolder . getRequestAttributes ( ) ;
User user = null ;
if ( servletRequestAttributes ! = null ) {
HttpServletRequest request = servletRequestAttributes . getRequest ( ) ;
UserRole userRole = userService . getUserRole ( request ) ;
if ( userRole ! = null ) user = userRole . getUser ( ) ;
}
if ( user ! = null ) {
//记录日志
java . util . Date date = new Date ( ) ;
OperLogger entity = new OperLogger ( ) ;
entity . setLogType ( " 7 " ) ;
entity . setOperator ( user . getUsername ( ) ) ;
entity . setOperatorChn ( user . getUserChnName ( ) ) ;
entity . setOperateDate ( date ) ;
entity . setDescription ( " 月度进销存系统成功归档 " + biz_date + " 的数据 " ) ;
entity . setArgs ( " 月度进销存系统成功归档 " + biz_date + " 的数据 " ) ;
operLoggerService . addEntity ( entity ) ;
}
}
if ( log . isInfoEnabled ( ) ) log . info ( " [MONTHLY_INVENTORY] 月度进销存对接完成, 待处理条数={}, 成功处理条数={} " , totalPending , j ) ;
json = AjaxJson . returnInfo ( " 成功接收 " + j + " 条 " ) ;
} catch ( Exception e ) {
log . error ( " [MONTHLY_INVENTORY] 月度进销存对接失败 id={} " , id , e ) ;
//添加日志
ServletRequestAttributes servletRequestAttributes = ( ServletRequestAttributes ) RequestContextHolder . getRequestAttributes ( ) ;
User user = null ;
if ( servletRequestAttributes ! = null ) {
HttpServletRequest request = servletRequestAttributes . getRequest ( ) ;
UserRole userRole = userService . getUserRole ( request ) ;
if ( userRole ! = null ) user = userRole . getUser ( ) ;
}
if ( user ! = null ) {
//记录日志
java . util . Date date = new Date ( ) ;
OperLogger entity = new OperLogger ( ) ;
entity . setLogType ( " 7 " ) ;
entity . setOperator ( user . getUsername ( ) ) ;
entity . setOperatorChn ( user . getUserChnName ( ) ) ;
entity . setOperateDate ( date ) ;
entity . setDescription ( " 月度进销存系统失败归档 " + id + " 的记录 " ) ;
entity . setArgs ( " 月度进销存系统失败归档 " + e . toString ( ) ) ;
operLoggerService . addEntity ( entity ) ;
}
json = AjaxJson . returnExceptionInfo ( e . toString ( ) ) ;
} finally {
CityBusinessSystemIntegration . closeResources ( null , null , resultSet ) ;
CityBusinessSystemIntegration . closeResources ( null , null , resultSetFile ) ;
CityBusinessSystemIntegration . closeResources ( null , null , resultSetCount ) ;
}
return json ;
}
@RequestMapping ( value = " /terminalConstructionDocking " , method = RequestMethod . POST )
@ApiOperation ( value = " 终端建设全流程档案对接 " )
public AjaxJson terminalConstructionDocking ( ) {
AjaxJson json = new AjaxJson ( ) ;
if ( log . isInfoEnabled ( ) ) {
log . info ( " [TERMINAL_CONSTRUCTION] 终端建设全流程档案对接开始, archiveXMLGenerate={}, uploadPath={} " , archiveXMLGenerate , uploadPath ) ;
}
//查询终端建设数据, 从2025-01-01开始的全量数据
String sql = " select * from ec_exp_apply_accept_ez where 1=1 " ;
ResultSet resultSet = null ;
ResultSet resultSetFile = null ;
ResultSet resultSetCount = null ;
int j = 0 ;
int totalPending = 0 ;
String accept_uuid = " " ;
try {
// 统计总条数
String countSql = " select count(1) as CNT from ec_exp_apply_accept_ez where 1=1 " ;
resultSetCount = CityBusinessSystemIntegration . executeQuery ( countSql ) ;
if ( resultSetCount . next ( ) ) {
totalPending = resultSetCount . getInt ( " CNT " ) ;
}
if ( log . isInfoEnabled ( ) ) {
log . info ( " [TERMINAL_CONSTRUCTION] 总条数 totalPending={} " , totalPending ) ;
}
String tableName = " terminal_construction_ " + new SimpleDateFormat ( " yyyyMMdd " ) . format ( new Date ( ) ) + " _temp " ;
String tempTableName = tableName + " _temp " ;
String fileTableName = tableName + " _temp_file " ;
if ( log . isDebugEnabled ( ) ) {
log . debug ( " [TERMINAL_CONSTRUCTION] 执行源库查询: {} " , sql ) ;
}
resultSet = CityBusinessSystemIntegration . executeQuery ( sql ) ;
//把数据添加到简化表中
String fieldName = " depart_uuid,depart_name,saler_dept_uuid,license_code,cust_name,address,manage_person_name,cust_type_name,busi_place_code,terminal_level_before,terminal_level_after,apply_remark,deal_remark,accept_status,creator_name,syscreatedate,fonds_no,retention,archive_ctg_no,created_date,maintitle,responsibleby,archive_flag,batch_id " ;
String valueName = " " ;
// 遍历结果集
while ( resultSet . next ( ) ) {
// 获取每一行的数据
accept_uuid = nvl ( resultSet . getString ( " accept_uuid " ) ) ;
String depart_uuid = nvl ( resultSet . getString ( " depart_uuid " ) ) ;
String depart_name = nvl ( resultSet . getString ( " depart_name " ) ) ;
String saler_dept_uuid = nvl ( resultSet . getString ( " saler_dept_uuid " ) ) ;
String license_code = nvl ( resultSet . getString ( " license_code " ) ) ;
String cust_name = nvl ( resultSet . getString ( " cust_name " ) ) ;
String address = nvl ( resultSet . getString ( " address " ) ) ;
String manage_person_name = nvl ( resultSet . getString ( " manage_person_name " ) ) ;
String cust_type_name = nvl ( resultSet . getString ( " cust_type_name " ) ) ;
String busi_place_code = nvl ( resultSet . getString ( " busi_place_code " ) ) ;
String terminal_level_before = nvl ( resultSet . getString ( " terminal_level_before " ) ) ;
String terminal_level_after = nvl ( resultSet . getString ( " terminal_level_after " ) ) ;
String apply_remark = nvl ( resultSet . getString ( " apply_remark " ) ) ;
String deal_remark = nvl ( resultSet . getString ( " deal_remark " ) ) ;
String accept_status = nvl ( resultSet . getString ( " accept_status " ) ) ;
String creator_name = nvl ( resultSet . getString ( " creator_name " ) ) ;
String syscreatedate = nvl ( resultSet . getString ( " syscreatedate " ) ) ;
String fonds_no = " 0240 " ; // 固定全宗号
String retention = " 10年 " ; // 默认保管期限
String archive_ctg_no = " TC " ; // 终端建设分类
String created_date = new SimpleDateFormat ( " yyyyMMdd " ) . format ( new Date ( ) ) ;
String maintitle = cust_name + " - " + license_code + " -终端建设 " ;
String responsibleby = creator_name ;
valueName = " ' " + depart_uuid + " ', " +
" ' " + depart_name + " ', " +
" ' " + saler_dept_uuid + " ', " +
" ' " + license_code + " ', " +
" ' " + cust_name + " ', " +
" ' " + address + " ', " +
" ' " + manage_person_name + " ', " +
" ' " + cust_type_name + " ', " +
" ' " + busi_place_code + " ', " +
" ' " + terminal_level_before + " ', " +
" ' " + terminal_level_after + " ', " +
" ' " + apply_remark + " ', " +
" ' " + deal_remark + " ', " +
" ' " + accept_status + " ', " +
" ' " + creator_name + " ', " +
" ' " + syscreatedate + " ', " +
" ' " + fonds_no + " ', " +
" ' " + retention + " ', " +
" ' " + archive_ctg_no + " ', " +
" ' " + created_date + " ', " +
" ' " + maintitle + " ', " +
" ' " + responsibleby + " ', " +
" '预归档未完成', " +
" ' " + accept_uuid + " ' " ;
if ( log . isInfoEnabled ( ) ) {
log . info ( " [TERMINAL_CONSTRUCTION] 处理记录 accept_uuid={}, license_code={}, cust_name={} " , accept_uuid , license_code , cust_name ) ;
}
// 幂等:优先检查是否已存在相同 accept_uuid 记录
Integer jhId ;
String whereSql = " 1=1 and batch_id=' " + accept_uuid + " ' " ;
if ( existsInTemp ( tempTableName , whereSql ) ) {
jhId = findSingleId ( tempTableName , whereSql ) ;
if ( log . isDebugEnabled ( ) ) {
log . debug ( " [TERMINAL_CONSTRUCTION] 命中幂等: 复用已有记录 id={}, where={} " , jhId , whereSql ) ;
}
} else {
Map < String , Object > mapTwo = new HashMap < String , Object > ( ) ;
mapTwo . put ( " tableName " , tempTableName ) ;
mapTwo . put ( " fieldName " , fieldName ) ;
mapTwo . put ( " valueName " , valueName ) ;
danganguanliService . saveObject ( mapTwo ) ;
jhId = Integer . parseInt ( mapTwo . get ( " id " ) . toString ( ) ) ;
if ( log . isInfoEnabled ( ) ) {
log . info ( " [TERMINAL_CONSTRUCTION] 新增主表记录 id={} (temp={}) " , jhId , tempTableName ) ;
}
}
String filePath = " uploadFile/ " + fileTableName + " / " + jhId ;
Path dirPath = ensureDir ( uploadPath , filePath ) ;
String dir = dirPath . toString ( ) ;
if ( log . isDebugEnabled ( ) ) {
log . debug ( " [TERMINAL_CONSTRUCTION] 目标目录: {} " , dir ) ;
}
//是否生成归档xml
if ( archiveXMLGenerate ) {
String head = " <?xml version= \" 1.0 \" encoding= \" UTF-8 \" ?> " ;
String xml = " <目录> " +
" <市场部> " + xmlEscape ( depart_uuid ) + " </市场部> " +
" <部门名称> " + xmlEscape ( depart_name ) + " </部门名称> " +
" <营销线> " + xmlEscape ( saler_dept_uuid ) + " </营销线> " +
" <许可证号码> " + xmlEscape ( license_code ) + " </许可证号码> " +
" <客户名称> " + xmlEscape ( cust_name ) + " </客户名称> " +
" <经营地址> " + xmlEscape ( address ) + " </经营地址> " +
" <经营者> " + xmlEscape ( manage_person_name ) + " </经营者> " +
" <客户档位名称> " + xmlEscape ( cust_type_name ) + " </客户档位名称> " +
" <经营业态> " + xmlEscape ( busi_place_code ) + " </经营业态> " +
" <当前终端层级> " + xmlEscape ( terminal_level_before ) + " </当前终端层级> " +
" <拟建设终端层级> " + xmlEscape ( terminal_level_after ) + " </拟建设终端层级> " +
" <申请说明> " + xmlEscape ( apply_remark ) + " </申请说明> " +
" <处理说明> " + xmlEscape ( deal_remark ) + " </处理说明> " +
" <受理状态> " + xmlEscape ( accept_status ) + " </受理状态> " +
" <申请人名称> " + xmlEscape ( creator_name ) + " </申请人名称> " +
" <创建时间> " + xmlEscape ( syscreatedate ) + " </创建时间> " +
" <全宗号> " + xmlEscape ( fonds_no ) + " </全宗号> " +
" <保管期限> " + xmlEscape ( retention ) + " </保管期限> " +
" <归档分类> " + xmlEscape ( archive_ctg_no ) + " </归档分类> " +
" <归档时间> " + created_date + " </归档时间> " +
" <责任者> " + xmlEscape ( responsibleby ) + " </责任者> " +
" </目录> " ;
String content = head + xml ;
String newContent = FileTool . formatXml ( content ) ;
FileTool . write ( newContent , dirPath . resolve ( accept_uuid + " .xml " ) . toString ( ) ) ;
String fileName = accept_uuid + " .xml " ;
String fileNameServer = accept_uuid + " .xml " ;
String type = " xml " ;
insertFileRecord ( fileTableName , jhId , fileName , fileNameServer , filePath , type , 1 , dir ) ;
if ( log . isInfoEnabled ( ) ) {
log . info ( " [TERMINAL_CONSTRUCTION] 生成XML文件并登记: {} " , dirPath . resolve ( fileName ) ) ;
}
}
//不需要更新源库状态,全量处理
j + + ;
//添加日志
ServletRequestAttributes servletRequestAttributes = ( ServletRequestAttributes ) RequestContextHolder . getRequestAttributes ( ) ;
User user = null ;
if ( servletRequestAttributes ! = null ) {
HttpServletRequest request = servletRequestAttributes . getRequest ( ) ;
UserRole userRole = userService . getUserRole ( request ) ;
if ( userRole ! = null ) user = userRole . getUser ( ) ;
}
if ( user ! = null ) {
//记录日志
java . util . Date date = new Date ( ) ;
OperLogger entity = new OperLogger ( ) ;
entity . setLogType ( " 7 " ) ;
entity . setOperator ( user . getUsername ( ) ) ;
entity . setOperatorChn ( user . getUserChnName ( ) ) ;
entity . setOperateDate ( date ) ;
entity . setDescription ( " 终端建设系统成功归档 " + license_code + " 的许可证号码 " ) ;
entity . setArgs ( " 终端建设系统成功归档 " + license_code + " 的许可证号码 " ) ;
operLoggerService . addEntity ( entity ) ;
}
}
if ( log . isInfoEnabled ( ) ) log . info ( " [TERMINAL_CONSTRUCTION] 终端建设全流程档案对接完成, 待处理条数={}, 成功处理条数={} " , totalPending , j ) ;
json = AjaxJson . returnInfo ( " 成功接收 " + j + " 条 " ) ;
} catch ( Exception e ) {
log . error ( " [TERMINAL_CONSTRUCTION] 终端建设全流程档案对接失败 accept_uuid={} " , accept_uuid , e ) ;
//添加日志
ServletRequestAttributes servletRequestAttributes = ( ServletRequestAttributes ) RequestContextHolder . getRequestAttributes ( ) ;
User user = null ;
if ( servletRequestAttributes ! = null ) {
HttpServletRequest request = servletRequestAttributes . getRequest ( ) ;
UserRole userRole = userService . getUserRole ( request ) ;
if ( userRole ! = null ) user = userRole . getUser ( ) ;
}
if ( user ! = null ) {
//记录日志
java . util . Date date = new Date ( ) ;
OperLogger entity = new OperLogger ( ) ;
entity . setLogType ( " 7 " ) ;
entity . setOperator ( user . getUsername ( ) ) ;
entity . setOperatorChn ( user . getUserChnName ( ) ) ;
entity . setOperateDate ( date ) ;
entity . setDescription ( " 终端建设系统失败归档 " + accept_uuid + " 的受理标识 " ) ;
entity . setArgs ( " 终端建设系统失败归档 " + e . toString ( ) ) ;
operLoggerService . addEntity ( entity ) ;
}
json = AjaxJson . returnExceptionInfo ( e . toString ( ) ) ;
} finally {
CityBusinessSystemIntegration . closeResources ( null , null , resultSet ) ;
CityBusinessSystemIntegration . closeResources ( null , null , resultSetFile ) ;
CityBusinessSystemIntegration . closeResources ( null , null , resultSetCount ) ;
}
return json ;
}
@RequestMapping ( value = " /wsjhProject " , method = RequestMethod . POST )
@ApiOperation ( value = " 简化工程 " )
public AjaxJson wsjhProject ( ) {