Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-biz
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
项目统一框架
amos-boot-biz
Commits
adef92c3
Commit
adef92c3
authored
Oct 17, 2023
by
tianyiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
气瓶基本信息同步
parent
646f985a
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
220 additions
and
1 deletion
+220
-1
CylDictEnum.java
...join/amos/boot/module/cylinder/api/enums/CylDictEnum.java
+6
-1
CylCylinderFillingCheckMapper.java
...ylinder/flc/api/mapper/CylCylinderFillingCheckMapper.java
+9
-0
CylinderInfoMapper.java
...ot/module/cylinder/flc/api/mapper/CylinderInfoMapper.java
+2
-0
CylCylinderFillingCheckMapper.xml
...c/main/resources/mapper/CylCylinderFillingCheckMapper.xml
+47
-0
CylinderInfoMapper.xml
...nder-api/src/main/resources/mapper/CylinderInfoMapper.xml
+74
-0
CylSyncController.java
...module/cylinder/flc/biz/controller/CylSyncController.java
+15
-0
CylSyncServiceImpl.java
...ule/cylinder/flc/biz/service/impl/CylSyncServiceImpl.java
+50
-0
CylinderSyncServiceImpl.java
...ylinder/flc/biz/service/impl/CylinderSyncServiceImpl.java
+17
-0
No files found.
amos-boot-system-tzs/amos-boot-module-cylinder/amos-boot-module-cylinder-api/src/main/java/com/yeejoin/amos/boot/module/cylinder/api/enums/CylDictEnum.java
View file @
adef92c3
package
com
.
yeejoin
.
amos
.
boot
.
module
.
cylinder
.
api
.
enums
;
import
lombok.AllArgsConstructor
;
import
lombok.Getter
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
*
* <pre>
* 气瓶字典枚举
* </pre>
...
...
amos-boot-system-tzs/amos-boot-module-cylinder/amos-boot-module-cylinder-api/src/main/java/com/yeejoin/amos/boot/module/cylinder/flc/api/mapper/CylCylinderFillingCheckMapper.java
View file @
adef92c3
...
...
@@ -2,9 +2,12 @@ package com.yeejoin.amos.boot.module.cylinder.flc.api.mapper;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.yeejoin.amos.boot.module.cylinder.flc.api.entity.CylCylinderFillingCheck
;
import
com.yeejoin.amos.boot.module.cylinder.flc.api.entity.CylinderInfo
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
/**
* 液化气体气瓶充装信息-充装后复查 Mapper 接口
...
...
@@ -19,4 +22,10 @@ public interface CylCylinderFillingCheckMapper extends BaseMapper<CylCylinderFil
Integer
getFillingCountByMonth
(
@Param
(
"appId"
)
String
appId
,
@Param
(
"time"
)
Date
time
);
Integer
getFillingPassedCountByMonth
(
@Param
(
"appId"
)
String
appId
,
@Param
(
"time"
)
Date
time
);
Integer
getCylinderInfoCount
();
List
<
CylinderInfo
>
getCylinderInfoList
();
void
updateBatch
(
@Param
(
"sequenceNbrS"
)
List
<
Long
>
sequenceNbrS
);
}
amos-boot-system-tzs/amos-boot-module-cylinder/amos-boot-module-cylinder-api/src/main/java/com/yeejoin/amos/boot/module/cylinder/flc/api/mapper/CylinderInfoMapper.java
View file @
adef92c3
...
...
@@ -89,4 +89,6 @@ public interface CylinderInfoMapper extends BaseMapper<CylinderInfo> {
Integer
getInfoTotal
();
void
updateEsCylinderInfoStatus
(
@Param
(
"ids"
)
List
<
String
>
ids
);
Integer
saveOrUpdateBatch
(
@Param
(
"list"
)
List
<
CylinderInfo
>
list
);
}
amos-boot-system-tzs/amos-boot-module-cylinder/amos-boot-module-cylinder-api/src/main/resources/mapper/CylCylinderFillingCheckMapper.xml
View file @
adef92c3
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.yeejoin.amos.boot.module.cylinder.flc.api.mapper.CylCylinderFillingCheckMapper"
>
<select
id=
"getCylinderInfoCount"
resultType=
"java.lang.Integer"
>
SELECT count(1)
from (SELECT count(1)
FROM tm_cylinder_info ci
WHERE sync_state != 3
AND sequence_code
<![CDATA[<>]]>
''
AND app_id
<![CDATA[<>]]>
''
GROUP BY app_id, sequence_code)
</select>
<select
id=
"getCylinderInfoList"
resultType=
"com.yeejoin.amos.boot.module.cylinder.flc.api.entity.CylinderInfo"
>
SELECT ci.*,
'3' sync_state_str,
CAST(
(
(unit_name IS NOT NULL) + (factory_num IS NOT NULL) + (cylinder_status IS NOT NULL) +
(cylinder_variety IS NOT NULL) + (volume IS NOT NULL) +
(manufacturing_date IS NOT NULL) + (manufacturing_unit IS NOT NULL) +
(unit_inner_code IS NOT NULL) + (sequence_code IS NOT NULL) +
(credit_code IS NOT NULL) + (filling_media IS NOT NULL) +
(product_name IS NOT NULL) + (product_qualified IS NOT NULL) +
(proof_quality IS NOT NULL) + (supervision_inspec IS NOT NULL) +
(type_experiments IS NOT NULL) + (valve_manufactur_unit IS NOT NULL) +
(nominal_work_pressure IS NOT NULL) + (cylinder_variety_name IS NOT NULL) +
(filling_media_name IS NOT NULL)
) / 20 AS DECIMAL(10, 2)
) integrity,-- // postgresl适用
ci.sync_date syncDate
FROM tm_cylinder_info ci
WHERE sync_state != 3
AND sequence_code
<![CDATA[<>]]>
''
AND app_id
<![CDATA[<>]]>
''
ORDER BY rec_date
LIMIT 1000;
</select>
<update
id=
"updateBatch"
>
update tm_cylinder_info set sync_state = 3
<where>
<if
test=
"sequenceNbrS != null and sequenceNbrS.size() > 0"
>
sequence_nbr in
<foreach
item=
"sequenceNbr"
collection=
"sequenceNbrS"
separator=
","
open=
"("
close=
")"
index=
""
>
#{sequenceNbr}
</foreach>
</if>
</where>
</update>
</mapper>
amos-boot-system-tzs/amos-boot-module-cylinder/amos-boot-module-cylinder-api/src/main/resources/mapper/CylinderInfoMapper.xml
View file @
adef92c3
...
...
@@ -345,4 +345,78 @@
#{id}
</foreach>
</update>
<insert
id=
"saveOrUpdateBatch"
>
INSERT INTO "amos_tzs_biz"."tz_cylinder_info"
VALUES
<foreach
collection=
"list"
item=
"item"
index=
"index"
separator=
","
>
(#{item.sequenceNbr},
#{item.unitName},
#{item.factoryNum},
#{item.cylinderStatus},
#{item.cylinderVariety},
#{item.volume},
#{item.manufacturingDate},
#{item.manufacturingUnit},
#{item.unitInnerCode},
#{item.sequenceCode},
#{item.earlyWarningLevel},
#{item.earlyWarningLevelCalDate},
#{item.endCustomCode},
#{item.recDate},
null,
#{item.syncDate},
'3',
#{item.appId},
#{item.integrity},
#{item.longitude},
#{item.latitude},
#{item.creditCode},
#{item.fillingMedia},
#{item.productName},
#{item.productQualified},
#{item.proofQuality},
#{item.supervisionInspec},
#{item.typeExperiments},
#{item.valveManufacturUnit},
#{item.nominalWorkPressure},
#{item.cylinderVarietyName},
#{item.fillingMediaName},
null)
</foreach>
on conflict (app_id,sequence_code) do update set
"sequence_nbr" = EXCLUDED."sequence_nbr",
"unit_name" = EXCLUDED."unit_name",
"factory_num" = EXCLUDED."factory_num",
"cylinder_status" = EXCLUDED."cylinder_status",
"cylinder_variety" = EXCLUDED."cylinder_variety",
"volume" = EXCLUDED."volume",
"manufacturing_date" = EXCLUDED."manufacturing_date",
"manufacturing_unit" = EXCLUDED."manufacturing_unit",
"unit_inner_code" = EXCLUDED."unit_inner_code",
"sequence_code" = EXCLUDED."sequence_code",
"early_warning_level" = EXCLUDED."early_warning_level",
"early_warning_level_cal_date" = EXCLUDED."early_warning_level_cal_date",
"end_custom_code" = EXCLUDED."end_custom_code",
"rec_date" = EXCLUDED."rec_date",
"rec_user_id" = EXCLUDED."rec_user_id",
"sync_date" = EXCLUDED."sync_date",
"sync_state" = EXCLUDED."sync_state",
"app_id" = EXCLUDED."app_id",
"integrity" = EXCLUDED."integrity",
"longitude" = EXCLUDED."longitude",
"latitude" = EXCLUDED."latitude",
"credit_code" = EXCLUDED."credit_code",
"filling_media" = EXCLUDED."filling_media",
"product_name" = EXCLUDED."product_name",
"product_qualified" = EXCLUDED."product_qualified",
"proof_quality" = EXCLUDED."proof_quality",
"supervision_inspec" = EXCLUDED."supervision_inspec",
"type_experiments" = EXCLUDED."type_experiments",
"valve_manufactur_unit" = EXCLUDED."valve_manufactur_unit",
"nominal_work_pressure" = EXCLUDED."nominal_work_pressure",
"cylinder_variety_name" = EXCLUDED."cylinder_variety_name",
"filling_media_name" = EXCLUDED."filling_media_name",
"is_not_es" = EXCLUDED."is_not_es"
</insert>
</mapper>
amos-boot-system-tzs/amos-boot-module-cylinder/amos-boot-module-cylinder-biz/src/main/java/com/yeejoin/amos/boot/module/cylinder/flc/biz/controller/CylSyncController.java
View file @
adef92c3
...
...
@@ -32,4 +32,19 @@ public class CylSyncController {
return
ResponseHelper
.
buildResponse
(
cylSyncService
.
testSync
());
}
/**
* test
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@ApiOperation
(
value
=
"cylinderInfo"
,
notes
=
"cylinderInfo"
)
@GetMapping
(
value
=
"/sync/cylinderInfo"
)
public
ResponseModel
<
Object
>
cylinderInfo
(){
return
ResponseHelper
.
buildResponse
(
cylSyncService
.
cylinderInfo
());
}
}
amos-boot-system-tzs/amos-boot-module-cylinder/amos-boot-module-cylinder-biz/src/main/java/com/yeejoin/amos/boot/module/cylinder/flc/biz/service/impl/CylSyncServiceImpl.java
View file @
adef92c3
package
com
.
yeejoin
.
amos
.
boot
.
module
.
cylinder
.
flc
.
biz
.
service
.
impl
;
import
com.baomidou.dynamic.datasource.annotation.DS
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.google.common.collect.Lists
;
import
com.yeejoin.amos.boot.module.cylinder.api.entity.ESCylinderFillingRecordDto
;
import
com.yeejoin.amos.boot.module.cylinder.api.enums.CylDictEnum
;
import
com.yeejoin.amos.boot.module.cylinder.flc.api.entity.CylCylinderFillingCheck
;
import
com.yeejoin.amos.boot.module.cylinder.flc.api.entity.CylinderFillingCheck
;
import
com.yeejoin.amos.boot.module.cylinder.flc.api.entity.CylinderInfo
;
import
com.yeejoin.amos.boot.module.cylinder.flc.api.mapper.CylinderInfoMapper
;
import
io.swagger.models.auth.In
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.ObjectUtils
;
import
org.typroject.tyboot.core.foundation.exception.BaseException
;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Objects
;
import
java.util.stream.Collectors
;
@Service
public
class
CylSyncServiceImpl
{
...
...
@@ -18,6 +30,9 @@ public class CylSyncServiceImpl {
@Autowired
private
CylinderSyncServiceImpl
sourceFillingCheckServiceImpl
;
@Autowired
private
CylinderInfoMapper
cylinderInfoMapper
;
@Autowired
private
CylinderFillingCheckServiceImpl
targetFillingCheckServiceImpl
;
...
...
@@ -39,4 +54,39 @@ public class CylSyncServiceImpl {
}
return
"failed"
;
}
public
boolean
cylinderInfo
()
{
Integer
count
=
sourceFillingCheckServiceImpl
.
getCylinderInfoCount
();
Integer
times
=
0
;
if
(
count
!=
0
)
{
times
=
count
/
1000
;
int
last
=
count
%
1000
;
if
(
last
>
0
)
{
times
++;
}
}
else
{
return
false
;
}
for
(
int
i
=
0
;
i
<
times
;
i
++)
{
LoopSaveCylinderInfo
();
}
return
true
;
}
@Transactional
(
rollbackFor
=
{
Exception
.
class
})
void
LoopSaveCylinderInfo
()
{
List
<
CylinderInfo
>
cylinderInfoList
=
sourceFillingCheckServiceImpl
.
getCylinderInfoList
();
if
(!
ObjectUtils
.
isEmpty
(
cylinderInfoList
))
{
for
(
CylinderInfo
cylinderInfo
:
cylinderInfoList
)
{
cylinderInfo
.
setCylinderStatus
(
Objects
.
requireNonNull
(
Objects
.
requireNonNull
(
CylDictEnum
.
getEnum
(
cylinderInfo
.
getCylinderStatus
(),
CylDictEnum
.
cylinder_Status_0
.
getKey
()))).
getSeqNbr
());
cylinderInfo
.
setCylinderVariety
(
Objects
.
requireNonNull
(
Objects
.
requireNonNull
(
CylDictEnum
.
getEnum
(
cylinderInfo
.
getCylinderVariety
(),
CylDictEnum
.
cylinder_Variety_1
.
getKey
()))).
getSeqNbr
());
}
cylinderInfoMapper
.
saveOrUpdateBatch
(
cylinderInfoList
);
List
<
Long
>
sequenceNbrS
=
cylinderInfoList
.
stream
().
map
(
CylinderInfo:
:
getSequenceNbr
).
collect
(
Collectors
.
toList
());
sourceFillingCheckServiceImpl
.
updateBatch
(
sequenceNbrS
);
}
}
}
amos-boot-system-tzs/amos-boot-module-cylinder/amos-boot-module-cylinder-biz/src/main/java/com/yeejoin/amos/boot/module/cylinder/flc/biz/service/impl/CylinderSyncServiceImpl.java
View file @
adef92c3
...
...
@@ -2,11 +2,13 @@ package com.yeejoin.amos.boot.module.cylinder.flc.biz.service.impl;
import
com.baomidou.dynamic.datasource.annotation.DS
;
import
com.yeejoin.amos.boot.module.cylinder.flc.api.entity.CylCylinderFillingCheck
;
import
com.yeejoin.amos.boot.module.cylinder.flc.api.entity.CylinderInfo
;
import
com.yeejoin.amos.boot.module.cylinder.flc.api.mapper.CylCylinderFillingCheckMapper
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.List
;
import
java.util.Map
;
/**
* 液化气体气瓶同步实现类
...
...
@@ -23,4 +25,18 @@ public class CylinderSyncServiceImpl {
public
List
<
CylCylinderFillingCheck
>
fillingCheckSync
()
{
return
fillingCheckMapper
.
selectList
(
null
);
}
public
Integer
getCylinderInfoCount
()
{
return
fillingCheckMapper
.
getCylinderInfoCount
();
}
public
List
<
CylinderInfo
>
getCylinderInfoList
()
{
return
fillingCheckMapper
.
getCylinderInfoList
();
}
public
void
updateBatch
(
List
<
Long
>
sequenceNbrS
)
{
fillingCheckMapper
.
updateBatch
(
sequenceNbrS
);
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment