|
|
@@ -18,6 +18,8 @@ import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
+import java.text.ParseException;
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
|
|
@@ -40,13 +42,14 @@ public class InvSourceServiceImpl extends ServiceImpl<InvSourceMapper, InvSource
|
|
|
|
|
|
List<InvSourceExcel> invSourceExcels = EasyExcelUtils.readInvSourceExcel(uploadFilePath + file, InvSourceExcel.class);
|
|
|
List<InvSource> invSources = JSON.parseArray(JSONArray.toJSONString(invSourceExcels), InvSource.class);
|
|
|
-
|
|
|
SysUser user = BaseController.getUser();
|
|
|
- InvSource invSource = new InvSource();
|
|
|
- invSource.setRevenueName(String.valueOf(user));
|
|
|
|
|
|
DateTime dateTime = new DateTime();
|
|
|
- invSource.setRevenueTime(String.valueOf(dateTime));
|
|
|
+
|
|
|
+ for (InvSource invSource : invSources) {
|
|
|
+ invSource.setRevenueName(user.getName());
|
|
|
+ invSource.setRevenueTime(dateTime.toString());
|
|
|
+ }
|
|
|
|
|
|
boolean result = invSourceService.saveOrUpdateBatchWithConditions(invSources);
|
|
|
return result ? HttpResult.ok("导入成功") : HttpResult.error("导入失败");
|
|
|
@@ -66,12 +69,13 @@ public class InvSourceServiceImpl extends ServiceImpl<InvSourceMapper, InvSource
|
|
|
@Transactional
|
|
|
public boolean saveOrUpdateBatchWithConditions(List<InvSource> invSourceList) {
|
|
|
for (InvSource invSource : invSourceList) {
|
|
|
+
|
|
|
+
|
|
|
InvSource one = baseMapper.selectOne(new LambdaQueryWrapper<InvSource>()
|
|
|
.eq(InvSource::getLicenseno, invSource.getLicenseno())
|
|
|
.eq(InvSource::getJqPolicyId, invSource.getJqPolicyId())
|
|
|
.eq(InvSource::getSyPolicyId, invSource.getSyPolicyId())
|
|
|
- .eq(InvSource::getNonCarPolicyId, invSource.getNonCarPolicyId())
|
|
|
- .eq(InvSource::getRevenueTime,invSource.getRevenueTime()));
|
|
|
+ .eq(InvSource::getNonCarPolicyId, invSource.getNonCarPolicyId()));
|
|
|
|
|
|
if (one != null) {
|
|
|
invSource.setId(one.getId());
|
|
|
@@ -83,6 +87,7 @@ public class InvSourceServiceImpl extends ServiceImpl<InvSourceMapper, InvSource
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|