fix(asms): 国标同步问题
This commit is contained in:
+6
-3
@@ -540,11 +540,14 @@ public class LawsAsmsOpenApiServiceImpl extends ServiceImpl<LawsAsmsOpenApiMappe
|
||||
lawsDomesticStandard.setCreateTime(getSimpleDate2(lawsAsmsDomestic.getCreateTimeString()));
|
||||
// 更新时间
|
||||
lawsDomesticStandard.setUpdateTime(getSimpleDate2(lawsAsmsDomestic.getUpdateTimeString()));
|
||||
LawsDomesticStandard domesticStandard = lawsDomesticStandardService.getById(lawsAsmsDomestic.getId());
|
||||
int count = lawsDomesticStandardService.queryCountById(lawsAsmsDomestic.getId());
|
||||
if (count > 0){
|
||||
lawsDomesticStandardService.updateById(lawsDomesticStandard);
|
||||
}else {
|
||||
if (count > 0 && Objects.isNull(domesticStandard)){
|
||||
// 物理删除
|
||||
lawsDomesticStandardService.delById(lawsAsmsDomestic.getId());
|
||||
lawsDomesticStandardService.save(lawsDomesticStandard);
|
||||
}else {
|
||||
lawsDomesticStandardService.updateById(lawsDomesticStandard);
|
||||
}
|
||||
// 同步es数据库
|
||||
lawsHomeSearchService.updateEsData(LawsHomeSearchCommon.LAWS_DOMESTIC_STANDARD, lawsDomesticStandard.getId(), LawsHomeSearchCommon.LAWS_ES_ADD);
|
||||
|
||||
+1
-7
@@ -140,17 +140,11 @@ public class SynchronizationAsmsService {
|
||||
} else {
|
||||
dupCodeList = new ArrayList<>();
|
||||
}
|
||||
// TODO:过滤数据测试用
|
||||
mapList = mapList.stream().filter(v -> v.get("createTime").substring(0, 10).equals("2024-02-22")).collect(Collectors.toList());
|
||||
List<LawsAsmsDomestic> lawsAsmsDomesticList = new ArrayList();
|
||||
mapList.forEach(eMap -> {
|
||||
String createTimeString = eMap.get("createTime");
|
||||
Date createTime = DateUtil.getDateSecond(createTimeString);
|
||||
// Date yesterday = DateUtil.getDateAddDays(new Date(), -1);
|
||||
Calendar instance = Calendar.getInstance();
|
||||
// TODO:过滤数据测试用
|
||||
instance.set(2024,1,23);
|
||||
Date yesterday = DateUtil.getDateAddDays(instance.getTime(), -1);
|
||||
Date yesterday = DateUtil.getDateAddDays(new Date(), -1);
|
||||
// 创建时间为昨天的数据
|
||||
if (createTime.after(DateUtil.getDayStart(yesterday)) && createTime.before(DateUtil.getDayEnd(yesterday))) {
|
||||
if (!dupCodeList.contains((String) eMap.get("code"))) {
|
||||
|
||||
+2
@@ -26,4 +26,6 @@ public interface LawsDomesticStandardMapper extends BaseMapper<LawsDomesticStand
|
||||
void cleanAnnulmentDate();
|
||||
|
||||
int queryCountById(@Param("id") String id);
|
||||
|
||||
int delById(@Param("id") String id);
|
||||
}
|
||||
|
||||
+4
@@ -46,6 +46,10 @@
|
||||
<result column="draft" property="draft" />
|
||||
</resultMap>
|
||||
|
||||
<delete id="delById">
|
||||
DELETE FROM laws_domestic_standard WHERE id = #{id}
|
||||
</delete>
|
||||
|
||||
<select id="queryCountById" resultType="java.lang.Integer">
|
||||
SELECT count(*) FROM laws_domestic_standard WHERE id = #{id}
|
||||
</select>
|
||||
|
||||
+6
@@ -86,4 +86,10 @@ public interface ILawsDomesticStandardService extends IService<LawsDomesticStand
|
||||
* @return
|
||||
*/
|
||||
int queryCountById(String id);
|
||||
|
||||
/**
|
||||
* 物理删除
|
||||
* @param id
|
||||
*/
|
||||
void delById(String id);
|
||||
}
|
||||
|
||||
+5
@@ -147,4 +147,9 @@ public class LawsDomesticStandardServiceImpl extends ServiceImpl<LawsDomesticSta
|
||||
public int queryCountById(String id) {
|
||||
return lawsDomesticStandardMapper.queryCountById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delById(String id) {
|
||||
lawsDomesticStandardMapper.delById(id);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user