Commit bf67b66e by 杨清松

销售预警相关查询处理

parent 38f78674
......@@ -2,11 +2,16 @@ package com.xyst.dinas.sales.config;
import org.springframework.context.annotation.Bean;
import com.xyst.dinas.contract.internal.scene.ContractListDefaultScene;
import com.xyst.dinas.contract.query.processor.ContractPerformWarningProcessor;
import com.xyst.dinas.contract.query.processor.ContractWarnSettingProcessor;
import com.xyst.dinas.sales.dao.InventoryDao;
import com.xyst.dinas.sales.dao.NeedPlanDao;
import com.xyst.dinas.sales.dao.SalesPlanDao;
import com.xyst.dinas.sales.internal.dao.InventoryDaoImpl;
import com.xyst.dinas.sales.internal.dao.NeedPlanDaoImpl;
import com.xyst.dinas.sales.internal.query.processor.SalesPerformWarningProcessor;
import com.xyst.dinas.sales.internal.query.processor.SalesWarnSettingProcessor;
import com.xyst.dinas.sales.internal.service.InventoryServiceImpl;
import com.xyst.dinas.sales.internal.service.NeedPlanServiceImpl;
import com.xyst.dinas.sales.internal.service.SalesPlanServiceImpl;
......@@ -83,4 +88,13 @@ public class SalesConfiguration {
return new NeedPlanDaoImpl();
}
@Bean("com.xyst.dinas.sales.internal.query.processor.SalesPerformWarningProcessor")
public SalesPerformWarningProcessor performWarningProcessor() {
return new SalesPerformWarningProcessor();
}
@Bean("com.xyst.dinas.sales.internal.query.processor.SalesWarnSettingProcessor")
public SalesWarnSettingProcessor salesWarnSettingProcessor() {
return new SalesWarnSettingProcessor();
}
}
package com.xyst.dinas.sales.internal.query.processor;
import java.util.List;
import java.util.UUID;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.Assert;
import com.beecode.bcp.type.KObject;
import com.beecode.inz.query.entity.RowData;
import com.beecode.inz.query.processor.DataProcessor;
import com.beecode.inz.query.processor.DataProcessorContext;
import com.xyst.dinas.biz.service.StationService;
import com.xyst.dinas.contract.service.ContractService;
public class SalesPerformWarningProcessor implements DataProcessor {
@Autowired
private StationService stationService;
@Override
public void process(DataProcessorContext context) {
List<RowData> rowDatas = context.getRowDatas();
for (RowData row : rowDatas) {
UUID stationId = UUID.fromString(row.get("billId").toString());
KObject station = stationService.getById(stationId);
row.put("stationName", station.getString("stationName"));
Assert.notNull(station, "找不到对应的场站!");
row.put("regionalCompanyName", station.get("regionalCompany").getString("name"));
}
}
}
package com.xyst.dinas.sales.internal.query.processor;
import java.util.Arrays;
import java.util.List;
import java.util.UUID;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.Assert;
import com.beecode.bap.staff.service.StaffService;
import com.beecode.bcp.type.KObject;
import com.beecode.inz.query.entity.RowData;
import com.beecode.inz.query.processor.DataProcessor;
import com.beecode.inz.query.processor.DataProcessorContext;
import com.xyst.dinas.biz.service.StationService;
import com.xyst.dinas.contract.service.ContractService;
/**
* 销售预警设置
*
*/
public class SalesWarnSettingProcessor implements DataProcessor {
@Autowired
private StationService stationService;
@Autowired
private StaffService staffService;
@Override
public void process(DataProcessorContext context) {
List<RowData> rowDatas = context.getRowDatas();
for (RowData row : rowDatas) {
//场站
UUID stationId = UUID.fromString(row.get("billId").toString());
KObject station = stationService.getById(stationId);
row.put("stationName", station.getString("stationName"));
Assert.notNull(station, "找不到对应的场站!");
String personnel = row.get("personnel") != null ? row.get("personnel").toString() : "";
String personnelName = "";
if (StringUtils.isNotEmpty(personnel)) {
List<String> personnelList = Arrays.asList(personnel.split(","));
for (int i = 0; i < personnelList.size(); i++) {
String personnelId = personnelList.get(i);
KObject personnelKObject = staffService.getById(UUID.fromString(personnelId));
if (i == personnelList.size() - 1) {
personnelName += personnelKObject.getString("name");
} else {
personnelName += personnelKObject.getString("name") + ",";
}
}
}
row.put("personnelName", personnelName);
}
}
}
<model>
<header>
<type>inz.query.Query</type>
<package>com.xyst.dinas.sales.query</package>
<name>SalesWarnSetting</name>
<title>销售预警设置</title>
<tags></tags>
<description></description>
</header>
<content>
<customQuery id='c0fb04e4-3ea7-4374-aa12-96614d7d0231'>
<kclass>com.xyst.dinas.biz.datamodel.WarnSetting</kclass>
<dataProcessor>com.xyst.dinas.sales.internal.query.processor.SalesWarnSettingProcessor</dataProcessor>
<innerScene title='全部'>
<id>5c728238-45ed-42b4-bc66-be4ecce84609</id>
<javaImplement>com.beecode.inz.common.scene.CommonAllScene</javaImplement>
<defaultExecute></defaultExecute>
<hide></hide>
</innerScene>
<innerScene title='已废弃'>
<id>127aa3f5-1a4c-488b-9530-c890d5c8460b</id>
<javaImplement>com.beecode.inz.common.scene.DefaultDiscardScene</javaImplement>
<defaultExecute></defaultExecute>
<hide></hide>
</innerScene>
<field title='id'>
<name>id</name>
<type>uuid</type>
<ref>
<type></type>
<name></name>
</ref>
<description></description>
</field>
<field title='version'>
<name>version</name>
<type>int</type>
<description></description>
</field>
<field title='业务id'>
<name>billId</name>
<type>uuid</type>
<ref>
<type></type>
<name></name>
</ref>
<description></description>
</field>
<field title='业务类型'>
<name>billType</name>
<type>string</type>
<ref>
<type></type>
<name></name>
</ref>
<description></description>
</field>
<field title='预警指标'>
<name>target</name>
<type>string</type>
<ref>
<type></type>
<name></name>
</ref>
<description></description>
</field>
<field title='备注'>
<name>memo</name>
<type>string</type>
<ref>
<type></type>
<name></name>
</ref>
<description></description>
</field>
<field title='实际值'>
<name>min</name>
<type>string</type>
<ref>
<type></type>
<name></name>
</ref>
<description></description>
</field>
<field title='通知人员'>
<name>personnel</name>
<type>string</type>
<description></description>
</field>
<field title='创建时间'>
<name>createTime</name>
<type>datetime</type>
<ref>
<type></type>
<name></name>
</ref>
<description></description>
</field>
<field title='创建人'>
<name>creator.name</name>
<type>string</type>
<ref>
<type></type>
<name></name>
</ref>
<description></description>
</field>
<field title='修改时间'>
<name>modifyTime</name>
<type>datetime</type>
<ref>
<type></type>
<name></name>
</ref>
<description></description>
</field>
<field title='修改人'>
<name>modifier.name</name>
<type>string</type>
<ref>
<type></type>
<name></name>
</ref>
<description></description>
</field>
</customQuery>
</content>
</model>
\ No newline at end of file
<model>
<header>
<type>inz.query.Query</type>
<package>com.xyst.dinas.sales.query</package>
<name>SalesWarningExe</name>
<title>执行预警</title>
<tags></tags>
<description></description>
</header>
<content>
<customQuery id='62ee19e3-374c-4954-bcb8-eab78f76dd1f'>
<kclass>com.xyst.dinas.biz.datamodel.WarningExe</kclass>
<dataProcessor>com.xyst.dinas.sales.internal.query.processor.SalesPerformWarningProcessor</dataProcessor>
<innerScene title='全部'>
<id>a9e6e14f-0f08-433f-a5d8-034dde8aee93</id>
<javaImplement>com.beecode.inz.common.scene.CommonAllScene</javaImplement>
<defaultExecute></defaultExecute>
<hide></hide>
</innerScene>
<innerScene title='已废弃'>
<id>54a50515-f9e9-4f19-94db-d34424cf7f4b</id>
<javaImplement>com.beecode.inz.common.scene.DefaultDiscardScene</javaImplement>
<defaultExecute></defaultExecute>
<hide></hide>
</innerScene>
<field title='id'>
<name>id</name>
<type>uuid</type>
<ref>
<type></type>
<name></name>
</ref>
<description></description>
</field>
<field title='开始时间'>
<name>startTime</name>
<type>datetime</type>
<ref>
<type></type>
<name></name>
</ref>
<description></description>
</field>
<field title='结束时间'>
<name>endTime</name>
<type>datetime</type>
<ref>
<type></type>
<name></name>
</ref>
<description></description>
</field>
<field title='业务id'>
<name>billId</name>
<type>uuid</type>
<ref>
<type></type>
<name></name>
</ref>
<description></description>
</field>
<field title='预警指标'>
<name>target</name>
<type>string</type>
<ref>
<type></type>
<name></name>
</ref>
<description></description>
</field>
<field title='备注'>
<name>memo</name>
<type>string</type>
<ref>
<type></type>
<name></name>
</ref>
<description></description>
</field>
<field title='预警值'>
<name>min</name>
<type>string</type>
<ref>
<type></type>
<name></name>
</ref>
<description></description>
</field>
<field title='实际值'>
<name>actualValue</name>
<type>string</type>
<ref>
<type></type>
<name></name>
</ref>
<description></description>
</field>
<field title='创建时间'>
<name>createTime</name>
<type>datetime</type>
<ref>
<type></type>
<name></name>
</ref>
<description></description>
</field>
<field title='创建人'>
<name>creator.name</name>
<type>string</type>
<ref>
<type></type>
<name></name>
</ref>
<description></description>
</field>
<field title='修改时间'>
<name>modifyTime</name>
<type>datetime</type>
<ref>
<type></type>
<name></name>
</ref>
<description></description>
</field>
<field title='修改人'>
<name>modifier.name</name>
<type>string</type>
<ref>
<type></type>
<name></name>
</ref>
<description></description>
</field>
</customQuery>
</content>
</model>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<metadata xmlns="http://www.beecode.cn/schema/amino-metadata" xmlns:m="http://www.beecode.cn/schema/inz-query">
<specification>1.0</specification>
<id>c0fb04e4-3ea7-4374-aa12-96614d7d0231</id>
<name>com.xyst.dinas.sales.query.SalesWarnSetting</name>
<title>销售预警设置</title>
<define>inz.query.Query</define>
<define-version>1.0</define-version>
<dependency>com.xyst.dinas.biz.datamodel.WarnSetting</dependency>
<content>
<m:query>
<m:type>com.xyst.dinas.biz.datamodel.WarnSetting</m:type>
<m:dataProcessor>com.xyst.dinas.sales.internal.query.processor.SalesWarnSettingProcessor</m:dataProcessor>
<m:authorityItem></m:authorityItem>
<m:innerScenes>
<m:innerScene>
<m:id>5c728238-45ed-42b4-bc66-be4ecce84609</m:id>
<m:title>全部</m:title>
<m:javaImplement>com.beecode.inz.common.scene.CommonAllScene</m:javaImplement>
<m:defaultExecute></m:defaultExecute>
<m:hide></m:hide>
</m:innerScene>
<m:innerScene>
<m:id>127aa3f5-1a4c-488b-9530-c890d5c8460b</m:id>
<m:title>已废弃</m:title>
<m:javaImplement>com.beecode.inz.common.scene.DefaultDiscardScene</m:javaImplement>
<m:defaultExecute></m:defaultExecute>
<m:hide></m:hide>
</m:innerScene>
</m:innerScenes>
<m:fields>
<m:field>
<m:name>id</m:name>
<m:title>id</m:title>
<m:type>uuid</m:type>
<m:ref>
<m:name></m:name>
<m:type></m:type>
</m:ref>
<m:desc></m:desc>
</m:field>
<m:field>
<m:name>version</m:name>
<m:title>version</m:title>
<m:type>int</m:type>
<m:ref>
<m:name></m:name>
<m:type></m:type>
</m:ref>
<m:desc></m:desc>
</m:field>
<m:field>
<m:name>billId</m:name>
<m:title>业务id</m:title>
<m:type>uuid</m:type>
<m:ref>
<m:name></m:name>
<m:type></m:type>
</m:ref>
<m:desc></m:desc>
</m:field>
<m:field>
<m:name>billType</m:name>
<m:title>业务类型</m:title>
<m:type>string</m:type>
<m:ref>
<m:name></m:name>
<m:type></m:type>
</m:ref>
<m:desc></m:desc>
</m:field>
<m:field>
<m:name>target</m:name>
<m:title>预警指标</m:title>
<m:type>string</m:type>
<m:ref>
<m:name></m:name>
<m:type></m:type>
</m:ref>
<m:desc></m:desc>
</m:field>
<m:field>
<m:name>memo</m:name>
<m:title>备注</m:title>
<m:type>string</m:type>
<m:ref>
<m:name></m:name>
<m:type></m:type>
</m:ref>
<m:desc></m:desc>
</m:field>
<m:field>
<m:name>min</m:name>
<m:title>实际值</m:title>
<m:type>string</m:type>
<m:ref>
<m:name></m:name>
<m:type></m:type>
</m:ref>
<m:desc></m:desc>
</m:field>
<m:field>
<m:name>personnel</m:name>
<m:title>通知人员</m:title>
<m:type>string</m:type>
<m:ref>
<m:name></m:name>
<m:type></m:type>
</m:ref>
<m:desc></m:desc>
</m:field>
<m:field>
<m:name>createTime</m:name>
<m:title>创建时间</m:title>
<m:type>datetime</m:type>
<m:ref>
<m:name></m:name>
<m:type></m:type>
</m:ref>
<m:desc></m:desc>
</m:field>
<m:field>
<m:name>creator.name</m:name>
<m:title>创建人</m:title>
<m:type>string</m:type>
<m:ref>
<m:name></m:name>
<m:type></m:type>
</m:ref>
<m:desc></m:desc>
</m:field>
<m:field>
<m:name>modifyTime</m:name>
<m:title>修改时间</m:title>
<m:type>datetime</m:type>
<m:ref>
<m:name></m:name>
<m:type></m:type>
</m:ref>
<m:desc></m:desc>
</m:field>
<m:field>
<m:name>modifier.name</m:name>
<m:title>修改人</m:title>
<m:type>string</m:type>
<m:ref>
<m:name></m:name>
<m:type></m:type>
</m:ref>
<m:desc></m:desc>
</m:field>
</m:fields>
</m:query>
</content>
</metadata>
<?xml version="1.0" encoding="UTF-8"?>
<metadata xmlns="http://www.beecode.cn/schema/amino-metadata" xmlns:m="http://www.beecode.cn/schema/inz-query">
<specification>1.0</specification>
<id>62ee19e3-374c-4954-bcb8-eab78f76dd1f</id>
<name>com.xyst.dinas.sales.query.SalesWarningExe</name>
<title>销售预警</title>
<define>inz.query.Query</define>
<define-version>1.0</define-version>
<dependency>com.xyst.dinas.biz.datamodel.WarningExe</dependency>
<content>
<m:query>
<m:type>com.xyst.dinas.biz.datamodel.WarningExe</m:type>
<m:dataProcessor>com.xyst.dinas.sales.internal.query.processor.SalesPerformWarningProcessor</m:dataProcessor>
<m:authorityItem></m:authorityItem>
<m:innerScenes>
<m:innerScene>
<m:id>a9e6e14f-0f08-433f-a5d8-034dde8aee93</m:id>
<m:title>全部</m:title>
<m:javaImplement>com.beecode.inz.common.scene.CommonAllScene</m:javaImplement>
<m:defaultExecute></m:defaultExecute>
<m:hide></m:hide>
</m:innerScene>
<m:innerScene>
<m:id>54a50515-f9e9-4f19-94db-d34424cf7f4b</m:id>
<m:title>已废弃</m:title>
<m:javaImplement>com.beecode.inz.common.scene.DefaultDiscardScene</m:javaImplement>
<m:defaultExecute></m:defaultExecute>
<m:hide></m:hide>
</m:innerScene>
</m:innerScenes>
<m:fields>
<m:field>
<m:name>id</m:name>
<m:title>id</m:title>
<m:type>uuid</m:type>
<m:ref>
<m:name></m:name>
<m:type></m:type>
</m:ref>
<m:desc></m:desc>
</m:field>
<m:field>
<m:name>startTime</m:name>
<m:title>开始时间</m:title>
<m:type>datetime</m:type>
<m:ref>
<m:name></m:name>
<m:type></m:type>
</m:ref>
<m:desc></m:desc>
</m:field>
<m:field>
<m:name>endTime</m:name>
<m:title>结束时间</m:title>
<m:type>datetime</m:type>
<m:ref>
<m:name></m:name>
<m:type></m:type>
</m:ref>
<m:desc></m:desc>
</m:field>
<m:field>
<m:name>billId</m:name>
<m:title>业务id</m:title>
<m:type>uuid</m:type>
<m:ref>
<m:name></m:name>
<m:type></m:type>
</m:ref>
<m:desc></m:desc>
</m:field>
<m:field>
<m:name>target</m:name>
<m:title>预警指标</m:title>
<m:type>string</m:type>
<m:ref>
<m:name></m:name>
<m:type></m:type>
</m:ref>
<m:desc></m:desc>
</m:field>
<m:field>
<m:name>memo</m:name>
<m:title>备注</m:title>
<m:type>string</m:type>
<m:ref>
<m:name></m:name>
<m:type></m:type>
</m:ref>
<m:desc></m:desc>
</m:field>
<m:field>
<m:name>min</m:name>
<m:title>预警值</m:title>
<m:type>string</m:type>
<m:ref>
<m:name></m:name>
<m:type></m:type>
</m:ref>
<m:desc></m:desc>
</m:field>
<m:field>
<m:name>actualValue</m:name>
<m:title>实际值</m:title>
<m:type>string</m:type>
<m:ref>
<m:name></m:name>
<m:type></m:type>
</m:ref>
<m:desc></m:desc>
</m:field>
<m:field>
<m:name>createTime</m:name>
<m:title>创建时间</m:title>
<m:type>datetime</m:type>
<m:ref>
<m:name></m:name>
<m:type></m:type>
</m:ref>
<m:desc></m:desc>
</m:field>
<m:field>
<m:name>creator.name</m:name>
<m:title>创建人</m:title>
<m:type>string</m:type>
<m:ref>
<m:name></m:name>
<m:type></m:type>
</m:ref>
<m:desc></m:desc>
</m:field>
<m:field>
<m:name>modifyTime</m:name>
<m:title>修改时间</m:title>
<m:type>datetime</m:type>
<m:ref>
<m:name></m:name>
<m:type></m:type>
</m:ref>
<m:desc></m:desc>
</m:field>
<m:field>
<m:name>modifier.name</m:name>
<m:title>修改人</m:title>
<m:type>string</m:type>
<m:ref>
<m:name></m:name>
<m:type></m:type>
</m:ref>
<m:desc></m:desc>
</m:field>
</m:fields>
</m:query>
</content>
</metadata>
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