This commit is contained in:
xd 2024-06-10 14:09:20 +08:00
parent 44af7b5ac4
commit faf8dbc055
3 changed files with 89 additions and 10 deletions

View File

@ -16,10 +16,7 @@ import com.ruoyi.system.service.ISysOperLogService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -41,7 +38,7 @@ public class quotJswController extends BaseController {
{ {
// 接口调用记录 // 接口调用记录
SysOperLog sysOperLog = new SysOperLog(); SysOperLog sysOperLog = new SysOperLog();
sysOperLog.setTitle("金思维回报价数据"); sysOperLog.setTitle("金思维报价数据");
sysOperLog.setOperParam(quotJson); sysOperLog.setOperParam(quotJson);
sysOperLog.setRequestMethod("POST"); sysOperLog.setRequestMethod("POST");
sysOperLog.setOperTime(DateUtils.getNowDate()); sysOperLog.setOperTime(DateUtils.getNowDate());
@ -148,7 +145,17 @@ public class quotJswController extends BaseController {
return R.fail(errMsg); return R.fail(errMsg);
} }
String quotJswApprovalStatus = q.getQuotJswApprovalStatus();
if(!"1".equals(quotJswApprovalStatus)){
String errMsg = "报价单号:"+quot.getQuotCode()+" 金思维非协助中状态,同步失败";
sysOperLog.setStatus(1);
long endTime = System.currentTimeMillis();
sysOperLog.setCostTime(endTime - startTime);
sysOperLog.setErrorMsg(errMsg);
sysOperLog.setJsonResult(JSONArray.toJSONString(R.fail(errMsg)));
iSysOperLogService.insertOperlog(sysOperLog);
return R.fail(errMsg);
}
q.setQuotJswCode(quot.getQuotJswCode()); q.setQuotJswCode(quot.getQuotJswCode());
q.setQuotLvPrice(quot.getQuotLvPrice()); q.setQuotLvPrice(quot.getQuotLvPrice());
@ -181,7 +188,78 @@ public class quotJswController extends BaseController {
q.setQuotMaterialList(qmaterials); q.setQuotMaterialList(qmaterials);
quotService.updateQuot(q); quotService.updateQuot(q);
}catch(Exception e){ }catch(Exception e){
String errMsg = "接口异常,同步失败"; String errMsg = "同步报价数据接口异常,同步失败";
sysOperLog.setStatus(1);
long endTime = System.currentTimeMillis();
sysOperLog.setCostTime(endTime - startTime);
sysOperLog.setErrorMsg(errMsg);
sysOperLog.setJsonResult(JSONArray.toJSONString(R.fail(errMsg)));
iSysOperLogService.insertOperlog(sysOperLog);
return R.fail(errMsg);
}
sysOperLog.setStatus(0);
long endTime = System.currentTimeMillis();
sysOperLog.setCostTime(endTime - startTime);
sysOperLog.setJsonResult(R.ok().toString());
iSysOperLogService.insertOperlog(sysOperLog);
return R.ok();
}
@ApiOperation("更新金思维协助状态")
@PostMapping("/updateQuotJsw")
public R<String> updateQuotJsw(@RequestParam String quotCode) {
// 接口调用记录
SysOperLog sysOperLog = new SysOperLog();
sysOperLog.setTitle("更新金思维协助状态");
sysOperLog.setOperParam(quotCode);
sysOperLog.setRequestMethod("POST");
sysOperLog.setOperTime(DateUtils.getNowDate());
long startTime = System.currentTimeMillis();
try {
if(StringUtils.isBlank(quotCode)){
String errMsg = "报价单号为空,更新失败";
sysOperLog.setStatus(1);
long endTime = System.currentTimeMillis();
sysOperLog.setCostTime(endTime - startTime);
sysOperLog.setErrorMsg(errMsg);
sysOperLog.setJsonResult(JSONArray.toJSONString(R.fail(errMsg)));
iSysOperLogService.insertOperlog(sysOperLog);
return R.fail(errMsg);
}
String quotId = quotService.selectQuotByQuotCode(quotCode);
if(StringUtils.isEmpty(quotId)){
String errMsg = "报价单号:"+quotCode+" 系统中不存在,同步失败";
sysOperLog.setStatus(1);
long endTime = System.currentTimeMillis();
sysOperLog.setCostTime(endTime - startTime);
sysOperLog.setErrorMsg(errMsg);
sysOperLog.setJsonResult(JSONArray.toJSONString(R.fail(errMsg)));
iSysOperLogService.insertOperlog(sysOperLog);
return R.fail(errMsg);
}
Quot q = quotService.selectQuotByQuotId(quotId);
String quotApprovalStatus = q.getQuotApprovalStatus();
if(!"1".equals(quotApprovalStatus)){
String errMsg = "报价单号:"+q.getQuotCode()+" 非协助中状态,同步失败";
sysOperLog.setStatus(1);
long endTime = System.currentTimeMillis();
sysOperLog.setCostTime(endTime - startTime);
sysOperLog.setErrorMsg(errMsg);
sysOperLog.setJsonResult(JSONArray.toJSONString(R.fail(errMsg)));
iSysOperLogService.insertOperlog(sysOperLog);
return R.fail(errMsg);
}
q.setQuotJswApprovalStatus("1");
quotService.updateQuot(q);
}catch(Exception e){
String errMsg = "更新金思维协助状态接口异常,同步失败";
sysOperLog.setStatus(1); sysOperLog.setStatus(1);
long endTime = System.currentTimeMillis(); long endTime = System.currentTimeMillis();
sysOperLog.setCostTime(endTime - startTime); sysOperLog.setCostTime(endTime - startTime);

View File

@ -129,6 +129,7 @@ public class RedBookServiceImpl implements IRedBookService
* 修改报价单 * 修改报价单
* @param quot * @param quot
*/ */
@Transactional
@Override @Override
public void updateOAQuot(OAQuot quot) { public void updateOAQuot(OAQuot quot) {
quot.setUpdateTime(DateUtils.getNowDate()); quot.setUpdateTime(DateUtils.getNowDate());
@ -202,7 +203,7 @@ public class RedBookServiceImpl implements IRedBookService
* @return * @return
*/ */
@Override @Override
@DataSource(DataSourceType.REDBOOK) @DataSource(DataSourceType.OAREDBOOK)
public List<OAQuotProduct> setRedBookPrice(List<OAQuotProduct> list) { public List<OAQuotProduct> setRedBookPrice(List<OAQuotProduct> list) {
for(OAQuotProduct oAQuotProduct : list){ for(OAQuotProduct oAQuotProduct : list){
String price = oaRedBookMapper.getFixDatePrice(oAQuotProduct.getName_0(),oAQuotProduct.getSpec(),oAQuotProduct.getVoltage(),oAQuotProduct.getUid_0()); String price = oaRedBookMapper.getFixDatePrice(oAQuotProduct.getName_0(),oAQuotProduct.getSpec(),oAQuotProduct.getVoltage(),oAQuotProduct.getUid_0());
@ -217,7 +218,7 @@ public class RedBookServiceImpl implements IRedBookService
* @return * @return
*/ */
@Override @Override
@DataSource(DataSourceType.REDBOOK) @DataSource(DataSourceType.OAREDBOOK)
public List<OAQuotProduct> setRedBookPrice2(List<OAQuotProductTemplate> list) { public List<OAQuotProduct> setRedBookPrice2(List<OAQuotProductTemplate> list) {
List<OAQuotProduct> OAQuotProducts = new ArrayList<>(); List<OAQuotProduct> OAQuotProducts = new ArrayList<>();
OAQuotProduct oAQuotProduct = new OAQuotProduct(); OAQuotProduct oAQuotProduct = new OAQuotProduct();

View File

@ -1545,7 +1545,7 @@ export default {
} }
}); });
this.form.quotQuantity = sums[6]; this.form.quotQuantity = sums[6];
this.form.quotTotalPrice = sums[8]; this.form.quotTotalPrice = sums[12];
return sums; return sums;
}, },