基础信息导入导出,优化

master
anthonyywj2 3 years ago
parent 8e7fc2d784
commit 8e27780b04

@ -430,7 +430,6 @@ public class StockOrderDetailController {
CompanyProductRelevanceRequest companyProductRelevanceRequest = new CompanyProductRelevanceRequest();
BeanUtils.copyProperties(filterUdiInfoRequest, companyProductRelevanceRequest);
List<CompanyProductRelevanceResponse> basicInstrumentMaintainRelevanceResponses = null;
if (filterUdiInfoRequest.getCustomerId().equals(Constant.SYSTEM_CUSTOMER_ID)) {
BussinessLocalTypeEntity bussinessTypeEntity = bussinessLocalTypeService.findBTByAction(filterUdiInfoRequest.getBillType());
if (bussinessTypeEntity.getCorpType() == ConstantStatus.CORP_TYPE_OUT) {
companyProductRelevanceRequest.setCustomerId(null);
@ -439,9 +438,6 @@ public class StockOrderDetailController {
} else {
basicInstrumentMaintainRelevanceResponses = getHosDatas(filterUdiInfoRequest);
}
} else {
basicInstrumentMaintainRelevanceResponses = companyProductRelevanceService.filterUdiGp(companyProductRelevanceRequest);
}
PageInfo<CompanyProductRelevanceResponse> pageInfo;
pageInfo = new PageInfo<>(basicInstrumentMaintainRelevanceResponses);
PageSimpleResponse<CompanyProductRelevanceResponse> pageSimpleResponse = new PageSimpleResponse<>();

@ -2,14 +2,23 @@ package com.glxp.api.admin.service.basic.impl;
import cn.hutool.core.collection.CollUtil;
import com.github.pagehelper.PageHelper;
import com.glxp.api.admin.dao.basic.BasicUnitMaintainDao;
import com.glxp.api.admin.dao.basic.UdiInfoDao;
import com.glxp.api.admin.dao.basic.UdiInfoImportDetailDao;
import com.glxp.api.admin.dao.basic.UdiRelevanceDao;
import com.glxp.api.admin.dao.thrsys.ThrProductsDao;
import com.glxp.api.admin.entity.basic.BasicUnitMaintainEntity;
import com.glxp.api.admin.entity.basic.UdiInfoEntity;
import com.glxp.api.admin.entity.basic.UdiInfoImportDetailEntity;
import com.glxp.api.admin.entity.basic.UdiRelevanceEntity;
import com.glxp.api.admin.entity.thrsys.ThrProductsEntity;
import com.glxp.api.admin.req.basic.FilterUdiIpLogRequest;
import com.glxp.api.admin.res.basic.UdiRelevanceExportJsonResponse;
import com.glxp.api.admin.service.basic.UdiInfoImportDetailService;
import org.apache.ibatis.session.ExecutorType;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.TransactionIsolationLevel;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
@ -28,6 +37,8 @@ public class UdiInfoImportDetailServiceImpl implements UdiInfoImportDetailServic
UdiRelevanceDao udiRelevanceDao;
@Resource
ThrProductsDao thrProductsDao;
@Resource
SqlSessionFactory sqlSessionFactory;
@Override
public List<UdiInfoImportDetailEntity> filterUdiInfoImport(FilterUdiIpLogRequest filterInCodeLogRequest) {
@ -73,15 +84,52 @@ public class UdiInfoImportDetailServiceImpl implements UdiInfoImportDetailServic
@Async
public void importJsonData(UdiRelevanceExportJsonResponse udiRelevanceExportJsonResponse) {
if (CollUtil.isNotEmpty(udiRelevanceExportJsonResponse.getUdiInfoEntities())) {
udiInfoDao.importUdiInfo(udiRelevanceExportJsonResponse.getUdiInfoEntities());
SqlSession batchSession = sqlSessionFactory.openSession(ExecutorType.BATCH, TransactionIsolationLevel.READ_COMMITTED);
if (CollUtil.isNotEmpty(udiRelevanceExportJsonResponse.getUdiInfoEntities())) {
try {
List<UdiInfoEntity> corpList = udiRelevanceExportJsonResponse.getUdiInfoEntities();
UdiInfoDao mapper = batchSession.getMapper(UdiInfoDao.class);
for (UdiInfoEntity basicUnitMaintainEntity : corpList) {
mapper.insertUdiInfo(basicUnitMaintainEntity);
}
batchSession.commit();
} catch (Exception e) {
}
}
// udiInfoDao.importUdiInfo(udiRelevanceExportJsonResponse.getUdiInfoEntities());
}
if (CollUtil.isNotEmpty(udiRelevanceExportJsonResponse.getUdiRelevanceEntities())) {
udiRelevanceDao.importUdiRelevance(udiRelevanceExportJsonResponse.getUdiRelevanceEntities());
SqlSession batchSession = sqlSessionFactory.openSession(ExecutorType.BATCH, TransactionIsolationLevel.READ_COMMITTED);
try {
List<UdiRelevanceEntity> corpList = udiRelevanceExportJsonResponse.getUdiRelevanceEntities();
UdiRelevanceDao mapper = batchSession.getMapper(UdiRelevanceDao.class);
for (UdiRelevanceEntity basicUnitMaintainEntity : corpList) {
mapper.insertUdiRelevance(basicUnitMaintainEntity);
}
batchSession.commit();
} catch (Exception e) {
}
// udiRelevanceDao.importUdiRelevance(udiRelevanceExportJsonResponse.getUdiRelevanceEntities());
}
if (CollUtil.isNotEmpty(udiRelevanceExportJsonResponse.getThrProductsEntities())) {
thrProductsDao.importThrProductss(udiRelevanceExportJsonResponse.getThrProductsEntities());
SqlSession batchSession = sqlSessionFactory.openSession(ExecutorType.BATCH, TransactionIsolationLevel.READ_COMMITTED);
try {
List<ThrProductsEntity> corpList = udiRelevanceExportJsonResponse.getThrProductsEntities();
ThrProductsDao mapper = batchSession.getMapper(ThrProductsDao.class);
for (ThrProductsEntity basicUnitMaintainEntity : corpList) {
mapper.insertThrProducts(basicUnitMaintainEntity);
}
batchSession.commit();
} catch (Exception e) {
}
// thrProductsDao.importThrProductss(udiRelevanceExportJsonResponse.getThrProductsEntities());
}
}
}

@ -168,10 +168,10 @@
<insert id="importBasicUnitMaintain" keyProperty="id">
REPLACE
INTO basic_corp
(id, thirdId, erpId, name, spell,
( thirdId, erpId, name, spell,
addr, status, type, creditNo, contact, mobile, thirdId1, thirdId2, thirdId3, thirdId4,
thirdName, thirdName1, thirdName2, thirdName3, thirdName4, updateTime, corpType)
values (#{id},
values (
#{thirdId},
#{erpId},
#{name},
@ -192,6 +192,7 @@
#{thirdName3},
#{thirdName4},
#{updateTime},
#{corpType})
#{corpType}
)
</insert>
</mapper>

@ -42,13 +42,13 @@
basic_products.tyshxydm,basic_products.ylqxzcrbarmc,basic_products.zczbhhzbapzbh,
basic_products.ylqxzcrbarywmc,basic_products.sydycpbs,basic_products.uuid,
basic_products.sjcpbm,basic_products.versionNumber,basic_products.diType,
customer_info.companyName, basic_udirel.mainId,basic_udirel.mainName,basic_udirel.isAdavence
basic_udirel.mainId,basic_udirel.mainName,basic_udirel.isAdavence
FROM company_product_relevance
inner JOIN basic_udirel
ON company_product_relevance.udiRlIdFk = basic_udirel.id
inner JOIN basic_products
ON basic_udirel.uuid = basic_products.uuid
inner JOIN customer_info on customer_info.customerId = company_product_relevance.customerId
<where>
<if test="ylqxzcrbarmc != '' and ylqxzcrbarmc != null">
AND ylqxzcrbarmc LIKE concat(#{ylqxzcrbarmc},'%')

@ -25,31 +25,39 @@
<select id="findByUuid" parameterType="java.lang.String"
resultType="com.glxp.api.admin.entity.basic.UdiInfoEntity">
SELECT * FROM basic_products WHERE (
SELECT *
FROM basic_products
WHERE (
uuid = #{uuid}) limit 1
</select>
<select id="findByUuids" parameterType="java.lang.String"
resultType="com.glxp.api.admin.entity.basic.UdiInfoEntity">
SELECT * FROM basic_products WHERE (
SELECT *
FROM basic_products
WHERE (
uuid = #{uuid})
</select>
<select id="findByNameCode" parameterType="java.lang.String"
resultType="com.glxp.api.admin.entity.basic.UdiInfoEntity">
SELECT * FROM basic_products WHERE (
SELECT *
FROM basic_products
WHERE (
nameCode = #{nameCode}) limit 1
</select>
<insert id="insertUdiInfo" keyProperty="id" parameterType="com.glxp.api.admin.entity.basic.UdiInfoEntity">
replace INTO basic_products
replace
INTO basic_products
(
nameCode,packRatio,packLevel,bhxjsl,
id,nameCode,packRatio,packLevel,bhxjsl,
bhzxxsbzsl,zxxsbzbhsydysl,bhxjcpbm,bzcj,addType,deviceRecordKey,
cpmctymc,cplb,flbm,ggxh,qxlb,tyshxydm,ylqxzcrbarmc,zczbhhzbapzbh,ylqxzcrbarywmc,uuid,sjcpbm,versionNumber
,diType,productType
)
values
(
#{id},
#{nameCode},
#{packRatio},
#{packLevel},
@ -119,11 +127,15 @@
</insert>
<delete id="deleteById" parameterType="Map">
DELETE FROM basic_products WHERE id = #{id}
DELETE
FROM basic_products
WHERE id = #{id}
</delete>
<delete id="deleteByUuid" parameterType="Map">
DELETE FROM basic_products WHERE uuid = #{uuid}
DELETE
FROM basic_products
WHERE uuid = #{uuid}
</delete>
<update id="updateUdiInfo" parameterType="com.glxp.api.admin.entity.basic.UdiInfoEntity">

@ -257,12 +257,13 @@
replace
INTO basic_udirel
(
thirdId,thirdName,uuid,isUseDy,updateTime,
id,thirdId,thirdName,uuid,isUseDy,updateTime,
thirdId1,thirdId2,thirdId3,thirdId4,thirdName1,thirdName2,thirdName3,thirdName4,manufactory,measname,ybbm,sptm,isDisable,isLock
,mainId,mainName,lockStatus,udplatCode,isAdavence
)
values
(
#{id},
#{thirdId},
#{thirdName},
#{uuid},

@ -99,8 +99,9 @@
</update>
<insert id="importThrCorp" parameterType="com.glxp.api.admin.entity.thrsys.ThrCorpEntity">
replace into thr_corp (id, unitId, spell, addr, creditNo, contact, mobile, thirdSysFk, name, updateTime)
values (#{id},
replace
into thr_corp (unitId, spell, addr, creditNo, contact, mobile, thirdSysFk, name, updateTime)
values (
#{unitId},
#{spell},
#{addr},
@ -109,6 +110,7 @@
#{mobile},
#{thirdSysFk},
#{name},
#{updateTime})
#{updateTime}
)
</insert>
</mapper>
Loading…
Cancel
Save