Commit b0a529c2 authored by wanghang's avatar wanghang

Merge remote-tracking branch 'origin/dev' into dev

parents 0c784c8f cfc39d86
......@@ -27,11 +27,7 @@
<td class="left">${task.handlerName?html}</td><#rt/>
<#if taskHandledDate?default(true)>
<td class="title">办理时间&nbsp;:</td><#rt/>
<#if task.procUnitName=='用款申请审批'>
<td class="left">${task.handledDate?string("yyyy-MM-dd")}</td><#rt/>
<#else >
<td class="left">${task.handledDate?html}</td><#rt/>
</#if>
<td class="left">${task.handledDate?html}</td><#rt/>
<#else>
<td style="border-right:0px;">&nbsp;</td><#rt/>
<td>&nbsp;</td><#rt/>
......
......@@ -31,16 +31,12 @@ function loadCodeRuleListGrid() {
{ display: "品牌名称", name: "brandName", width: 100, minWidth: 60, type: "string", align: "left" },
{ display: "产品类型", name: "prodcutType", width: 140, minWidth: 60, type: "datetime", align: "left" }
],
dataAction: "server",
dataType: "server",
url: web_app.name + '/product/findProduct.ajax',
parms: {
page: 0,
size: 30
},
pageSize: 20,
usePager: true,
toolbar: toolbarOptions,
width: "100%",
width: "50%",
height: "100%",
heightDiff: -8,
checkbox: true,
......@@ -53,6 +49,11 @@ function loadCodeRuleListGrid() {
UICtrl.setSearchAreaToggle(gridManager);
}
// parms: {
// page: 0,
// size: 30
// },
function updateHandler(data) {
var id = data.productId;
if (!id) {
......
$(document).ready(function() {
initializeUI();
initializeToobarContainer();
$('#pageTab').tab();
initializateSelectC();
loadDataTest();
});
function initializateSelectC() {
......@@ -12,6 +16,15 @@ function initializateSelectC() {
});
}
function initializeUI() {
UICtrl.layout("#layout",{
leftWidth:6,
rightWidth:6,
allowRightCollapse: false,
allowRightResize: false
});
}
function loadDataTest() {
console.log("loadData")
......@@ -20,17 +33,66 @@ function loadDataTest() {
Public.ajax(web_app.name + "/product/loadProductDetail.ajax", {
productId: paramsData.productId
}, function (data) {
debugger;
var selectedCategory = data.selectedCategory;
$("#selectedCategory").ligerComboBox({
textField: 'productCategoryName',
valueField: 'productCategoryId',
columns: [
{ header: 'ID', name: 'productCategoryId', width: 20 },
{ header: '名字', name: 'productCategoryName' }
],
data: selectedCategory,
selectBoxWidth: 200
});
$('#submitForm').formSet(data);
var fronData = {};
fronData.Rows = data.fronColors;
faceGrid("#frontFaceGrid", fronData);
fronData.Rows = data.backColors;
faceGrid("#backFaceGrid", fronData);
});
}
function faceGrid(elId, data) {
var toolbarOptions = UICtrl.getDefaultToolbarOptions({
updateHandler: function(){
updateHandler();
},
aaHandler: { id: 'ccAA', text: 'Hello', img: 'fa-music', className: 'btn-gray',
click: function () {
alert('hello~!');
}
}
});
debugger;
var gridManager = UICtrl.grid(elId, {
columns: [
{ display: "颜色名称", name: "productFaceColorId", width: 140, minWidth: 60, type: "string", align: "left" },
{ display: "油墨覆盖率(%)", name: "coverageRate", width: 120, minWidth: 60, type: "string", align: "left" }
],
toolbar: toolbarOptions,
dataType: "local",
data: data, // data 数据结构 data: ("Rows": [ {}, {} ])
usePager: false,
width: "100%",
height: 150,
onDblClickRow : function(data, rowindex, rowobj) {
updateHandler(data);
}
});
}
function initializeToobarContainer(){
$('#toolBarCenter').attr('position','bottom');
//dropup==true 更多按钮向上展示
$('#toolBar').data('dropup',true).removeClass('job-button-fixed-top').addClass('job-button-fixed-bottom');
UICtrl.layout($("#jobPageLayout"), {heightDiff:-2,topHeight:40,bottomHeight:40,onSizeChanged:function(){
}});
}
// checkbox: true,
// enabledSort: false,
// autoAddRowByKeydown:false,
// heightDiff: -10,
// fixedCellHeight: true,
// selectRowButtonOnly: true,
// var selectedCategory = data.selectedCategory;
// $("#selectedCategory").ligerComboBox({
// textField: 'productCategoryName',
// valueField: 'productCategoryId',
// columns: [
// { header: 'ID', name: 'productCategoryId', width: 20 },
// { header: '名字', name: 'productCategoryName' }
// ],
// data: selectedCategory,
// selectBoxWidth: 200
// });
\ No newline at end of file
......@@ -10,39 +10,86 @@
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<head>
<x:base include="layout,dialog,grid,tree,combox,commonTree" />
<x:script src='/javaScript/common.js'/>
<x:script src='/lib/jquery/jquery.contextmenu.js'/>
<x:script src='/system/bpm/BpmUtil.js'/>
<x:script src='/biz/topsun/product/productDetail.js'/>
</head>
<form class="hg-form" method="post" action="" id="submitForm">
<x:hidden name="productDetailId" />
<x:hidden name="productId"/>
<body>
<div class="container-fluid" style="position: relative; display: inline-flex; flex-direction: column; height: 97%;
background-color: #f3f3f4 !important;" >
<%-- style="position: relative; display: inline-flex; flex-direction: column;"--%>
<%-- <x:hidden name="productDetailId" />--%>
<%-- <x:hidden name="productId"/>--%>
<div class="hg-form-cols">
<div labelCol="15"> </div>
</div>
<div class="hg-form-row">
<x:title title="基本属性" name="group" hideTable="#info" />
<x:inputC name="productId" required="true" label="产品编码" labelCol="2" maxLength="64" fieldCol="4" />
<x:inputC name="productName" required="true" label="产品名称" labelCol="2" maxLength="64" fieldCol="4" />
<x:selectC name="productCategoryId" required="false" label="产品类别ID" id="selectedCategory" labelCol="2"/>
<%-- <x:inputC name="productCategoryId" required="true" label="产品类别ID" wrapper="select" labelCol="2" maxLength="64"--%>
<%-- fieldCol="4" />--%>
<x:inputC name="productUnit" required="false" label="单位" labelCol="2" maxLength="32" fieldCol="4" />
<x:inputC name="productSampleCode" required="false" label="样品编号" labelCol="2" maxLength="32" fieldCol="4" />
<x:inputC name="brandName" required="false" label="品牌名称" labelCol="2" maxLength="32" fieldCol="4" />
<x:title title="" name="group" hideTable="#info" />
</div>
<%-- <div class="hg-form-cols">--%>
<%-- <div labelCol="15"> </div>--%>
<%-- </div>--%>
<%-- style="overflow: 98vh;"--%>
<form class="hg-form" method="post" action="" id="submitForm">
<div class="hg-form-row">
<x:title title="基本属性" name="group" hideTable="#info" />
<x:inputC name="productId" required="true" label="产品编码" labelCol="2" maxLength="64" fieldCol="4" />
<x:inputC name="productName" required="true" label="产品名称" labelCol="2" maxLength="64" fieldCol="4" />
<x:selectC name="productCategoryId" required="false" label="产品类别ID" id="selectedCategory" labelCol="2"/>
<%-- <x:inputC name="productCategoryId" required="true" label="产品类别ID" wrapper="select" labelCol="2" maxLength="64"--%>
<%-- fieldCol="4" />--%>
<x:inputC name="productUnit" required="false" label="单位" labelCol="2" maxLength="32" fieldCol="4" />
<x:inputC name="productSampleCode" required="false" label="样品编号" labelCol="2" maxLength="32" fieldCol="4" />
<x:inputC name="brandName" required="false" label="品牌名称" labelCol="2" maxLength="32" fieldCol="4" />
</div>
<div id='pageTab' style="margin: 0px;">
<div class="ui-tab-links">
<ul id="menu_ul">
<li id="detailForm" divid="detailFormDiv">可选属性</li>
<li id="lossForm" divid="lossFormDiv">客户loss</li>
<li id="materialList" divid="materialListDiv">物料组成</li>
</ul>
</div>
<div class="ui-tab-content" style="padding: 2px; padding-right: 0;">
<div class="layout" id='detailFormDiv'>
<x:inputC name="factoryName" required="true" label="制造工厂" labelCol="2" maxLength="64" fieldCol="4" />
<x:inputC name="customerName" required="true" label="客户名称" labelCol="2" maxLength="64" fieldCol="4" />
<x:title title="外观描述" name="group" hideTable="#info" />
<x:inputC name="productLength" required="true" label="长度" labelCol="2" maxLength="64" fieldCol="4" />
<x:inputC name="productWidth" required="true" label="宽度" labelCol="2" maxLength="64" fieldCol="4" />
<x:title title="排版参数" name="group" hideTable="#info" />
<x:inputC name="modulus" required="true" label="模数" labelCol="2" maxLength="64" fieldCol="4" />
<x:inputC name="row_num" required="true" label="行数" labelCol="2" maxLength="64" fieldCol="4" />
<div id="layout" style="height: 280px; display: contents;">
<div position="left" title="正面颜色" >
<div id="frontFaceGrid" style="margin: 2px;"></div>
</div>
<div position="right" title="反面颜色">
<div id="backFaceGrid" style="margin: 2px;"></div>
</div>
</div>
<x:title title="产品材质" name="group" hideTable="#info" />
<form2>
</div>
<div class="layout" id='lossFormDiv'>
</div>
<div class="layout" id='materialListDiv'>
</div>
</div>
</div>
</form>
</form2>
<form3>
</form3>
<div class="blank_div clearfix"></div>
<x:title title="工序设置" name="group" hideTable="#info" />
<div id="processListGrid" style="margin: 2px;"></div>
</form>
<div id="toolBarCenter" class="footer" style="background: none repeat scroll 0 0 #fff; border-top: 1px solid #e7eaec;
position: absolute; bottom: 0; width: 100%; display:flex; justify-content:center;">
<%-- style=""--%>
<div id='toolBar' checkAccess="false">
<a> aaa </a>
</div>
</div>
</div>
</body>
</html>
......@@ -15,11 +15,14 @@ function initializateUI() {
function initializateBomGrid() {
var toolbarOptions = UICtrl.getDefaultToolbarOptions({
addHandler: function(){
UICtrl.addGridRow(bomGridManager);
UICtrl.addGridRow(bomGridManager,{ sequence: bomGridManager.getData().length + 1 });
},
});
bomGridManager = UICtrl.grid("#bomGrid", {
columns: [
{display: "序号", name: "sequence", width: 80, minWidth: 60, type: "string", align: "left",
editor: { type: 'spinner', min: 1, max: 100, mask: 'nnn'}
},
{
display: "产品编码", name: "productCode", width: 140, minWidth: 60, type: "string", align: "left",
editor: {
......@@ -39,15 +42,15 @@ function initializateBomGrid() {
},
{display: "产品名称", name: "productName", width: 120, minWidth: 60, type: "string", align: "left"},
{display: "单位", name: "productUnit", width: 120, minWidth: 60, type: "string", align: "left"},
{
/*{
display: "币别", name: "currency", width: 140, minWidth: 60, type: "string", align: "left",
editor: {
required: true,
type: 'text'
}
},
},*/
{
display: "单价", name: "price", width: 120, minWidth: 60, type: "string", align: "left",
display: "用量", name: "price", width: 120, minWidth: 60, type: "string", align: "left",
editor: {
required: true,
type: 'text',
......
......@@ -8,7 +8,7 @@
</head>
<body>
<div class="container-fluid">
<x:billTitle title="报价需求单" needStatus="false" needPerson="true"/>
<x:billTitle title="报价申请单" needStatus="false" needPerson="true"/>
<div class="blank_div clearfix"></div>
<form class="hg-form" method="post" action="" id="submitForm">
<x:hidden name="id" id="quotationId"/>
......@@ -30,6 +30,9 @@
<x:inputC name="quotationNo" label="报价单号" readonly="true" maxLength="32" labelCol="1" fieldCol="2"/>
<x:inputC name="customerManagerId" label="客户名称" labelCol="1" fieldCol="2"/>
</div>
<div class="hg-form-row">
<x:textareaC rows="3" name="quotationRemark" label="备注" labelCol="1" fieldCol="8"/>
</div>
</div>
<x:title title="BOM信息" name="group" hideTable="#info" />
<div id="bomGrid" style="margin: 2px;"></div>
......
......@@ -15,6 +15,9 @@ function loadQuotationListGrid() {
addHandler: function () {
addHandler();
},
printHandler :function(){
printHandler();
}
/*updateHandler: function(){
updateHandler();
},
......@@ -55,7 +58,7 @@ function loadQuotationListGrid() {
fixedCellHeight: true,
selectRowButtonOnly: true,
onDblClickRow: function (data, rowindex, rowobj) {
updateHandler(data);
viewHandler(data);
}
});
UICtrl.setSearchAreaToggle(gridManager);
......@@ -69,6 +72,26 @@ function addHandler(){
});
}
function viewHandler(data){
UICtrl.addTabItem({
tabid: 'addQuotation' + data.quotationId,
text: "查看报价需求单",
url: web_app.name + '/quotation/showQuotation.job?bizId='+data.quotationId
});
}
function printHandler(){
var row = DataUtil.getUpdateRow(gridManager);
if (!row) {
return;
}
if (row.status != 3){
Public.tip("请审批完成再打印!");
return;
}
Public.openPostWindow(web_app.name+'/quotation/print.load',{quotationId :row.quotationId});
}
function query(obj) {
var param = $(obj).formToJSON();
UICtrl.gridSearch(gridManager, param);
......
......@@ -174,26 +174,17 @@ function bindEvent() {
function getTechnologyDetail(processAction) {
//采购订单保存时数据不进行必填验证,提交时数据才进行必填验证
var op = {};
var check = true;
var processList = [];
if (processAction == "save") {
op = {check: false};
} else if (processAction == "submit") {
op = {check: true};
} else {
op = {check: true};
check = false;
}
op = {check: check};
var technology = $('#submitForm').formToJSON(op);
if (!technology) {
return false;
}
var processList = [];
if (processAction == "save") {
processList = DataUtil.getGridData({gridManager: processGridManager, isAllData: true, onCheck: false})
} else if (processAction == "submit") {
processList = DataUtil.getGridData({gridManager: processGridManager, isAllData: true, onCheck: true})
} else {
processList = DataUtil.getGridData({gridManager: processGridManager, isAllData: true, onCheck: true})
}
processList = DataUtil.getGridData({gridManager: processGridManager, isAllData: true, onCheck: check})
if (!processList) {
return false;
}
......
......@@ -19,7 +19,7 @@
<td>&nbsp;</td>
</tr>
<tr>
<td>请您登录<a href="https://ssrfpm.ssrf.ac.cn:8080/SSRF/Login.jsp" style="text-decoration: none;">上海光源项目管理系统</a>进行批阅查看。<b>此邮件由系统自动发出,请勿直接回复本邮件。</b></td>
<#--<td>请您登录<a href="https://ssrfpm.ssrf.ac.cn:8080/SSRF/Login.jsp" style="text-decoration: none;">BPM流程管理系统</a>进行批阅查看。<b>此邮件由系统自动发出,请勿直接回复本邮件。</b></td>-->
</tr>
</table>
</div>
......
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title> 工厂报价单</title>
<#include "/print/commonStyleTemplate.ftl" />
<style type="text/css">
td {
font-size: 13px;
}
</style>
</head>
<body>
<div class="billTitle"> ${companyName?default("")?html}</div>
<div style="text-align: center">${companyName?default("")?html}</div>
<div style="text-align: center">${address?default("")?html}</div>
<div style="text-align: center">tel:${tel?default("")?html} fax: ${fax?default("")?html}</div>
<div style="text-align: center">email: ${email?default("")?html}</div>
<div style="text-align: center">————————————————————————————</div>
<div class="billTitle"> 报价单</div>
<table cellspacing="0px" cellpadding="0px" class="tablePrint">
<colgroup>
<col width='50%'/>
<col width="50%"/>
</colgroup>
<tr>
<td class="left">客户名称:${customerManagerId?default("")?html}</td>
<td class="right">报价单号:${quotationNo?default("")?html}</td>
</tr>
</table>
<table cellspacing="0px" cellpadding="0px" class="tablePrint">
<colgroup>
<col width='50%'/>
<col width="50%"/>
</colgroup>
<tr>
<td class="left">联系人:${personMemberName?default("")?html}</td>
<td class="right">报价日期:${fillinDate?default("")?html}</td>
</tr>
</table>
<table cellspacing="0px" cellpadding="0px" class="tableBorder">
<colgroup>
<col width='10%'/>
<col width='20%'/>
<col width='40%'/>
<col width='5%'/>
<col width='10%'/>
<col width='6%'/>
<col width='9%'/>
</colgroup>
<tr>
<td class="center">序号</td>
<td class="center">产品名称</td>
<td class="center">产品名称及规格</td>
<td class="center">单位</td>
<td class="center">币别</td>
<td class="center">单价</td>
<td class="center">备注</td>
</tr>
<#if gridData?? && gridData?size gt 0>
<#list gridData as detail>
<tr>
<td class="center">${detail.sequence?default("")?html}</td>
<td class="center">${detail.productCode?default("")?html}</td>
<td class="center">${detail.productName?default("")?html}</td>
<td class="center">${detail.productUnit?default("")?html}</td>
<td class="center">${detail.currency?default("")?html}</td>
<td class="center">${detail.price?default("")?html}</td>
<td class="center">${detail.remark?default("")?html}</td>
</tr>
</#list>
<#else>
<tr>
<td class="center">&nbsp;</td>
<td class="center">&nbsp;</td>
<td class="center">&nbsp;</td>
<td class="center">&nbsp;</td>
<td class="center">&nbsp;</td>
<td class="center">&nbsp;</td>
<td class="center">&nbsp;</td>
</tr>
</#if>
<tr style="height: 70px">
<td class="center">备注</td>
<td class="left" colspan="7">${quotationRemark?default("")?html}</td>
</tr>
<tr style="height: 70px">
<td class="left" colspan="7">${quotationNote?default("")?html}</td>
</tr>
</table>
<div class="blank_div"></div>
<div class="fontBold">审批明细</div>
<#include "/print/taskExecutionPrint.ftl" />
</body>
</html>
......@@ -7,8 +7,6 @@ import com.huigou.topsun.product.domain.*;
import com.huigou.topsun.product.repository.*;
import lombok.RequiredArgsConstructor;
import org.apache.commons.beanutils.BeanUtils;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.stereotype.Service;
import java.lang.reflect.Field;
......@@ -24,7 +22,7 @@ import java.util.stream.Collectors;
* @createDate 2023-11-22 10:24:31
*/
@Service
@RequiredArgsConstructor//通过构造方法注入 ProductApplication(Class a) { this.a = a; }
@RequiredArgsConstructor //通过构造方法注入 ProductApplication(Class a) { this.a = a; }
public class ProductApplicationImpl implements ProductApplication {
private final ProductRepository productRepository;
......@@ -85,14 +83,14 @@ public class ProductApplicationImpl implements ProductApplication {
// --------------------------------- 详情查询 ---------------------------------
String strProductId = Long.toString(productId);
ProductTypesetConf typesetConf = typesetConfRepository.findByProductId(strProductId);
ProductLooked looked = lookedRepository.findByProductId(strProductId);
ProductPublishedConf publishedConf = publishedConfRepository.findByProductId(strProductId);
ProductLoss loss = lossRepository.findByProductId(strProductId);
ArrayList<ProductMaterial> material = (ArrayList<ProductMaterial>) materialRepository.findByProductId(strProductId);
resultMap.put("typesetConf", typesetConf);
resultMap.put("looked", looked);
resultMap.put("publishedConf", publishedConf);
ArrayList<ProductLoss> loss = (ArrayList<ProductLoss>) lossRepository.findByProductId(strProductId);
Set<Object> entitys = new HashSet<>();
entitys.add(typesetConfRepository.findByProductId(strProductId));
entitys.add(lookedRepository.findByProductId(strProductId));
entitys.add(publishedConfRepository.findByProductId(strProductId));
resultMap.putAll(assembleResultOfForm(entitys));
resultMap.put("loss", loss);
resultMap.put("material", material);
......@@ -100,15 +98,23 @@ public class ProductApplicationImpl implements ProductApplication {
if(productDetail != null) {
if(productDetail.getBackProductFaceId() != null) {
ProductFace frontFace = faceRepository.findByProductFaceIdEquals(productDetail.getBackProductFaceId());
ProductFaceColor fronColor = faceColorRepository.findByProductFaceIdEquals(productDetail.getBackProductFaceId());
ArrayList <ProductFaceColor> fronColors =
(ArrayList<ProductFaceColor>) faceColorRepository.findByProductFaceId(productDetail.getBackProductFaceId());
resultMap.put("frontFace", frontFace);
resultMap.put("fronColor", fronColor);
resultMap.put("fronColors", fronColors == null ? new ArrayList<>() : fronColors);
} else {
ProductFaceColor fc = new ProductFaceColor();
fc.setProductFaceColorId("111");
ArrayList fronColors = new ArrayList<>();
fronColors.add(fc);
resultMap.put("fronColors", fronColors);
}
if(productDetail.getBackProductFaceId() != null) {
ProductFace backFace = faceRepository.findByProductFaceIdEquals(productDetail.getBackProductFaceId());
ProductFaceColor backColor = faceColorRepository.findByProductFaceIdEquals(productDetail.getBackProductFaceId());
ArrayList <ProductFaceColor> backColors =
(ArrayList<ProductFaceColor>) faceColorRepository.findByProductFaceId(productDetail.getBackProductFaceId());
resultMap.put("backFace", backFace);
resultMap.put("backColor", backColor);
resultMap.put("backColors", backColors == null ? new ArrayList<>() : backColors);
}
}
ObjectMapper mapper = new ObjectMapper();
......@@ -124,6 +130,26 @@ public class ProductApplicationImpl implements ProductApplication {
return resultMap;
}
/**
* description 返回页面 Form 所需的数据格式
* @param entitys 所有相关的 实体 (如果需要 update,保留这些实体。提交时候用于比较更新值。)
* @return java.util.HashMap<java.lang.String, java.lang.Object>
* @author qinzhenguan
* @create: 2023/12/5 14:09
*/
public Map<String, Object> assembleResultOfForm(Set<Object> entitys) {
Map<String, Object> map = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
map.put("entitys", entitys);
for(Object item : entitys) {
if(item == null) {
continue;
}
map.putAll(mapper.convertValue(item, Map.class));
}
return map;
}
/**
* description
* @param clazz Bean
......@@ -136,7 +162,7 @@ public class ProductApplicationImpl implements ProductApplication {
*/
public Map<Object, Object> convertToMap(Class<?> clazz, String displayProperty, String valueProperty,
List<?> list) {
Set<String> set = new HashSet();
Set<String> set = new HashSet<>();
set.add(displayProperty);
set.add(valueProperty);
if(checkClassesAndProperties(clazz, set, list.size())) {
......
......@@ -57,7 +57,6 @@ public class ProductController extends CommonController {
SDO sdo = this.getSDO();
String productId = sdo.getString("id");
Map<String, Object> map = productService.queryDetailAll(Integer.parseInt(productId));
return toResult(map);
}
......@@ -81,12 +80,6 @@ public class ProductController extends CommonController {
} catch (JsonProcessingException e) {
throw new RuntimeException(e);
}
String productId= param.get("productId")+"";
Map<String, Object> resultMap = productService.queryDetailAll(Integer.parseInt(productId));
if(resultMap.get("detail") != null) {
resultMap.putAll(mapper.convertValue(resultMap.get("detail"), Map.class));
}
return forward("productDetail", param);
}
......@@ -95,9 +88,6 @@ public class ProductController extends CommonController {
SDO sdo = this.getSDO();
String productId = sdo.getString("productId");
Map<String, Object> resultMap = productService.queryDetailAll(Integer.parseInt(productId));
if(resultMap.get("detail") != null) {
resultMap.putAll(mapper.convertValue(resultMap.get("detail"), Map.class));
}
return toResult(resultMap);
}
......
package com.huigou.topsun.product.domain;
import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import lombok.Data;
import org.hibernate.annotations.GenericGenerator;
/**
* 尺码组主表
* @TableName size_group
*/
@Table(name="size_group")
@Data
public class SizeGroup implements Serializable {
/**
* 尺码组id
*/
@Id
@GeneratedValue(generator = "system-uuid")
@GenericGenerator(name = "system-uuid", strategy = "guid")
@Column(name = "size_group_id")
private String sizeGroupId;
/**
* 尺码组名称
*/
@Column(name = "size_group_name")
private String sizeGroupName;
/**
* 尺码组编码
*/
@Column(name = "size_group_code")
private String sizeGroupCode;
/**
* 尺码组类型
*/
@Column(name = "size_group_type")
private String sizeGroupType;
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
......@@ -3,5 +3,8 @@ package com.huigou.topsun.product.repository;
import com.huigou.topsun.product.domain.Brand;
import org.springframework.data.jpa.repository.JpaRepository;
import java.util.List;
public interface BrandRepository extends JpaRepository<Brand, String> {
List<Brand> findByBrandName(String brandName);
}
......@@ -3,11 +3,13 @@ package com.huigou.topsun.product.repository;
import com.huigou.topsun.product.domain.ProductFaceColor;
import org.springframework.data.jpa.repository.JpaRepository;
import java.util.List;
/**
* @Auther: xin.lu
* @author xin.lu
* @Date: 2023/11/22/10:41
* @Description:
*/
public interface ProductFaceColorRepository extends JpaRepository<ProductFaceColor,String> {
ProductFaceColor findByProductFaceIdEquals(String productFaceId);
List<ProductFaceColor> findByProductFaceId(String productFaceId);
}
......@@ -3,11 +3,14 @@ package com.huigou.topsun.product.repository;
import com.huigou.topsun.product.domain.ProductLoss;
import org.springframework.data.jpa.repository.JpaRepository;
import java.util.List;
/**
* @Auther: xin.lu
* @Date: 2023/11/22/10:42
* @Description:
*/
public interface ProductLossRepository extends JpaRepository<ProductLoss,String> {
ProductLoss findByProductId(String productId);
List<ProductLoss> findByProductId(String productId);
}
......@@ -21,4 +21,6 @@ public interface QuotationApplication {
Quotation saveQuotation(Quotation quotation);
Map<String,Object> slicedQuotationList(QuotationQueryRequest queryRequest);
Map<String, Object> loadPrintData(String quotationId);
}
package com.huigou.topsun.quotation.application.impl;
import cn.hutool.core.bean.BeanUtil;
import com.huigou.cache.SystemCache;
import com.huigou.data.query.model.QueryDescriptor;
import com.huigou.topsun.product.domain.Product;
import com.huigou.topsun.product.repository.ProductRepository;
import com.huigou.topsun.quotation.application.QuotationItemApplication;
import com.huigou.topsun.quotation.domain.model.Quotation;
import com.huigou.topsun.quotation.application.QuotationApplication;
import com.huigou.topsun.quotation.domain.model.QuotationItem;
import com.huigou.topsun.quotation.domain.query.QuotationQueryRequest;
import com.huigou.topsun.quotation.repository.QuotationRepository;
import com.huigou.topsun.quotation.vo.QuotationItemVo;
import com.huigou.uasp.bmp.common.BizBillStatus;
import com.huigou.uasp.bpm.FlowBroker;
import com.huigou.util.ClassHelper;
......@@ -17,6 +22,9 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import static org.activiti.engine.impl.util.CollectionUtil.map;
/**
* @author 16508
......@@ -29,6 +37,8 @@ public class QuotationApplicationImpl extends FlowBroker implements QuotationApp
private QuotationRepository quotationRepository;
@Resource
private QuotationItemApplication quotationItemApplication;
@Resource
private ProductRepository productRepository;
@Override
protected String saveBizAndApprovalData() {
......@@ -106,6 +116,69 @@ public class QuotationApplicationImpl extends FlowBroker implements QuotationApp
QueryDescriptor queryDescriptor = this.sqlExecutorDao.getQuery(QUERY_XML_FILE_PATH, "slicedQuotationList");
return this.sqlExecutorDao.executeSlicedQuery(queryDescriptor,queryRequest);
}
@Override
public Map<String, Object> loadPrintData(String quotationId) {
Quotation quotation = quotationRepository.findOne(quotationId);
Map<String, Object> map = ClassHelper.beanToMap(quotation);
List<QuotationItem> itemList = quotationItemApplication.findQuotationItemByQuotationId(quotationId);
List<QuotationItemVo> quotationItemVoList = itemList
.stream()
.map(quotationItem -> {
QuotationItemVo quotationItemVo = new QuotationItemVo();
BeanUtil.copyProperties(quotationItem, quotationItemVo);
Product product = productRepository.findOne(quotationItem.getProductId());
quotationItemVo.setProductCode(product.getProductSampleCode());
quotationItemVo.setProductName(product.getProductName());
quotationItemVo.setProductUnit(product.getProductUnit());
return quotationItemVo;
})
.collect(Collectors.toList());
map.put("gridData",quotationItemVoList);
String templateUrl = "";
if ("factory".equals(quotation.getQuotationType())){//工厂客户
templateUrl = "/print/topsun/factoryQuotation.ftl";
getBSNFactoryMessage(map);
}else {//品牌客户
templateUrl = "/print/topsun/brandQuotation.ftl";
getBSNBrandMessage(map);
}
map.put("url",templateUrl);
return map;
}
public Map<String,Object> getBSNFactoryMessage(Map<String,Object> map){
String companyName = SystemCache.getParameter("bsn.factory.companyName", String.class);
String companyNameEn = SystemCache.getParameter("bsn.factory.companyName.en", String.class);
String address = SystemCache.getParameter("bsn.factory.address", String.class);
String email = SystemCache.getParameter("bsn.factory.email", String.class);
String fax = SystemCache.getParameter("bsn.factory.fax", String.class);
String tel = SystemCache.getParameter("bsn.factory.tel", String.class);
map.put("companyName",companyName);
map.put("companyNameEn",companyNameEn);
map.put("address",address);
map.put("email",email);
map.put("fax",fax);
map.put("tel",tel);
return map;
}
public Map<String,Object> getBSNBrandMessage(Map<String,Object> map){
String companyName = SystemCache.getParameter("bsn.brand.companyName", String.class);
String companyNameEn = SystemCache.getParameter("bsn.brand.companyName.en", String.class);
String address = SystemCache.getParameter("bsn.brand.address", String.class);
String email = SystemCache.getParameter("bsn.brand.email", String.class);
String fax = SystemCache.getParameter("bsn.brand.fax", String.class);
String tel = SystemCache.getParameter("bsn.brand.tel", String.class);
map.put("companyName",companyName);
map.put("companyNameEn",companyNameEn);
map.put("address",address);
map.put("email",email);
map.put("fax",fax);
map.put("tel",tel);
return map;
}
}
......
......@@ -2,8 +2,6 @@ package com.huigou.topsun.quotation.controller;
import com.huigou.context.Operator;
import com.huigou.context.OrgUnit;
import com.huigou.topsun.proofing.application.ProofingApplyApplication;
import com.huigou.topsun.proofing.domain.model.ProofingApply;
import com.huigou.topsun.quotation.application.QuotationApplication;
import com.huigou.topsun.quotation.domain.model.Quotation;
import com.huigou.topsun.quotation.domain.query.QuotationQueryRequest;
......@@ -14,6 +12,7 @@ import com.huigou.util.SDO;
import org.springframework.stereotype.Controller;
import javax.annotation.Resource;
import java.util.Map;
/**
* @Auther: xin.lu
......@@ -58,4 +57,11 @@ public class QuotationController extends CommonController {
QuotationQueryRequest queryRequest = sdo.toQueryRequest(QuotationQueryRequest.class);
return toResult(quotationApplication.slicedQuotationList(queryRequest));
}
public String print(){
SDO sdo = this.getSDO();
String quotationId = sdo.getString("quotationId");
Map<String,Object> map = quotationApplication.loadPrintData(quotationId);
return outputAndProcUnitHandlerPDF((String) map.get("url"),quotationId, map);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment