Merge remote-tracking branch 'origin/master'

master
赵嘉伟 3 years ago
commit fbb4e40535

@ -22,11 +22,21 @@ public class IntegrationLogController {
@ResponseBody @ResponseBody
@PostMapping("redoSend") @PostMapping("redoSend")
public R shopOrderRelease(@RequestBody List<IntegrationLog> integrationLogs) { public R shopOrderRelease(@RequestBody List<IntegrationLog> integrationLogs) {
StringBuffer stringBuffer = new StringBuffer("");
for (IntegrationLog integrationLog: integrationLogs) { for (IntegrationLog integrationLog: integrationLogs) {
integrationLogService.redoSend(integrationLog.getHandle()); try {
String str = integrationLogService.redoSend(integrationLog.getHandle());
if (str != null){
stringBuffer.append("ERP接口错误" + str + ";");
}
}catch (Exception e){
return R.failed("重发失败:" + e.getMessage());
}
}
if (stringBuffer.toString().equals("")){
return R.ok();
} }
return R.ok(); return R.failed(stringBuffer);
} }
} }

@ -15,6 +15,8 @@ public interface IntegrationLogService extends IService<IntegrationLog> {
void saveIntegrationLog(IntegrationLog integrationLog); void saveIntegrationLog(IntegrationLog integrationLog);
void redoSend(String handle); void updateIntegrationLog(IntegrationLog integrationLog);
String redoSend(String handle);
} }

@ -12,6 +12,7 @@ import com.foreverwin.mesnac.integration.mapper.IntegrationLogMapper;
import com.foreverwin.mesnac.integration.model.IntegrationLog; import com.foreverwin.mesnac.integration.model.IntegrationLog;
import com.foreverwin.mesnac.integration.service.IntegrationLogService; import com.foreverwin.mesnac.integration.service.IntegrationLogService;
import com.foreverwin.modular.core.exception.BaseException; import com.foreverwin.modular.core.exception.BaseException;
import com.foreverwin.modular.core.exception.BusinessException;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Propagation;
@ -43,7 +44,13 @@ public class IntegrationLogServiceImpl extends ServiceImpl<IntegrationLogMapper,
} }
@Override @Override
public void redoSend(String handle) { @Transactional(propagation = Propagation.REQUIRES_NEW)
public void updateIntegrationLog(IntegrationLog integrationLog) {
integrationLogMapper.updateById(integrationLog);
}
@Override
public String redoSend(String handle) {
IntegrationLog byId = getById(handle); IntegrationLog byId = getById(handle);
if (byId==null||!byId.getStatus().equals("R")){ if (byId==null||!byId.getStatus().equals("R")){
throw new BaseException("状态已变更,请刷新"); throw new BaseException("状态已变更,请刷新");
@ -73,16 +80,18 @@ public class IntegrationLogServiceImpl extends ServiceImpl<IntegrationLogMapper,
if (!status.equals("S")) { if (!status.equals("S")) {
throw new BaseException("ERP接口返回错误消息:" + message); throw new BaseException("ERP接口返回错误消息:" + message);
} }
byId.setStatus(status);
byId.setResultMessage(message);
updateById(byId);
} catch (RemoteException e) { } catch (RemoteException e) {
throw new BaseException("ERP接口错误: " + e.getMessage());
} finally {
byId.setRequestDateTime(LocalDateTime.now()); byId.setRequestDateTime(LocalDateTime.now());
byId.setResultMessage(message); byId.setResultMessage("ERP接口错误" + e.getMessage());
if (status.equals("S")){ // updateById(byId);
byId.setStatus(status);
}
updateById(byId); updateById(byId);
// throw new BaseException("ERP接口错误: " + e.getMessage());
return e.getMessage();
} }
return null;
} }

Loading…
Cancel
Save