From faf8dbc0557e2d5cf41be3d1facf1313c8aa27ba Mon Sep 17 00:00:00 2001 From: xd <844539747@qq.com> Date: Mon, 10 Jun 2024 14:09:20 +0800 Subject: [PATCH] '123' --- .../tool/quot/quotJswController.java | 92 +++++++++++++++++-- .../service/impl/RedBookServiceImpl.java | 5 +- ruoyi-ui/src/views/quot/quot/index.vue | 2 +- 3 files changed, 89 insertions(+), 10 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/quot/quotJswController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/quot/quotJswController.java index 43a0fb3..8d93a20 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/quot/quotJswController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/quot/quotJswController.java @@ -16,10 +16,7 @@ import com.ruoyi.system.service.ISysOperLogService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import java.util.ArrayList; import java.util.List; @@ -41,7 +38,7 @@ public class quotJswController extends BaseController { { // 接口调用记录 SysOperLog sysOperLog = new SysOperLog(); - sysOperLog.setTitle("金思维返回报价数据"); + sysOperLog.setTitle("金思维回传报价数据"); sysOperLog.setOperParam(quotJson); sysOperLog.setRequestMethod("POST"); sysOperLog.setOperTime(DateUtils.getNowDate()); @@ -148,7 +145,17 @@ public class quotJswController extends BaseController { 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.setQuotLvPrice(quot.getQuotLvPrice()); @@ -181,7 +188,78 @@ public class quotJswController extends BaseController { q.setQuotMaterialList(qmaterials); quotService.updateQuot(q); }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 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); long endTime = System.currentTimeMillis(); sysOperLog.setCostTime(endTime - startTime); diff --git a/ruoyi-system/src/main/java/com/ruoyi/redBook/service/impl/RedBookServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/redBook/service/impl/RedBookServiceImpl.java index 3017694..d9957b0 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/redBook/service/impl/RedBookServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/redBook/service/impl/RedBookServiceImpl.java @@ -129,6 +129,7 @@ public class RedBookServiceImpl implements IRedBookService * 修改报价单 * @param quot */ + @Transactional @Override public void updateOAQuot(OAQuot quot) { quot.setUpdateTime(DateUtils.getNowDate()); @@ -202,7 +203,7 @@ public class RedBookServiceImpl implements IRedBookService * @return */ @Override - @DataSource(DataSourceType.REDBOOK) + @DataSource(DataSourceType.OAREDBOOK) public List setRedBookPrice(List list) { for(OAQuotProduct oAQuotProduct : list){ String price = oaRedBookMapper.getFixDatePrice(oAQuotProduct.getName_0(),oAQuotProduct.getSpec(),oAQuotProduct.getVoltage(),oAQuotProduct.getUid_0()); @@ -217,7 +218,7 @@ public class RedBookServiceImpl implements IRedBookService * @return */ @Override - @DataSource(DataSourceType.REDBOOK) + @DataSource(DataSourceType.OAREDBOOK) public List setRedBookPrice2(List list) { List OAQuotProducts = new ArrayList<>(); OAQuotProduct oAQuotProduct = new OAQuotProduct(); diff --git a/ruoyi-ui/src/views/quot/quot/index.vue b/ruoyi-ui/src/views/quot/quot/index.vue index 22ca90a..bf88efb 100644 --- a/ruoyi-ui/src/views/quot/quot/index.vue +++ b/ruoyi-ui/src/views/quot/quot/index.vue @@ -1545,7 +1545,7 @@ export default { } }); this.form.quotQuantity = sums[6]; - this.form.quotTotalPrice = sums[8]; + this.form.quotTotalPrice = sums[12]; return sums; },