This commit is contained in:
xd 2024-05-30 16:17:17 +08:00
parent 008e007a09
commit af0898ccb0
21 changed files with 330 additions and 25 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

View File

@ -3,12 +3,14 @@ package com.ruoyi;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.scheduling.annotation.EnableAsync;
/**
* 启动程序
*
*
* @author ruoyi
*/
@EnableAsync
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
public class RuoYiApplication
{

View File

@ -118,6 +118,7 @@ public class QuotController extends BaseController
{
Quot quot = quotService.selectQuotByQuotId(quotId);
quot.setQuotApprovalStatus("1");// 提交状态设置为 协助中
quotService.updateQuot(quot);
return success(quot);
}

View File

@ -9,6 +9,7 @@ import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.enums.DataSourceType;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.uuid.UUID;
import com.ruoyi.customer.domain.Customer;
@ -17,13 +18,21 @@ import com.ruoyi.redBook.domain.Product;
import com.ruoyi.redBook.domain.OAQuot;
import com.ruoyi.redBook.domain.RbVersionDateResult;
import com.ruoyi.redBook.service.IRedBookService;
import com.ruoyi.redBook.service.impl.AsyncRbTaskService;
import com.ruoyi.web.utils.IdUtils;
import com.ruoyi.web.utils.ListSplitUtil;
import com.ruoyi.web.utils.rbExcel.excelUtil;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.math.BigDecimal;
import java.util.*;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
/**
* 红本管理Controller
@ -41,6 +50,9 @@ public class RedBookController extends BaseController
@Autowired
private RedisCache redisCache;
@Resource
private AsyncRbTaskService asyncRbTaskService;
/**
* 获取目录
* @param product
@ -302,15 +314,39 @@ public class RedBookController extends BaseController
*/
@DataSource(DataSourceType.OAREDBOOK)
@PostMapping("/updateSelectedResultData")
public AjaxResult updateSelectedResultData(@RequestBody List<OAQuotProduct> params)
{
public AjaxResult updateSelectedResultData(@RequestBody List<OAQuotProduct> params) throws ExecutionException, InterruptedException {
List<OAQuotProduct> oaQuotProducts = redBookService.queryRedBPriceByParams(params);
logger.info("根据选择的调价日期 匹配数据结果: {}", oaQuotProducts);
return success(oaQuotProducts);
System.out.println("开始时间:" + DateUtils.getTime());
List<List<OAQuotProduct>> list = ListSplitUtil.averageList(params,10);
List<OAQuotProduct> OAQuotProducts = new ArrayList<>();
//定义一个存所有线程回调函数的list
List<Future<List<OAQuotProduct>>> futureList=new ArrayList<>();
int num = 1;
for(List<OAQuotProduct> lt:list){
futureList.add(asyncRbTaskService.executeAsyncTask("线程"+num+""+lt.size()+"条】",lt));
num++;
}
//判断进程是否全部结束**
while (true){
//回调信息空了就结束**
if (futureList.isEmpty()){
break;
}
for (int i = 0; i < futureList.size(); i++) {
if (futureList.get(i).isDone()){
OAQuotProducts.addAll(futureList.get(i).get());
//判断线程结束输出回调信息并将该回调清除
futureList.remove(i);
}else {
continue;
}
}
}
System.out.println("结束时间:" + DateUtils.getTime());
return success(OAQuotProducts);
}
/**
* 查询已生成的报价单列表
*/

View File

@ -1,10 +1,15 @@
package com.ruoyi.web.controller.tool.quot;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.customer.domain.qcc.QccFuzzySearchJsonResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
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;
@ -15,9 +20,15 @@ public class quotJswController extends BaseController {
@ApiOperation("同步报价数据")
@PostMapping("/updateQuot")
public R<quotModel> updateQuot(quotModel quot)
public R<String> updateQuot(@RequestBody String quotJson)
{
System.out.println(quot.getQuotCode());
return R.ok(quot);
System.out.println(quotJson);
quotModel quot = JSON.parseObject(quotJson, quotModel.class);
System.out.println(quot);
if(StringUtils.isBlank(quot.getQuotJswCode())){
return R.fail("JswCode不能为空");
}
return R.ok();
}
}

View File

@ -0,0 +1,123 @@
package com.ruoyi.web.utils;
import java.util.ArrayList;
import java.util.List;
public class ListSplitUtil {
/**
* @param source
* @param n 每次分割的个数
* @return java.util.List<java.util.List < T>>
* @Title: 将list按照指定元素个数(n)分割
* @methodName: partList
* @Description: 若是指定元素个数(n)>list.size(),则返回list;这时候商:0余数:list.size()
* @author: 王延飞
* @date: 2018-07-18 21:13
*/
public static <T> List<List<T>> partList(List<T> source, int n) {
if (source == null) {
return null;
}
if (n == 0) {
return null;
}
List<List<T>> result = new ArrayList<List<T>>();
// 集合长度
int size = source.size();
// 余数
int remaider = size % n;
System.out.println("余数:" + remaider);
//
int number = size / n;
System.out.println("商:" + number);
for (int i = 0; i < number; i++) {
List<T> value = source.subList(i * n, (i + 1) * n);
result.add(value);
}
if (remaider > 0) {
List<T> subList = source.subList(size - remaider, size);
result.add(subList);
}
return result;
}
/**
* @Title: 将一个list均分红n个list,主要经过偏移量来实现的
* @methodName: averageList
* @param source
* @param n 等分个数
* @return java.util.List<java.util.List < T>>
* @Description:
*
* @author: 王延飞
* @date: 2018-07-18 21:15
*/
public static <T> List<List<T>> averageList(List<T> source,int n){
if (source == null) {
return null;
}
if (n == 0) {
return null;
}
List<List<T>> result = new ArrayList<List<T>>();
// 集合长度
int size = source.size();
// 余数
int remaider = size % n;
System.out.println("余数:" + remaider);
//
int number = size / n;
System.out.println("商:" + number);
int offset=0;//偏移量
for(int i=0;i<n;i++){
List<T> value=null;
if(remaider>0){
value=source.subList(i*number+offset, (i+1)*number+offset+1);
remaider--;
offset++;
}else{
value=source.subList(i*number+offset, (i+1)*number+offset);
}
result.add(value);
}
return result;
}
public static void main(String[] args) {
ArrayList<String> list = new ArrayList<>();
list.add("1");
list.add("2");
list.add("3");
list.add("4");
list.add("5");
list.add("6");
list.add("7");
list.add("8");
List<List<String>> lists = partList(list, 9);
System.out.println("【指定元素个数9等分】" + lists); // 指定元素个数9等分[[1, 2, 3, 4, 5, 6, 7, 8]]
List<List<String>> lists2 = partList(list, 2);
System.out.println("【指定元素个数2等分】" + lists2); // 指定元素个数2等分[[1, 2], [3, 4], [5, 6], [7, 8]]
List<List<String>> lists3 = partList(list, 3);
System.out.println("【指定元素个数3等分】" + lists3); // 指定元素个数3等分[[1, 2, 3], [4, 5, 6], [7, 8]]
List<List<String>> lists11 = averageList(list, 9);
System.out.println("【集合9等分】" + lists11); // 集合9等分[[1], [2], [3], [4], [5], [6], [7], [8], []]
List<List<String>> lists21 = averageList(list, 2);
System.out.println("【集合2等分】" + lists21); // 集合2等分[[1, 2, 3, 4], [5, 6, 7, 8]]
List<List<String>> lists31 = averageList(list, 3);
System.out.println("【集合3等分】" + lists31); // 集合3等分[[1, 2, 3], [4, 5, 6], [7, 8]]
}
}

View File

@ -108,6 +108,14 @@ public interface OARedBookMapper
*/
List<OAQuotProduct> queryRedBPriceByParams(@Param("params") List<OAQuotProduct> params);
/**
* 根据选择的调价日期 更新已选择结果数据
* @param name_0
* @param uid_0
* @return
*/
String getFixDatePrice(@Param("name_0") String name_0,@Param("spec") String spec,@Param("voltage") String voltage, @Param("uid_0") String uid_0);
/**
* 查询已生成的报价单列表
* @param oaQuot

View File

@ -101,6 +101,14 @@ public interface IRedBookService
*/
List<OAQuotProduct> queryRedBPriceByParams(List<OAQuotProduct> params);
/**
* 根据选择的调价日期 更新已选择结果数据
* @param name_0
* @param uid_0
* @return
*/
String getFixDatePrice(String name_0,String spec,String voltage,String uid_0);
/**
* 查询已生成的报价单列表
* @param oaQuot
@ -128,4 +136,5 @@ public interface IRedBookService
*/
String rb_price_version();
List<OAQuotProduct> setRedBookPrice(List<OAQuotProduct> list);
}

View File

@ -0,0 +1,26 @@
package com.ruoyi.redBook.service.impl;
import com.ruoyi.redBook.domain.OAQuotProduct;
import com.ruoyi.redBook.service.IRedBookService;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.AsyncResult;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import java.util.concurrent.Future;
@Service
public class AsyncRbTaskService {
@Resource
private IRedBookService iRedBookService;
@Async
public Future<List<OAQuotProduct>> executeAsyncTask(String threadname, List<OAQuotProduct> list) {
System.out.println(threadname);
List<OAQuotProduct> OAQuotProducts = iRedBookService.setRedBookPrice(list);
return new AsyncResult<>( OAQuotProducts);
}
}

View File

@ -1,6 +1,8 @@
package com.ruoyi.redBook.service.impl;
import com.ruoyi.common.annotation.DataScope;
import com.ruoyi.common.annotation.DataSource;
import com.ruoyi.common.enums.DataSourceType;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.uuid.UUID;
@ -186,6 +188,28 @@ public class RedBookServiceImpl implements IRedBookService
return oaRedBookMapper.queryRedBPriceByParams(params);
}
/**
* 根据选择的调价日期 更新已选择结果数据
* @param name_0
* @param uid_0
* @return
*/
@Override
public String getFixDatePrice(String name_0,String spec,String voltage, String uid_0) {
return oaRedBookMapper.getFixDatePrice(name_0,spec,voltage,uid_0);
}
@Override
@DataSource(DataSourceType.OAREDBOOK)
public List<OAQuotProduct> setRedBookPrice(List<OAQuotProduct> list) {
for(OAQuotProduct oAQuotProduct : list){
String price = oaRedBookMapper.getFixDatePrice(oAQuotProduct.getName_0(),oAQuotProduct.getSpec(),oAQuotProduct.getVoltage(),oAQuotProduct.getUid_0());
oAQuotProduct.setPrice(price);
}
return list;
}
/**
* 查询已生成的报价单列表
* @param oaQuot
@ -226,4 +250,5 @@ public class RedBookServiceImpl implements IRedBookService
public String rb_price_version() {
return oaRedBookMapper.rb_price_version();
}
}

View File

@ -165,6 +165,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND a.电压等级 = v.电压等级
</select>
<select id="getFixDatePrice" resultType="String">
select top 1 红本价格 from rb_product_price A
inner join [rb_productVersion] B on A.version_uid_0=B.uid_0
where A.[namevoltage] = #{name_0} and A.规格 = #{spec}
and A.电压等级 = #{voltage} and B.uid_0 = #{uid_0}
and (B.sta_0=1 or sta_0=0) order by B.uid_0 desc
</select>
<sql id="quotsJoins">
LEFT JOIN sys_user u on u.user_name=a.create_by

View File

@ -121,7 +121,7 @@
></el-switch>
</template>
</el-table-column>
<el-table-column label="打印人" align="center" prop="quotPrintUserName" width="150px"/>
<el-table-column label="打印人" align="center" prop="quotPrintUserName" width="150px" v-if="checkRole(['SALES_MAN'])"/>
<el-table-column label="业务员" align="center" prop="quotSalesmanName" width="150px"/>
<el-table-column label="客户名称" align="center" prop="quotCustomerName" width="250px"/>
<el-table-column label="项目名称" align="center" prop="quotProject" width="250px"/>
@ -1364,7 +1364,7 @@
import { NumberAdd } from '@/utils/number';//
import { changQuotPrintStatus,listQuot, getQuot, getReturnUpdateQuot, delQuot, addQuot, updateQuot, quotFileList, quotFileDelete, commitQuot, commitJsQuot, commitHjQuot, feedbackQuot, madeQuot, rejectQuot } from "@/api/quot/quot";
import { getToken } from "@/utils/auth";
import { checkPermi } from '@/utils/permission';//
import { checkPermi,checkRole } from '@/utils/permission';//
import { getDicts } from "@/api/system/dict/data";
/** 导入客户选择组件 */
@ -1630,9 +1630,12 @@ export default {
handleReturnUpdate(row) {
this.reset();
const quotId = row.quotId || this.ids
getReturnUpdateQuot(quotId).then(response => {
this.setInfo(response);
});
let self = this;
this.$modal.confirm('是否确认修订所选报价单且更新状态为协助中?').then(function() {
getReturnUpdateQuot(quotId).then(response => {
self.setInfo(response);
});
}).then(() => {}).catch(() => {});
},
/** 修改按钮操作-详细信息设置 */
@ -1737,7 +1740,7 @@ export default {
/** 报价组权限控制 */
checkPermi,
checkRole,
/** 报价组提交技术协助按钮 */
commitJsForm() {
this.form.quotMaterialList = this.quotMaterialList;
@ -1895,9 +1898,17 @@ export default {
//-
getQuotFkFileList(){
const param = {relationId:this.form.quotId,fileType:'quotFkFile'}
quotFileList(param).then(response => {
this.quotFkFileList = response.rows;
});
//
if(this.form.quotApprovalStatus!='1' && checkRole(['SALES_MAN'])){
quotFileList(param).then(response => {
this.quotFkFileList = response.rows;
});
}else if(checkRole(['QUOT'])){
quotFileList(param).then(response => {
this.quotFkFileList = response.rows;
});
}
},
//- ()
getQuotJsgfFileList(){

View File

@ -9,7 +9,7 @@
</el-col>
<el-col :span="14">
<el-button size="mini" icon="el-icon-refresh" @click="handleRefreshClick">刷新</el-button>
<el-button style="float: right;margin-left: 5px;" size="mini" type="success" icon="el-icon-document" @click="handleMadeQuotClick" :disabled="selectedResultData.length==0">生成报价单</el-button>
<el-button style="float: right;margin-left: 5px;" size="mini" type="success" icon="el-icon-document" @click="handleMadeQuotClick" :disabled="selectedResultData.length==0 || madeQuotDis">生成报价单</el-button>
<el-button style="float: right;" size="mini" type="warning" icon="el-icon-folder" @click="handleSaveClick" :disabled="selectedResultData.length==0">保存</el-button>
</el-col>
</el-row>
@ -140,7 +140,10 @@
</el-col>
</el-row>
</div>
<el-table v-loading="selectedResultLoading" width="100%;" :height="tableHeight" :row-class-name="selectedResultIndex" style="margin-top:5px" ref="selectedResultTable" :data="selectedResultData">
<!--
<p v-if="isColumn1ValuesEqual">存在与当前调价版本不一致的产品,请选择调价日期批量刷新</p>
-->
<el-table v-loading="selectedResultLoading" width="100%;" :height="tableHeight" :cell-style="cellStyle" :row-class-name="selectedResultIndex" style="margin-top:5px" ref="selectedResultTable" :data="selectedResultData">
<el-table-column label="" align="center" prop="index" width="50"/>
<el-table-column label="操作" align="center" width="60" class-name="small-padding fixed-width">
<template slot-scope="scope">
@ -229,6 +232,11 @@
color: red;
}
/* 表格行颜色CSS样式 */
.row-background-color {
background-color: red; /* 你想要的颜色 */
}
</style>
<script>
import {toDecimal, productList,versionList,productRemarkList,productXinghList,judgeparent,productZlList,productYsxhListCheck,productYsxhList,productJmListCheck,productJmList,searchData,handleSearchData,saveQuot, madeQuot,updateSelectedResultData} from "@/api/redBook/redBook";
@ -308,6 +316,8 @@
//
versionList: [], //
madeQuotDis: false, //
hasNotMatch: true //
}
},
created() {
@ -569,6 +579,13 @@
row.index = rowIndex + 1;
},
/** 已选结果数据里存在所选调价版本不一致的数据 */
cellStyle({ row }){
if(row.uid_0 != this.form.rbDateUid){
return {'background-color':'#ff494959'}
}
},
//
handleDeleteClick(index) {
this.selectedResultData.splice(index, 1)
@ -671,6 +688,11 @@
},
//
handleSaveClick() {
if(!this.isColumn1ValuesEqual){
this.$modal.msgError("存在与当前调价版本不一致的产品,请选择调价日期批量刷新");
return;
}
const allPrice = this.selectedResultData.reduce((sum, row) => sum + parseFloat(row.allPrice), 0);
this.form.totalPrice = toDecimal(allPrice);
this.form.selectedResultData = this.selectedResultData;
@ -680,6 +702,12 @@
},
//
handleMadeQuotClick() {
if(!this.isColumn1ValuesEqual){
this.$modal.msgError("存在与当前调价版本不一致的产品,请选择调价日期批量刷新");
return;
}
this.form.selectedResultData = this.selectedResultData;
madeQuot(this.form).then(response => {
this.$modal.msgSuccess("生成报价单成功");
@ -711,14 +739,17 @@
});
},
//
selectRbDate(uid){
async selectRbDate(uid) {
this.selectedResultData.forEach((row, index) => {
this.$set(this.selectedResultData, index, {
...row,
uid_0: uid // uid
});
});
this.madeQuotDis = true;
this.selectedResultLoading = true;
//-
updateSelectedResultData(this.selectedResultData).then(response => {
for (let i = 0; i < this.selectedResultData.length; i++) {
@ -729,7 +760,7 @@
this.selectedResultData[i].spec === response.data[j].spec &&
this.selectedResultData[i].voltage === response.data[j].voltage
) {
this.selectedResultData[i].price = response.data[j].setPrice;
this.selectedResultData[i].price = response.data[j].price;
const setPrice = toDecimal(this.selectedResultData[i].price * (this.selectedResultData[i].per?this.selectedResultData[i].per:1) * (this.selectedResultData[i].per2?this.selectedResultData[i].per2:1));
const allPrice = toDecimal(this.selectedResultData[i].count * this.selectedResultData[i].price * (this.selectedResultData[i].per?this.selectedResultData[i].per:1) * (this.selectedResultData[i].per2?this.selectedResultData[i].per2:1));
@ -738,6 +769,7 @@
}
}
}
this.madeQuotDis = false;
this.selectedResultLoading = false;
});
},
@ -780,6 +812,15 @@
const endIndex = startIndex + this.selectedResultPageSize;
return this.selectedResultData.slice(startIndex, endIndex);
},*/
//
isColumn1ValuesEqual() {
if(this.selectedResultData.length > 0){
const uid_0 = this.selectedResultData[0].uid_0;//uid
return this.selectedResultData.every(row => row.uid_0 === uid_0);
}else{
return false;
}
},
//
sumSelectedResultData() {

View File

@ -113,7 +113,7 @@
:value="item.value"
@click.native="selectRbDate(item.value)"/>
</el-select>
<el-button style="float: right;margin-left: 5px;" size="small" type="success" icon="el-icon-document" @click="handleMadeQuotClick" :disabled="selectedResultData.length==0">生成报价单</el-button>
<el-button style="float: right;margin-left: 5px;" size="small" type="success" icon="el-icon-document" @click="handleMadeQuotClick" :disabled="selectedResultData.length==0 || madeQuotDis">生成报价单</el-button>
<el-button style="float: right;" size="small" type="warning" icon="el-icon-folder" @click="handleSaveOtherClick" v-if="this.form.quotApprovalStatus==0" :disabled="selectedResultData.length==0">另存为</el-button>
<el-button style="float: right;" size="small" type="warning" icon="el-icon-folder" @click="handleSaveClick" v-if="this.form.quotApprovalStatus==0" :disabled="selectedResultData.length==0">保存</el-button>
</el-form-item>
@ -203,6 +203,8 @@
dateRange: [],
//
versionList: [], //
madeQuotDis: false, //
//
queryParams: {
pageNum: 1,
@ -352,6 +354,8 @@
uid_0: uid // uid
});
});
this.madeQuotDis = true;
this.selectedResultLoading = true;
//-
updateSelectedResultData(this.selectedResultData).then(response => {
@ -363,7 +367,7 @@
this.selectedResultData[i].spec === response.data[j].spec &&
this.selectedResultData[i].voltage === response.data[j].voltage
) {
this.selectedResultData[i].price = response.data[j].setPrice;
this.selectedResultData[i].price = response.data[j].price;
const setPrice = toDecimal(this.selectedResultData[i].price * (this.selectedResultData[i].per?this.selectedResultData[i].per:1) * (this.selectedResultData[i].per2?this.selectedResultData[i].per2:1));
const allPrice = toDecimal(this.selectedResultData[i].count * this.selectedResultData[i].price * (this.selectedResultData[i].per?this.selectedResultData[i].per:1) * (this.selectedResultData[i].per2?this.selectedResultData[i].per2:1));
@ -372,6 +376,7 @@
}
}
}
this.madeQuotDis = false;
this.selectedResultLoading = false;
});
},