|
|
|
@ -26,8 +26,12 @@ import javax.servlet.http.HttpServletRequest;
|
|
|
|
|
import javax.websocket.server.PathParam;
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
import java.io.InputStream;
|
|
|
|
|
import java.text.ParseException;
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
|
import java.time.LocalDateTime;
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Locale;
|
|
|
|
|
import java.util.Optional;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -100,6 +104,27 @@ public class OutStoreServiceImpl extends ServiceImpl<OutStoreMapper, OutStore> i
|
|
|
|
|
}
|
|
|
|
|
if (!Optional.ofNullable(outStoreList.get(0).getPostingDateTime()).isPresent()){
|
|
|
|
|
return R.failed("过账日期格式错误,格式需为:yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
}else {
|
|
|
|
|
for (OutStore outStore : outStoreList) {
|
|
|
|
|
String dateTime = outStore.getPostingDateTime();
|
|
|
|
|
if (outStore.getPostingDateTime().indexOf("CST") != -1){
|
|
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy", Locale.US);
|
|
|
|
|
Date date = sdf.parse(dateTime);
|
|
|
|
|
String formatStr = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(date);
|
|
|
|
|
outStore.setPostingDateTime(formatStr);
|
|
|
|
|
} else {
|
|
|
|
|
boolean result = false;
|
|
|
|
|
try {
|
|
|
|
|
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
Date date =format.parse(dateTime);
|
|
|
|
|
outStore.setPostingDateTime(dateTime);
|
|
|
|
|
} catch (ParseException e) {
|
|
|
|
|
result = true;
|
|
|
|
|
}
|
|
|
|
|
if (result)
|
|
|
|
|
return R.failed("过账日期格式错误,格式需为:yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (this.outStoreImportFile(outStoreList)){
|
|
|
|
|
return R.ok("导入数据成功");
|
|
|
|
@ -111,6 +136,4 @@ public class OutStoreServiceImpl extends ServiceImpl<OutStoreMapper, OutStore> i
|
|
|
|
|
return R.failed("导入数据失败" + e.getMessage());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|