Commit 35c0a352 by wukaiqiang

统计工程提交

parent 5a6500f7
...@@ -147,6 +147,7 @@ dependencies { ...@@ -147,6 +147,7 @@ dependencies {
compile "com.beecode:xyst.dinas.price:${inzVersion}" compile "com.beecode:xyst.dinas.price:${inzVersion}"
compile "com.beecode:xyst.dinas.transport:${inzVersion}" compile "com.beecode:xyst.dinas.transport:${inzVersion}"
compile "com.beecode:xyst.dinas.sales:${inzVersion}" compile "com.beecode:xyst.dinas.sales:${inzVersion}"
compile "com.beecode:xyst.dinas.statistics:${inzVersion}"
compile "com.beecode:xyst.dinas.finance:${inzVersion}" compile "com.beecode:xyst.dinas.finance:${inzVersion}"
providedRuntime lib.spring_boot_starter_tomcat providedRuntime lib.spring_boot_starter_tomcat
} }
......
...@@ -144,5 +144,6 @@ includeBuild("../") { ...@@ -144,5 +144,6 @@ includeBuild("../") {
substitute module('com.beecode:xyst.dinas.price') with project(':xyst.dinas.price') substitute module('com.beecode:xyst.dinas.price') with project(':xyst.dinas.price')
substitute module('com.beecode:xyst.dinas.transport') with project(':xyst.dinas.transport') substitute module('com.beecode:xyst.dinas.transport') with project(':xyst.dinas.transport')
substitute module('com.beecode:xyst.dinas.sales') with project(':xyst.dinas.sales') substitute module('com.beecode:xyst.dinas.sales') with project(':xyst.dinas.sales')
substitute module('com.beecode:xyst.dinas.statistics') with project(':xyst.dinas.statistics')
} }
} }
\ No newline at end of file
...@@ -21,6 +21,7 @@ includeBuild("../") { ...@@ -21,6 +21,7 @@ includeBuild("../") {
substitute module('com.beecode:xyst.dinas.transport') with project(':xyst.dinas.transport') substitute module('com.beecode:xyst.dinas.transport') with project(':xyst.dinas.transport')
substitute module('com.beecode:xyst.dinas.sales') with project(':xyst.dinas.sales') substitute module('com.beecode:xyst.dinas.sales') with project(':xyst.dinas.sales')
substitute module('com.beecode:xyst.dinas.finance') with project(':xyst.dinas.finance') substitute module('com.beecode:xyst.dinas.finance') with project(':xyst.dinas.finance')
substitute module('com.beecode:xyst.dinas.statistics') with project(':xyst.dinas.statistics')
} }
} }
......
...@@ -147,3 +147,4 @@ include "xyst.dinas.production" ...@@ -147,3 +147,4 @@ include "xyst.dinas.production"
include "xyst.dinas.project" include "xyst.dinas.project"
include "xyst.dinas.sales" include "xyst.dinas.sales"
include "xyst.dinas.transport" include "xyst.dinas.transport"
include "xyst.dinas.statistics"
\ No newline at end of file
...@@ -19,4 +19,5 @@ include "xyst.dinas.price" ...@@ -19,4 +19,5 @@ include "xyst.dinas.price"
include "xyst.dinas.transport" include "xyst.dinas.transport"
include "xyst.dinas.sales" include "xyst.dinas.sales"
include "xyst.dinas.finance" include "xyst.dinas.finance"
include "xyst.dinas.statistics"
...@@ -9,11 +9,8 @@ import org.hibernate.query.Query; ...@@ -9,11 +9,8 @@ import org.hibernate.query.Query;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.lang.Nullable; import org.springframework.lang.Nullable;
import org.springframework.orm.hibernate5.HibernateTemplate; import org.springframework.orm.hibernate5.HibernateTemplate;
import org.springframework.test.web.reactive.server.KotlinBodySpec;
import com.beecode.bcp.type.KObject; import com.beecode.bcp.type.KObject;
import com.beecode.inz.common.BaseConstants; import com.beecode.inz.common.BaseConstants;
import com.xyst.dinas.contract.constant.ContractConstant;
import com.xyst.dinas.sales.constant.SalesPlanConstant; import com.xyst.dinas.sales.constant.SalesPlanConstant;
import com.xyst.dinas.sales.web.request.SaleaPlanDetailQuery; import com.xyst.dinas.sales.web.request.SaleaPlanDetailQuery;
......
package com.xyst.dinas.sales.dao; package com.xyst.dinas.sales.dao;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.UUID; import java.util.UUID;
import com.beecode.bcp.type.KObject; import com.beecode.bcp.type.KObject;
...@@ -10,5 +11,5 @@ public interface SalesRecordDao { ...@@ -10,5 +11,5 @@ public interface SalesRecordDao {
KObject load(UUID id); KObject load(UUID id);
UUID insert(KObject entity); UUID insert(KObject entity);
List<Object[]> getAllSalesRecordByDate(String dateNow,String dateBefore); List<Map<String, Object>> getAllSalesRecordByDate(String dateNow,String dateBefore);
} }
package com.xyst.dinas.sales.internal.dao; package com.xyst.dinas.sales.internal.dao;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.UUID; import java.util.UUID;
import javax.persistence.Tuple;
import org.hibernate.HibernateException; import org.hibernate.HibernateException;
import org.hibernate.Session; import org.hibernate.Session;
import org.hibernate.query.Query; import org.hibernate.query.Query;
...@@ -12,6 +18,7 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -12,6 +18,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.hibernate5.HibernateCallback; import org.springframework.orm.hibernate5.HibernateCallback;
import org.springframework.orm.hibernate5.HibernateOperations; import org.springframework.orm.hibernate5.HibernateOperations;
import com.beecode.amino.common.Convert;
import com.beecode.bcp.type.KObject; import com.beecode.bcp.type.KObject;
import com.xyst.dinas.sales.constant.SalesRecordConstant; import com.xyst.dinas.sales.constant.SalesRecordConstant;
import com.xyst.dinas.sales.dao.SalesRecordDao; import com.xyst.dinas.sales.dao.SalesRecordDao;
...@@ -32,31 +39,32 @@ public class SalesRecordDaoImpl implements SalesRecordDao, SalesRecordConstant { ...@@ -32,31 +39,32 @@ public class SalesRecordDaoImpl implements SalesRecordDao, SalesRecordConstant {
} }
@Override @Override
public List<Object[]> getAllSalesRecordByDate(String dateNow ,String dateBefore) { public List<Map<String, Object>> getAllSalesRecordByDate(String dateNow ,String dateBefore) {
// TODO Auto-generated method stub // TODO Auto-generated method stub
String sql = "select ss.project_id,ss.purchase_sand_company_id,ss.station_id,ss.dinas_type_id,sum(ss.deal_amount),sum(ss.amount) from xyst_dinas_sales_record ss where (ss.deal_time >= :startDate and ss.deal_time < :endDate ) GROUP BY ss.project_id,ss.purchase_sand_company_id,ss.station_id,ss.dinas_type_id"; String sql = "select ss.project_id,ss.purchase_sand_company_id,ss.station_id,ss.dinas_type_id,sum(ss.deal_amount),sum(ss.amount) from xyst_dinas_sales_record ss where (ss.deal_time >= :startDate and ss.deal_time < :endDate ) GROUP BY ss.project_id,ss.purchase_sand_company_id,ss.station_id,ss.dinas_type_id";
List<Object[]> list = template.execute(new HibernateCallback<List<Object[]>>() { return (List<Map<String, Object>>)template.execute(new HibernateCallback<List<Map<String, Object>>>() {
@Override @Override
public List<Object[]> doInHibernate(Session session) throws HibernateException { public List<Map<String, Object>> doInHibernate(Session session) throws HibernateException {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
Query<Object[]> query = session.createNativeQuery(sql); Query<Tuple> query = session.createNativeQuery(sql,Tuple.class);
query.setParameter("endDate", dateNow); query.setParameter("endDate", dateNow);
query.setParameter("startDate", dateBefore); query.setParameter("startDate", dateBefore);
List<Object[]> resultList = query.getResultList(); List<Tuple> resultList = query.getResultList();
if (resultList.isEmpty()) if (resultList.isEmpty())
return null; return null;
return resultList; List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
for(Tuple resule:resultList) {
Map<String, Object> map=new HashMap<String,Object>();
map.put("project_id", Convert.toUUID(resule.get(0)));
map.put("purchase_sand_company_id", Convert.toUUID(resule.get(1)));
map.put("station_id", Convert.toUUID(resule.get(2)));
map.put("dinas_type_id", Convert.toUUID(resule.get(3)));
map.put("deal_amount", resule.get(4,BigDecimal.class));
map.put("amount", resule.get(5,BigDecimal.class));
list.add(map);
}
return list;
} }
}); });
/*
* JSONArray resultArray = new JSONArray(); for (Object[] tp : list) {
* JSONObject data = new JSONObject(); data.put("project_id", tp[0]);
* data.put("purchase_sand_company_id", tp[1]); data.put("station_id", tp[2]);
* data.put("dinas_type_id", tp[3]); data.put("deal_amount", tp[4]);
* data.put("amount", tp[5]); resultArray.put(data); } return
* resultArray.toString();
*/
// return null;
return list;
} }
} }
...@@ -158,7 +158,7 @@ public class SalesRecordServiceImpl implements SalesRecordService { ...@@ -158,7 +158,7 @@ public class SalesRecordServiceImpl implements SalesRecordService {
.subtract(new BigDecimal(salesRecord.getDouble(SalesRecordConstant.DEALAMOUNT))); .subtract(new BigDecimal(salesRecord.getDouble(SalesRecordConstant.DEALAMOUNT)));
// 付款来源未定,暂时按使用预付款处理。 // 付款来源未定,暂时按使用预付款处理。
BigDecimal AMOUNT; BigDecimal AMOUNT;
if(PayMentSourceEnum.Advance.equals(salesRecordInfo.getPaymentSource())) { if(PayMentSourceEnum.Advance.name().equals(salesRecordInfo.getPaymentSource())) {
AMOUNT = BigDecimal.ZERO AMOUNT = BigDecimal.ZERO
.subtract(new BigDecimal(salesRecord.getDouble(SalesRecordConstant.AMOUNT))); .subtract(new BigDecimal(salesRecord.getDouble(SalesRecordConstant.AMOUNT)));
}else { }else {
......
dependencies {
compile lib.bcp_import
compile lib.bcp_type
compile lib.bcp_store
compile lib.hibernate_core
compile lib.spring_web
compile lib.spring_boot_autoconfigure
compile lib.jackson_datatype_jdk8
compile lib.jackson_datatype_jsr310
compile lib.json
compile "com.beecode:bap2.participant:${aminoVersion}"
compile "com.beecode:bcp.org:${aminoVersion}"
compile "com.beecode:bap2.department:${aminoVersion}"
compile "com.beecode:bap2.staff:${aminoVersion}"
compile 'com.deepoove:poi-tl:1.5.0'
compile project(":inz.common")
compile project(":inz.query")
compile project(":inz.workflow")
compile project(":inz.basis")
compile project(":xyst.dinas.biz")
compile project(":xyst.dinas.contract")
compile project(":xyst.dinas.price")
compile project(":xyst.dinas.project")
compile project(":xyst.dinas.sales")
testCompile lib.amino_boot_web
testCompile lib.mysql_connector
}
rootProject.name = 'xyst.dinas.statistics'
\ No newline at end of file
package com.xyst.dinas.statistics.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.dao.SalesRecordDao;
import com.xyst.dinas.sales.internal.dao.InventoryDaoImpl;
import com.xyst.dinas.sales.internal.dao.NeedPlanDaoImpl;
import com.xyst.dinas.sales.internal.dao.SalesRecordDaoImpl;
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;
import com.xyst.dinas.sales.internal.service.SalesRecordServiceImpl;
import com.xyst.dinas.sales.processor.SalesPlanProcessor;
import com.xyst.dinas.sales.processor.SalesPlanTempProcessor;
import com.xyst.dinas.sales.processor.StockAmountWarnCalculator;
import com.xyst.dinas.sales.service.InventoryService;
import com.xyst.dinas.sales.service.NeedPlanService;
import com.xyst.dinas.sales.service.SalesPlanService;
import com.xyst.dinas.sales.service.SalesRecordService;
import com.xyst.dinas.sales.task.SalesPlanAutoCreateTaskRegister;
import com.xyst.dinas.sales.web.InventoryController;
import com.xyst.dinas.sales.web.NeedPlanController;
import com.xyst.dinas.sales.web.SalesPlanController;
import com.xyst.dinas.sales.web.SalesRecordController;
import com.xyst.dinas.statistics.dao.AdvancePaymentBalanceSumDao;
import com.xyst.dinas.statistics.dao.SalesSummaryDao;
import com.xyst.dinas.statistics.internal.dao.AdvancePaymentBalanceSumDaoImpl;
import com.xyst.dinas.statistics.internal.dao.SalesSummaryDaoImpl;
import com.xyst.dinas.statistics.internal.service.AdvancePaymentBalanceSumServiceImpl;
import com.xyst.dinas.statistics.internal.service.SalesSummaryServiceImpl;
import com.xyst.dinas.statistics.scheduler.AdvancePaymentBalanceSumSchedulerTaskRegister;
import com.xyst.dinas.statistics.scheduler.SalesSummarySchedulerTaskRegister;
import com.xyst.dinas.statistics.service.AdvancePaymentBalanceSumService;
import com.xyst.dinas.statistics.service.SalesSummaryService;
import com.xyst.dinas.statistics.web.SalesSummaryController;
public class StatisticsConfiguration {
@Bean
public SalesSummaryService salesSummaryServiceImpl() {
return new SalesSummaryServiceImpl();
}
@Bean
public SalesSummaryDao salesSummaryDaoImpl() {
return new SalesSummaryDaoImpl();
}
@Bean
public SalesSummaryController salesSummaryController() {
return new SalesSummaryController();
}
@Bean
public SalesSummarySchedulerTaskRegister salesSummarySchedulerTaskRegister() {
return new SalesSummarySchedulerTaskRegister();
}
@Bean
public AdvancePaymentBalanceSumService advancePaymentBalanceSumServiceImpl() {
return new AdvancePaymentBalanceSumServiceImpl();
}
@Bean
public AdvancePaymentBalanceSumDao advancePaymentBalanceSumDaoImpl() {
return new AdvancePaymentBalanceSumDaoImpl();
}
@Bean
public AdvancePaymentBalanceSumSchedulerTaskRegister advancePaymentBalanceSumSchedulerTaskRegister() {
return new AdvancePaymentBalanceSumSchedulerTaskRegister();
}
}
package com.xyst.dinas.statistics.constant;
public interface AdvancePaymentBalanceSumConstants {
/**
* 实体名-销售汇总
*/
String SUMMARY_ENTITY = "com.xyst.dinas.statistics.datamodel.AdvancePaymentAndBalanceSummary";
/** ID*/
public static final String ID = "id";
/** 项目*/
public static final String PROJECT = "project";
/** 区域公司*/
public static final String REGIONALCOMPANY = "regionalCompany";
/** 购砂单位*/
public static final String PURCHASESANDUNIT = "purchaseSandUnit";
/** 去年剩余预付款*/
public static final String LASTYEARADVANCE = "lastYearAdvance";
/** 本年销售货款*/
public static final String PAYMENTSALES = "paymentSales";
/** 预付款总额*/
public static final String TOTALADVANCEPAYMENT = "totalAdvancePayment";
/** 预付款退款额*/
public static final String ADVANCEPAYMENTREFUNDAMOUNT = "advancePaymentRefundAmount";
/** 预付款余额*/
public static final String ADVANCEBALANCE = "advanceBalance";
/** 时间*/
public static final String DEALTIME = "dealTime";
/** 年*/
public static final String DEALYEAR = "dealYear";
/** 月*/
public static final String DEALMONTH = "dealMonth";
/** 日*/
public static final String DEALDAY = "dealDay";
/** 保证金总额*/
public static final String TOTALMARGIN = "totalMargin";
/** 保证金退款额*/
public static final String MARGINREFUND = "marginRefund";
}
package com.xyst.dinas.statistics.constant;
public interface SalesSummaryConstants {
/**
* 实体名-销售汇总
*/
String SALES_SUMMARY_ENTITY = "com.xyst.dinas.statistics.datamodel.SalesSummary";
/** ID*/
public static final String ID = "id";
/** 项目*/
public static final String PROJECT = "project";
/** 购砂单位*/
public static final String PURCHASESANDUNIT = "purchaseSandUnit";
/** 场站*/
public static final String STATION = "station";
/** 砂石种类*/
public static final String DINASTYPE = "dinasType";
/** 销量(吨)*/
public static final String SALEDEALAMOUNT = "saleDealAmount";
/** 销量额*/
public static final String SALEAMOUNT = "saleAmount";
/** 销售时间*/
public static final String DEALTIME = "dealTime";
/** 年*/
public static final String DEALYEAR = "dealYear";
/** 月*/
public static final String DEALMONTH = "dealMonth";
/** 日*/
public static final String dealDay = "dealDay";
}
package com.xyst.dinas.statistics.dao;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import com.beecode.bcp.type.KObject;
public interface AdvancePaymentBalanceSumDao {
UUID save(KObject entity);
List<Map<String, Object>> getAllRelevantData(String startDate,String nowDate);
}
package com.xyst.dinas.statistics.dao;
import com.beecode.bcp.type.KObject;
public interface SalesSummaryDao {
void save(KObject entity);
}
package com.xyst.dinas.statistics.internal.dao;
import java.math.BigDecimal;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import javax.persistence.Tuple;
import org.hibernate.HibernateException;
import org.hibernate.Session;
import org.hibernate.query.Query;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.hibernate5.HibernateCallback;
import org.springframework.orm.hibernate5.HibernateOperations;
import com.xyst.dinas.finance.constant.ArtificialRechargeConstant;
import com.xyst.dinas.finance.constant.FinanceRefundConstant;
import com.beecode.amino.common.Convert;
import com.beecode.bcp.type.KObject;
import com.xyst.dinas.biz.constant.DinasOrganizationConstant;
import com.xyst.dinas.contract.constant.ContractConstant;
import com.xyst.dinas.project.constant.ProjectFiledConstant;
import com.xyst.dinas.project.constant.PurchaseSandCompanyConstant;
import com.xyst.dinas.sales.constant.SalesRecordConstant;
import com.xyst.dinas.statistics.dao.AdvancePaymentBalanceSumDao;
public class AdvancePaymentBalanceSumDaoImpl implements AdvancePaymentBalanceSumDao {
@Autowired
private HibernateOperations template;
@Override
public UUID save(KObject entity) {
// TODO Auto-generated method stub
return (UUID) template.save(entity);
}
@Override
public List<Map<String, Object>> getAllRelevantData(String starDate,String nowDate) {
// TODO Auto-generated method stub
StringBuilder hql = new StringBuilder("select ");
hql.append("xx.a1 as a, ");// 区域公司ID
hql.append("xx.b1 as b, ");// 购砂单位ID
hql.append("xx.d1 as d, ");// 项目ID
hql.append("xx.e1 as e, ");// 去年剩余预付款
hql.append("xx.f1 as f, ");// 本年销售货款
hql.append("sum( xx.g1 ) as g, ");// 预付款总额
hql.append("sum( xx.h1 ) as h, ");// 预付款退款额
hql.append("xx.i as i1 , ");// 预付款余额
hql.append("sum( xx.j1 ) as j , ");// 保证金总额
hql.append("sum(xx.q1) as q ");// 保证金退款额
hql.append("from (").append(
" SELECT REGIONALCOMPANY.id AS a', PURCHASESANDUNIT.id AS b1, CONTRACT.id AS c1, PROJECT.id AS d1, '' AS e1, sum( SALESRECODE.amount ) AS f1, ");
hql.append(" CASE WHEN ARTIFICIAL.fund_type = 'DEPOSIT' THEN '' ELSE sum( ARTIFICIAL.recharge_amount ) END AS g1, ");
hql.append(" CASE WHEN REFUND.fund_type = '1' THEN '' ELSE sum( REFUND.actual_refund_amount ) END AS h1, ");
hql.append(" CONTRACT.advance_balance AS i1, ");
hql.append(" CASE WHEN ARTIFICIAL.fund_type = 'DEPOSIT' THEN sum( ARTIFICIAL.recharge_amount ) ELSE '' END AS j1, ");
hql.append(" CASE WHEN REFUND.fund_type = '1' THEN sum( REFUND.actual_refund_amount ) ELSE '' END AS q1 ");
hql.append(" from ").append(DinasOrganizationConstant.ORGANIZATION_ENTITY).append(" as REGIONALCOMPANY ");// 區域公司
hql.append("LEFT JOIN ").append(PurchaseSandCompanyConstant.PURCHASE_SAND_COMPANY_NTITY)
.append(" as PURCHASESANDUNIT ON PURCHASESANDUNIT.regional_company = REGIONALCOMPANY.id ");// 购砂单位
hql.append("LEFT JOIN ").append(ContractConstant.ENTITY_CONTRACT)
.append(" as CONTRACT ON CONTRACT.purchase_sand_Unit_id = PURCHASESANDUNIT.id AND CONTRACT.contract_state = 'EXECUTING' ");// 合同
hql.append("LEFT JOIN ").append(ProjectFiledConstant.PROJECTFILED_NTITY )
.append(" as PROJECT on CONTRACT.project_id = PROJECT.id ");// 项目
hql.append("LEFT JOIN ").append(SalesRecordConstant.ENTITY).append(" AS SALESRECODE ON SALESRECODE.project_id = PROJECT.id ")
.append("AND SALESRECODE.regional_company_id = REGIONALCOMPANY.id ").append("AND SALESRECODE.contract_id = CONTRACT.id ")
.append("AND ( SALESRECODE.sync_time < :datebefore ").append(" AND SALESRECODE.sync_time >= :nowDate )");// 銷售台账
hql.append("LEFT JOIN ").append(ArtificialRechargeConstant.ENTITY)
.append(" AS ARTIFICIAL ON ARTIFICIAL.regional_company = REGIONALCOMPANY.id ").append(" AND ARTIFICIAL.contract = CONTRACT.id ")
.append(" AND ARTIFICIAL.purchase_sand_unit = PURCHASESANDUNIT.id ")
.append(" AND ( ARTIFICIAL.create_time <:dateBefore ").append(" AND ARTIFICIAL.create_time >= :nowDate ) ");// 人工充值
hql.append("LEFT JOIN ").append(FinanceRefundConstant.ENTITY).append(" AS REFUND ON REFUND.regional_company = REGIONALCOMPANY.id ")
.append(" AND REFUND.contract = CONTRACT.id ").append(" AND REFUND.purchase_sand_company = PURCHASESANDUNIT.id ")
.append(" AND ( REFUND.create_time <:dateBefore ").append(" AND REFUND.create_time >= :nowDate ) ");// 财务退款
hql.append(" where 1=1 ").append(" PURCHASESANDUNIT.regional_company IS NOT NULL ");// 去掉脏数据
hql.append(" GROUP BY ").append(" CONTRACT.id, ").append(" ARTIFICIAL.project, ").append(" ARTIFICIAL.contract, ")
.append(" ARTIFICIAL.purchase_sand_unit, ").append(" REFUND.project, ").append(" REFUND.contract, ")
.append(" REFUND.purchase_sand_company, ").append(" ARTIFICIAL.fund_type, ").append(" REFUND.fund_type ")
.append(" ) AS xx ");// 分组
hql.append(" GROUP BY ").append(" xx.a1, ").append(" xx.b1, ").append(" xx.c1, ").append(" xx.d1 ; ");// 外层分组
return (List<Map<String, Object>>) template.execute(new HibernateCallback<List<Map<String, Object>>>() {
@Override
public List<Map<String, Object>> doInHibernate(Session session) throws HibernateException {
Query<Tuple> query = session.createQuery(hql.toString(), Tuple.class);
query.setParameter("datebefore",starDate);
query.setParameter("nowDate",nowDate);
List<Tuple> resultList = query.getResultList();
if (resultList.isEmpty())
return null;
List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
for (Tuple resule : resultList) {
Map<String, Object> map = new HashMap<String, Object>();
map.put("regional_company_id", Convert.toUUID(resule.get(0)));
map.put("purchase_sand_unit_id", Convert.toUUID(resule.get(1)));
map.put("project_id", Convert.toUUID(resule.get(2)));
map.put("last_year_advance", Convert.toUUID(resule.get(3)));
map.put("payment_sales", Convert.toUUID(resule.get(4)));
map.put("total_advance_payment", Convert.toUUID(resule.get(5)));
map.put("advance_payment_refund_amount", Convert.toUUID(resule.get(6)));
map.put("advance_balance", Convert.toUUID(resule.get(7)));
map.put("total_margin", Convert.toUUID(resule.get(8)));
map.put("margin_refund", Convert.toUUID(resule.get(9)));
list.add(map);
}
return list;
}
});
}
}
package com.xyst.dinas.statistics.internal.dao;
import java.util.UUID;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.hibernate5.HibernateOperations;
import com.beecode.bcp.type.KObject;
import com.xyst.dinas.statistics.dao.SalesSummaryDao;
public class SalesSummaryDaoImpl implements SalesSummaryDao {
@Autowired
private HibernateOperations template;
@Override
public void save(KObject entity) {
// TODO Auto-generated method stub
template.save(entity);
}
}
package com.xyst.dinas.statistics.internal.service;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.transaction.annotation.Transactional;
import com.xyst.dinas.statistics.constant.AdvancePaymentBalanceSumConstants;
import com.xyst.dinas.statistics.constant.SalesSummaryConstants;
import com.xyst.dinas.statistics.dao.AdvancePaymentBalanceSumDao;
import com.xyst.dinas.statistics.dao.SalesSummaryDao;
import com.xyst.dinas.statistics.service.AdvancePaymentBalanceSumService;
import com.xyst.dinas.statistics.service.SalesSummaryService;
import com.beecode.bcp.type.KClass;
import com.beecode.bcp.type.KObject;
import com.xyst.dinas.biz.dao.DinasOrganizationDao;
import com.xyst.dinas.biz.dao.DinasTypeDao;
import com.xyst.dinas.biz.dao.StationDao;
import com.xyst.dinas.project.dao.ProjectFiledDao;
import com.xyst.dinas.project.dao.PurchaseSandCompanyDao;
import com.xyst.dinas.sales.dao.SalesRecordDao;
import com.xyst.dinas.sales.web.info.SyncException;
public class AdvancePaymentBalanceSumServiceImpl implements AdvancePaymentBalanceSumService {
@Autowired
private AdvancePaymentBalanceSumDao advancePaymentBalanceSumDao;
@Autowired
private AdvancePaymentBalanceSumDao AdvancePaymentBalanceSumDao;
@Autowired
private ProjectFiledDao projectFiledDao;
@Autowired
PurchaseSandCompanyDao purchaseSandCompanyDao;
@Autowired
StationDao stationDao;
@Autowired
DinasTypeDao dinasTypeDao;
@Autowired
DinasOrganizationDao dinasOrganizationDao;
@Autowired
@Qualifier(AdvancePaymentBalanceSumConstants.SUMMARY_ENTITY)
private KClass AdvancePaymentBalanceSumClass;
@Transactional
@Override
public boolean generateAdvancePaymentBalanceSumByDate(String startDate, String nowDate) {
boolean state = false;
try {
List<Map<String, Object>> SalesRecordList = advancePaymentBalanceSumDao.getAllRelevantData(startDate,nowDate);
for (Map<String, Object> mp : SalesRecordList) {
KObject AdvancePaymentBalanceSum = AdvancePaymentBalanceSumClass.newInstance();
AdvancePaymentBalanceSum.set(AdvancePaymentBalanceSumConstants.ID, UUID.randomUUID());
AdvancePaymentBalanceSum.set(AdvancePaymentBalanceSumConstants.PROJECT, projectFiledDao.load((UUID) mp.get("project_id")));
AdvancePaymentBalanceSum.set(AdvancePaymentBalanceSumConstants.REGIONALCOMPANY,dinasOrganizationDao.load((UUID) mp.get("regional_company_id")));
AdvancePaymentBalanceSum.set(AdvancePaymentBalanceSumConstants.PURCHASESANDUNIT, purchaseSandCompanyDao.load((UUID) mp.get("purchase_sand_unit_id")));
AdvancePaymentBalanceSum.set(AdvancePaymentBalanceSumConstants.LASTYEARADVANCE, (BigDecimal)mp.get("last_year_advance"));//去年剩余预付款存在疑问
AdvancePaymentBalanceSum.set(AdvancePaymentBalanceSumConstants.PAYMENTSALES, (BigDecimal)mp.get("payment_sales"));
AdvancePaymentBalanceSum.set(AdvancePaymentBalanceSumConstants.TOTALADVANCEPAYMENT, (BigDecimal)mp.get("total_advance_payment"));
AdvancePaymentBalanceSum.set(AdvancePaymentBalanceSumConstants.ADVANCEPAYMENTREFUNDAMOUNT, (BigDecimal)mp.get("advance_payment_refund_amount"));
AdvancePaymentBalanceSum.set(AdvancePaymentBalanceSumConstants.ADVANCEBALANCE, (BigDecimal)mp.get("advance_balance"));
AdvancePaymentBalanceSum.set(AdvancePaymentBalanceSumConstants.DEALTIME, nowDate);
AdvancePaymentBalanceSum.set(AdvancePaymentBalanceSumConstants.DEALYEAR, nowDate.substring(0, 4));
AdvancePaymentBalanceSum.set(AdvancePaymentBalanceSumConstants.DEALMONTH, nowDate.substring(5, 7));
AdvancePaymentBalanceSum.set(AdvancePaymentBalanceSumConstants.DEALDAY, nowDate.substring(8, 10));
AdvancePaymentBalanceSum.set(AdvancePaymentBalanceSumConstants.TOTALMARGIN, (BigDecimal)mp.get("total_margin"));
AdvancePaymentBalanceSum.set(AdvancePaymentBalanceSumConstants.MARGINREFUND, (BigDecimal)mp.get("margin_refund"));
AdvancePaymentBalanceSumDao.save(AdvancePaymentBalanceSum);
state = true;
}}catch (Exception e) {
state = false;
throw new SyncException("预付款与结余汇总信息存储报出错:" + e.getMessage());
}
return state;
}
}
package com.xyst.dinas.statistics.internal.service;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.transaction.annotation.Transactional;
import com.xyst.dinas.statistics.constant.SalesSummaryConstants;
import com.xyst.dinas.statistics.dao.SalesSummaryDao;
import com.xyst.dinas.statistics.service.SalesSummaryService;
import com.beecode.bcp.type.KClass;
import com.beecode.bcp.type.KObject;
import com.xyst.dinas.biz.dao.DinasTypeDao;
import com.xyst.dinas.biz.dao.StationDao;
import com.xyst.dinas.project.dao.ProjectFiledDao;
import com.xyst.dinas.project.dao.PurchaseSandCompanyDao;
import com.xyst.dinas.sales.dao.SalesRecordDao;
import com.xyst.dinas.sales.web.info.SyncException;
public class SalesSummaryServiceImpl implements SalesSummaryService {
@Autowired
private SalesRecordDao SalesRecordDao;
@Autowired
private SalesSummaryDao salesSummaryDao;
@Autowired
private ProjectFiledDao projectFiledDao;
@Autowired
PurchaseSandCompanyDao purchaseSandCompanyDao;
@Autowired
StationDao stationDao;
@Autowired
DinasTypeDao dinasTypeDao;
@Autowired
@Qualifier(SalesSummaryConstants.SALES_SUMMARY_ENTITY)
private KClass SalesSummaryClass;
@Transactional
@Override
public boolean generateAllSalesRecordByDate(String dateNow,String dateBefore) {
boolean state = false;
try {
List<Map<String, Object>> SalesRecordList = SalesRecordDao.getAllSalesRecordByDate(dateNow, dateBefore);
for (Map<String, Object> mp : SalesRecordList) {
KObject SalesSummary = SalesSummaryClass.newInstance();
SalesSummary.set(SalesSummaryConstants.ID, UUID.randomUUID());
SalesSummary.set(SalesSummaryConstants.PROJECT, projectFiledDao.load((UUID) mp.get("project_id")));
SalesSummary.set(SalesSummaryConstants.PURCHASESANDUNIT,purchaseSandCompanyDao.load((UUID) mp.get("purchase_sand_company_id")));
SalesSummary.set(SalesSummaryConstants.STATION, stationDao.load((UUID) mp.get("station_id")));
SalesSummary.set(SalesSummaryConstants.DINASTYPE, dinasTypeDao.load((UUID) mp.get("dinas_type_id")));
SalesSummary.set(SalesSummaryConstants.SALEDEALAMOUNT, (BigDecimal)mp.get("deal_amount"));
SalesSummary.set(SalesSummaryConstants.SALEAMOUNT, (BigDecimal)mp.get("amount"));
SalesSummary.set(SalesSummaryConstants.DEALTIME, dateNow);
SalesSummary.set(SalesSummaryConstants.DEALYEAR, dateNow.substring(0, 4));
SalesSummary.set(SalesSummaryConstants.DEALMONTH, dateNow.substring(5, 7));
SalesSummary.set(SalesSummaryConstants.dealDay, dateNow.substring(8, 10));
salesSummaryDao.save(SalesSummary);
state = true;
}}catch (Exception e) {
state = false;
throw new SyncException("销售汇总信息存储报出错:" + e.getMessage());
}
return state;
}
}
package com.xyst.dinas.statistics.scheduler;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.annotation.Autowired;
import com.beecode.amino.core.Amino;
import com.beecode.bap.scheduler.core.Task;
import com.beecode.bap.scheduler.core.TaskContext;
import com.beecode.bap.scheduler.service.ScheduleService;
import com.xyst.dinas.statistics.service.AdvancePaymentBalanceSumService;
public class AdvancePaymentBalanceSumSchedulerTask implements Task {
public Logger logger = LoggerFactory.getLogger(this.getClass());
@Autowired
public ScheduleService scheduleService;
@Autowired
public AdvancePaymentBalanceSumService advancePaymentBalanceSumService;
@Override
public void execute(TaskContext context) {
logger.info("预付款与结余汇总调度开始执行!!!!");
AdvancePaymentBalanceSumService advancePaymentBalanceSumService= null;
try {
advancePaymentBalanceSumService = Amino.getApplicationContext().getBean(AdvancePaymentBalanceSumService.class);
} catch (BeansException e) {
logger.error("启动预付款与结余汇总的调度任务失败,没有获取到SalesSummaryService实现类对象");
return;
}
if (advancePaymentBalanceSumService == null) {
logger.error("启动预付款与结余汇总的调度任务失败,没有获取到SalesSummaryService实现类对象");
return;
}
generateAdvancePaymentBalanceSum (advancePaymentBalanceSumService);
}
public void generateAdvancePaymentBalanceSum(AdvancePaymentBalanceSumService advancePaymentBalanceSumService){
SimpleDateFormat dateTime = new SimpleDateFormat("yyyy-MM-dd");
Date thenTime = new Date();
Date beforeTime = new Date();
String dateNow = dateTime.format(thenTime);
Calendar calendar = Calendar.getInstance(); // 获取日历
calendar.setTime(thenTime);// 把当前时间赋给日历
calendar.add(Calendar.DAY_OF_MONTH, -1); // 设置为前一天
beforeTime = calendar.getTime(); // 得到前一天的时间
String dateBefore = dateTime.format(beforeTime);
boolean flag = advancePaymentBalanceSumService.generateAdvancePaymentBalanceSumByDate(dateBefore,dateNow);
if(flag) {
logger.info("预付款与结余汇总调度执行成功!!!!");
}else {
logger.info("预付款与结余汇总调度执行失败!!!!");
}
}
}
package com.xyst.dinas.statistics.scheduler;
import java.util.Optional;
import javax.annotation.PostConstruct;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import com.beecode.amino.metadata.context.ApplicationMetadataContext;
import com.beecode.amino.metadata.runtime.ServiceInitializer;
import com.beecode.bap.scheduler.entity.ScheduleDetail;
import com.beecode.bap.scheduler.entity.TaskDetail;
import com.beecode.bap.scheduler.service.ScheduleService;
public class AdvancePaymentBalanceSumSchedulerTaskRegister implements ServiceInitializer{
private Logger logger = LoggerFactory.getLogger(this.getClass());
@Autowired
private ScheduleService scheduleService;
//任务名
private final String Advance_Payment_Balance_Sum_Scheduler_Task ="AdvancePaymentBalanceSumSchedulerTask";
@Override
public void init(ApplicationMetadataContext arg0) {
}
@PostConstruct
public void init() {
// TODO Auto-generated method stub
//运行这个task之前,先检查是否存在这个轮询任务
Optional<ScheduleDetail> salesSummaryTask = scheduleService.findByName(Advance_Payment_Balance_Sum_Scheduler_Task);
if(salesSummaryTask.isPresent()){
//如果该租户的库中存在这个轮询任务那么就不再去注册了
scheduleService.removeTask(Advance_Payment_Balance_Sum_Scheduler_Task);
}
TaskDetail taskDetail = new TaskDetail(Advance_Payment_Balance_Sum_Scheduler_Task,AdvancePaymentBalanceSumSchedulerTask.class.getName());
//scheduleService.scheduleTask(taskDetail, "0 0 1/23 * * ? *");
//测试使用 没分钟执行一次
//scheduleService.scheduleTask(taskDetail, "0 0/5 * * * ? *");
logger.info("销售汇总自动创建任务初始化成功!");
}
}
package com.xyst.dinas.statistics.scheduler;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.annotation.Autowired;
import com.beecode.amino.core.Amino;
import com.beecode.bap.scheduler.core.Task;
import com.beecode.bap.scheduler.core.TaskContext;
import com.beecode.bap.scheduler.service.ScheduleService;
import com.xyst.dinas.statistics.service.SalesSummaryService;
public class SalesSummarySchedulerTask implements Task {
public Logger logger = LoggerFactory.getLogger(this.getClass());
@Autowired
public ScheduleService scheduleService;
@Autowired
public SalesSummaryService salesSummaryService;
@Override
public void execute(TaskContext context) {
logger.info("销售汇总调度开始执行!!!!");
SalesSummaryService salesSummaryService= null;
try {
salesSummaryService = Amino.getApplicationContext().getBean(SalesSummaryService.class);
} catch (BeansException e) {
logger.error("启动销售汇总的调度任务失败,没有获取到SalesSummaryService实现类对象");
return;
}
if (salesSummaryService == null) {
logger.error("启动销售汇总的调度任务失败,没有获取到SalesSummaryService实现类对象");
return;
}
generateSalesRecord (salesSummaryService);
}
public void generateSalesRecord(SalesSummaryService salesSummaryService){
SimpleDateFormat dateTime = new SimpleDateFormat("yyyy-MM-dd");
Date thenTime = new Date();
Date beforeTime = new Date();
String dateNow = dateTime.format(thenTime);
Calendar calendar = Calendar.getInstance(); // 获取日历
calendar.setTime(thenTime);// 把当前时间赋给日历
calendar.add(Calendar.DAY_OF_MONTH, -1); // 设置为前一天
beforeTime = calendar.getTime(); // 得到前一天的时间
String dateBefore = dateTime.format(beforeTime);
boolean flag = salesSummaryService.generateAllSalesRecordByDate(dateNow,dateBefore);
if(flag) {
logger.info("销售汇总调度执行成功!!!!");
}else {
logger.info("销售汇总调度执行失败!!!!");
}
}
}
package com.xyst.dinas.statistics.scheduler;
import java.util.Optional;
import javax.annotation.PostConstruct;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import com.beecode.amino.metadata.context.ApplicationMetadataContext;
import com.beecode.amino.metadata.runtime.ServiceInitializer;
import com.beecode.bap.scheduler.entity.ScheduleDetail;
import com.beecode.bap.scheduler.entity.TaskDetail;
import com.beecode.bap.scheduler.service.ScheduleService;
public class SalesSummarySchedulerTaskRegister implements ServiceInitializer{
private Logger logger = LoggerFactory.getLogger(this.getClass());
@Autowired
private ScheduleService scheduleService;
//任务名
private final String SALES_SUMMARY_TASK_NAME ="SalesSummarySchedulerTask";
@Override
public void init(ApplicationMetadataContext arg0) {
}
@PostConstruct
public void init() {
// TODO Auto-generated method stub
//运行这个task之前,先检查是否存在这个轮询任务
Optional<ScheduleDetail> salesSummaryTask = scheduleService.findByName(SALES_SUMMARY_TASK_NAME);
if(salesSummaryTask.isPresent()){
//如果该租户的库中存在这个轮询任务那么就不再去注册了
scheduleService.removeTask(SALES_SUMMARY_TASK_NAME);
}
TaskDetail taskDetail = new TaskDetail(SALES_SUMMARY_TASK_NAME,SalesSummarySchedulerTask.class.getName());
scheduleService.scheduleTask(taskDetail, "0 0 1/23 * * ? *");
//测试使用 没分钟执行一次
//scheduleService.scheduleTask(taskDetail, "0 0/5 * * * ? *");
logger.info("销售汇总自动创建任务初始化成功!");
}
}
package com.xyst.dinas.statistics.service;
public interface AdvancePaymentBalanceSumService {
boolean generateAdvancePaymentBalanceSumByDate(String dateNow,String dateBefore);
}
package com.xyst.dinas.statistics.service;
public interface SalesSummaryService {
boolean generateAllSalesRecordByDate(String dateNow,String dateBefore);
}
package com.xyst.dinas.statistics.web;
import java.util.List;
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.RestController;
import com.beecode.inz.basis.team.pojo.ResponseObj;
import com.xyst.dinas.sales.web.info.SalesRecordInfo;
import com.xyst.dinas.statistics.service.AdvancePaymentBalanceSumService;
import com.xyst.dinas.statistics.service.SalesSummaryService;
@RestController
public class SalesSummaryController {
@Autowired
SalesSummaryService salesSummaryService;
@Autowired
AdvancePaymentBalanceSumService advancePaymentBalanceSumService;
@PostMapping(value = "/SalesSummary/save", consumes = "application/json")
public Object saveSalesSummary(@RequestBody List<SalesRecordInfo>
salesRecordList) {
/* if (salesRecordList.isEmpty()) { return
ResponseObj.error("传递的销售台账数据条数为0!请确认!"); } else { return
salesSummaryService.generateAllSalesRecordByDate("2021-05-08", "2021-05-07"); }
}*/
if (salesRecordList.isEmpty()) { return
ResponseObj.error("传递的销售台账数据条数为0!请确认!"); } else { return
advancePaymentBalanceSumService.generateAdvancePaymentBalanceSumByDate("2021-05-08", "2021-05-07"); }
}
}
<model>
<header>
<type>bcp.type.DataModel</type>
<package>com.xyst.dinas.statistics.datamodel</package>
<title>预付款与结余汇总</title>
<name>AdvancePaymentAndBalanceSummary</name>
<tags/>
<description/>
<templateName>mk.ide.ui.editor.data.model.template.bill</templateName>
<tablePrefix>xyst_dinas_</tablePrefix>
</header>
<content>
<dataModel id="1cba683b-8b0a-4818-8d74-a31f026de748" multiVersion="" domainInherit="undefined" tableName="xyst_dinas_statistics_advancepayment_Balance_summary">
<attribute id="ff32cc0a-c210-4406-9731-cff37d1404b8" name="id" title="id" type="uuid" default="" precision="" isArray="false">
<annotation id="73a1cb4d-e795-45c8-9c6d-757b008e30ef" attributeId="9899d7a9-a832-44ca-a641-00810a191f68" name="required" value="true">
</annotation>
</attribute>
<attribute id="a4c4c050-30aa-4de0-bdeb-5de7534510bf" name="project" columnName="project_id" title="项目" type="com.xyst.dinas.project.datamodel.ProjectFiled" default="" precision="" isArray="false">
<annotation id="fe55fbe9-f5b6-4032-bb79-8b0ebbe160b9" attributeId="4f3d266a-ec77-4ce3-96ec-73a4cfe5a130" name="length" value="undefined"/>
<annotation id="93a5446e-bd23-4a13-84f9-7873fe4abe1d" attributeId="b1c5aa83-5731-49fa-aace-e53fd3d66df5" name="mappingType" value="many-to-one"/>
</attribute>
<attribute id="dee2030d-0145-4c86-bc91-7bd3411ecf35" name="regionalCompany" columnName="regional_company_id" title="区域公司" type="com.xyst.dinas.biz.datamodel.xystOrganization" default="" precision="" isArray="false">
<annotation id="908598b2-eaf2-453c-a18e-5ea3abffb699" attributeId="8652af15-2d76-4c2b-b24b-6fb3b411b366" name="length" value="undefined"/>
<annotation id="82ef781e-52df-4e71-b6d4-96bb4415a907" attributeId="8029c4ad-f7e3-4501-93d6-729d7398cb24" name="mappingType" value="many-to-one"/>
</attribute>
<attribute id="7187fcf2-dfa7-47f1-aedc-37a93ee6a190" name="purchaseSandUnit" columnName="purchase_sand_unit_id" title="购砂单位" type="com.xyst.dinas.project.datamodel.PurchaseSandCompany" default="" precision="" isArray="false">
<annotation id="12071f69-f27f-4bb0-9984-5d65c35c4531" attributeId="2ade0158-5b2a-44ec-83f7-281ceb1b322c" name="length" value="undefined"/>
<annotation id="0efdbd39-3c79-49e1-bf2c-b8d3a345e11b" attributeId="f321cb76-1480-45c0-925d-a99fe3deffd9" name="mappingType" value="many-to-one"/>
</attribute>
<attribute id="1aadfd7d-0f81-4d79-bf42-5365b6315ef3" name="lastYearAdvance" columnName="last_year_advance" title="去年剩余预付款" type="fixnum" default="" precision="" isArray="false">
<annotation id="6a4a644c-0738-45c2-a8e3-b35a4723ee2e" attributeId="c93c47ba-a584-4ba0-9f16-778cdb2cfa66" name="length" value="100"/>
<annotation id="aba15f9c-dd2f-4615-a1a5-0f3748a179bc" attributeId="bd2551c4-6c0f-428d-965a-2c70238710c7" name="precision" value="12"/>
<annotation id="05067003-fdc0-4f47-9b65-228d6c1256bd" attributeId="b71e359f-2528-4f52-be8d-6760ca6edb53" name="scale" value="4"/>
</attribute>
<attribute id="280b767e-bd80-4e56-bc64-70802446c91e" name="paymentSales" columnName="payment_sales" title="本年销售货款" type="fixnum" default="" precision="" isArray="false">
<annotation id="8a3736db-a472-4813-a74f-fef045892f46" attributeId="f5392a23-f43b-4cd2-bddb-c76c09ec0b44" name="length" value="100"/>
<annotation id="6a319123-f2e8-468a-b5b4-5e56bf6fd797" attributeId="df69779c-387f-461b-93d3-ad05ce2504ea" name="precision" value="12"/>
<annotation id="343870da-3e1c-4202-ba0e-94b1af1f0d90" attributeId="92e87779-555b-4491-9eb5-b4545bbef13e" name="scale" value="4"/>
</attribute>
<attribute id="208b9347-a941-4ca6-826a-5c1a47354651" name="totalAdvancePayment" columnName="total_advance_payment" title="预付款总额" type="fixnum" default="" precision="" isArray="false">
<annotation id="fd4dea20-a0f9-4af8-9c42-509eaf73385f" attributeId="c3288668-1c27-4299-87d2-aa0f0505843f" name="length" value="100"/>
<annotation id="ae3ff343-4e71-4822-8231-0ffe22dbab2f" attributeId="bfcf5749-a8ac-4927-916e-f650e141d17e" name="precision" value="12"/>
<annotation id="9cb0875f-8ae1-4cbe-aaf7-f1e39d286008" attributeId="8be7bb00-00ee-4764-9d7d-dada67642c90" name="scale" value="4"/>
</attribute>
<attribute id="7e60957f-64e6-44dd-8e92-33a1cd20d4e5" name="advancePaymentRefundAmount" columnName="advance_payment_refund_amount" title="预付款退款额" type="fixnum" default="" precision="" isArray="false">
<annotation id="ebb96d31-4f2c-4fef-90da-6130ab54a414" attributeId="15c34b85-cf6a-4e1e-a5f4-eb5207158dcf" name="length" value="100"/>
<annotation id="43513e25-b390-4122-870f-28bfa585a3f9" attributeId="085962fe-10ae-4971-b32a-875c27be7b78" name="precision" value="12"/>
<annotation id="2be3024f-35ed-45c1-a34e-0df1dbdb59b8" attributeId="073cfe84-97d0-4089-b183-c7a574217ca9" name="scale" value="4"/>
</attribute>
<attribute id="e345c63a-dee6-4a75-a399-bb9354746cda" name="advanceBalance" columnName="advance_balance" title="预付款余额" type="fixnum" default="" precision="" isArray="false">
<annotation id="e1881c9e-c742-44dc-a43d-570cd3c8c6ff" attributeId="25926640-0aab-4e7e-a0ed-5cb25372f68e" name="length" value="100"/>
<annotation id="1852628a-d951-4053-807b-53b7c0549c45" attributeId="02c242e6-5bcb-4993-a9f0-a4f574374467" name="precision" value="12"/>
<annotation id="72ec3247-a20a-45e0-9af0-1ae7b19c00ec" attributeId="80012e89-bfcb-4a45-baaa-6dcffb74cb25" name="scale" value="4"/>
</attribute>
<attribute id="a2048fc8-faad-4c3d-81a6-e80c703674cb" name="dealTime" columnName="deal_time" title="时间" type="datetime" default="" precision="" isArray="false">
<annotation id="66077d81-21a5-4ce9-ae0d-32d462149591" attributeId="a853defa-1f0e-4c27-a191-2d65000d5e98" name="length" value="50"/>
</attribute>
<attribute id="8617f0ae-bdbf-48ae-a6b5-193f80475015" name="dealYear" columnName="deal_year" title="年" type="int" default="" precision="" isArray="false">
<annotation id="0096f4d2-66d5-49bf-a6b6-b793932e2d70" attributeId="fca4df03-7330-47b1-8176-c12f1bec6f51" name="length" value="undefined"/>
</attribute>
<attribute id="71939286-e69c-4072-b095-af17fd4c6fa9" name="dealMonth" columnName="deal_month" title="月" type="int" default="" precision="" isArray="false">
<annotation id="1f68405e-e0f6-4ca0-905c-05819d5f88af" attributeId="456b9c8e-9320-481e-9d6d-189c883a08b8" name="length" value="undefined"/>
</attribute>
<attribute id="b5e38fb5-4787-45c1-acf7-c3476285d962" name="dealDay" columnName="deal_day" title="日" type="int" default="" precision="" isArray="false">
<annotation id="6110584c-b2c7-4a2a-8646-ae9213119bab" attributeId="a245cb05-5b68-47cd-b220-b6a74b7778ae" name="length" value="undefined"/>
</attribute>
<attribute id="2b86b77e-ee14-4406-b0c6-2c327fc1f632" name="totalMargin" columnName="total_margin" title="保证金总额" type="fixnum" default="" precision="" isArray="false">
<annotation id="f60ce068-bfa9-461c-9b1b-c3df0fc43c1e" attributeId="b371ca0e-f47a-4625-99bb-08e9cec26c63" name="length" value="100"/>
<annotation id="1dd05817-03f4-4891-a6d3-58566527fc96" attributeId="2345f8e9-ebb1-42e2-8902-9cbb4cd30d11" name="precision" value="12"/>
<annotation id="129a3b4c-bc4e-4eea-8256-01b7bd3f03b3" attributeId="d22267f9-f62f-4df7-b238-af98a7c600da" name="scale" value="4"/>
</attribute>
<attribute id="8fa8d9f7-b9d9-4b05-9002-b8832a76ddaf" name="marginRefund" columnName="margin_refund" title="保证金退款额" type="fixnum" default="" precision="" isArray="false">
<annotation id="9bc9258d-0965-4215-968c-5d402bb00af7" attributeId="184aa4cc-2f91-44f4-abeb-ade6eca0d6f5" name="length" value="100"/>
<annotation id="0282d7c3-b8a4-484e-9a5f-19c264739f02" attributeId="ed6f6520-045c-4ef9-b73c-02df304faeb8" name="precision" value="12"/>
<annotation id="b3e1654e-43b7-442f-a39e-38a692542f64" attributeId="c131a126-c624-432f-b88f-b36bdd94e2fb" name="scale" value="4"/>
</attribute>
<hibernate>/xyst.dinas.statistics/src/main/resources/config/AdvancePaymentAndBalanceSummary.hbm.xml</hibernate>
</dataModel>
</content>
</model>
<model>
<header>
<type>bcp.type.DataModel</type>
<package>com.xyst.dinas.statistics.datamodel</package>
<title>销售汇总</title>
<name>SalesSummary</name>
<tags/>
<description/>
<templateName>mk.ide.ui.editor.data.model.template.bill</templateName>
<tablePrefix>xyst_dinas_</tablePrefix>
</header>
<content>
<dataModel id="b7d206d6-8ae9-4c21-880d-2487e9162545" multiVersion="" domainInherit="undefined" tableName="xyst_dinas_statistics_sale_summary">
<attribute id="1f580264-2863-451d-ad02-8d12e7d59495" name="id" title="id" type="uuid" default="" precision="" isArray="false">
<annotation id="b5496d4e-1fd7-4bfe-87bb-fcae6bc97684" attributeId="1b73d291-3000-4d04-8436-6c425639db3e" name="required" value="true">
</annotation>
</attribute>
<attribute id="b776206f-5143-4e0b-a4ef-08bfc30ce3b8" name="project" columnName="project_id" title="项目" type="com.xyst.dinas.project.datamodel.ProjectFiled" default="" precision="" isArray="false">
<annotation id="75a146e2-2f0a-43c8-a448-53cb8e4928f1" attributeId="6607f219-26fc-4064-ae3f-6e1597a3366c" name="length" value="undefined"/>
<annotation id="d5e4f9ca-09fd-4d6c-b5e4-f24be0b69ad8" attributeId="e25ed725-4290-412c-92ea-3f647f674baf" name="mappingType" value="many-to-one"/>
</attribute>
<attribute id="8d37a49f-3be8-48e0-a110-fe0f4a3a3c5e" name="purchaseSandUnit" columnName="purchase_sand_unit_id" title="购砂单位" type="com.xyst.dinas.project.datamodel.PurchaseSandCompany" default="" precision="" isArray="false">
<annotation id="964ad081-5d47-4e64-8300-8fa09b339e30" attributeId="60827f07-2bf8-41fb-a15e-faa969633862" name="length" value="undefined"/>
<annotation id="aa8f9deb-7536-4546-8e01-e39e5c2deca5" attributeId="86198a2a-7592-4bb2-8553-b9efddcd0a99" name="mappingType" value="many-to-one"/>
</attribute>
<attribute id="72b22178-e4d0-45ea-bd6a-81f413eff469" name="station" columnName="station_id" title="场站" type="com.xyst.dinas.biz.datamodel.Station" default="" precision="" isArray="false">
<annotation id="07147992-595e-4afa-9448-7e359ee02db1" attributeId="c33d838d-fb8a-451d-ae4b-267794814550" name="length" value="undefined"/>
<annotation id="fd560b12-10ac-4c39-98a0-6d67028506e4" attributeId="854369c4-c793-41c8-bd49-cb9c22382d9a" name="mappingType" value="many-to-one"/>
</attribute>
<attribute id="6cb8ac5f-e6d6-4c87-a7e5-9fbfccff0424" name="dinasType" columnName="dinas_type_id" title="砂石种类" type="com.xyst.dinas.biz.datamodel.DinasType" default="" precision="" isArray="false">
<annotation id="717981ba-fc5b-45c2-bb07-69c2fe4f09b7" attributeId="184ef511-9298-47f3-ab8c-7fb2f1c31ef2" name="length" value="undefined"/>
<annotation id="4e6383ed-1d31-4452-ba44-a36460181e17" attributeId="a4576f0e-797e-4c98-b879-0934e185400f" name="mappingType" value="many-to-one"/>
</attribute>
<attribute id="72e3edfb-f932-4bca-b961-fd8eaeb2bb1f" name="saleDealAmount" columnName="sale_deal_amount" title="销量(吨)" type="fixnum" default="" precision="" isArray="false">
<annotation id="f064456e-7cb2-44d1-94cc-69a8603c840e" attributeId="187273e2-c45b-447b-ac67-d3a3159b9441" name="length" value="100"/>
<annotation id="189b193a-7b6e-4938-b3c8-302550c5b523" attributeId="6a095832-6511-4928-97c7-f9db52895169" name="precision" value="12"/>
<annotation id="a1f9c824-8133-422d-a7bf-f6780ff73f0e" attributeId="1820884b-3b4b-4ad9-a57c-628f923ebc51" name="scale" value="4"/>
</attribute>
<attribute id="a82a3104-c5fc-44f5-b429-77555952c6cf" name="saleAmount" columnName="sale_amount" title="销量额" type="fixnum" default="" precision="" isArray="false">
<annotation id="8abab331-fe6c-4467-8c10-db83903c33b1" attributeId="5de1618d-af2c-4920-b13a-40e1636415b9" name="length" value="100"/>
<annotation id="751c0b70-7019-41c0-b37c-c701efb2fc06" attributeId="8df16be8-2516-46f4-a66a-c9569684c654" name="precision" value="12"/>
<annotation id="df7d5098-343a-4902-b79c-d4a80c2e6ab8" attributeId="b43afea0-a421-42b9-bafb-bcedf77f8467" name="scale" value="4"/>
</attribute>
<attribute id="f01adf22-fc33-4409-bcd7-730ab91155e0" name="dealTime" columnName="deal_time" title="销售时间" type="datetime" default="" precision="" isArray="false">
<annotation id="c53b1b2e-0bad-440c-970f-e46583ec982e" attributeId="f98b8e24-2506-42d4-979b-3003a8e9c6b2" name="length" value="50"/>
</attribute>
<attribute id="cc8122be-7459-4a56-a27b-2bde38f3f489" name="dealYear" columnName="deal_year" title="年" type="int" default="" precision="" isArray="false">
<annotation id="a6bef8dd-d6cf-4a26-ac43-5ac8dbeb5a4e" attributeId="81c1b369-42f6-4ea1-a23c-3d43d26de67f" name="length" value="undefined"/>
</attribute>
<attribute id="e58dab22-a14d-4289-8790-cf566f8c9099" name="dealMonth" columnName="deal_month" title="月" type="int" default="" precision="" isArray="false">
<annotation id="ee59273e-81e7-44c9-91b2-69842aaa18ae" attributeId="3ac21bf3-8d63-4686-8569-e3f4d7a4e711" name="length" value="undefined"/>
</attribute>
<attribute id="211d0538-d149-44e9-9b8b-23c72bcddb25" name="dealDay" columnName="deal_day" title="日" type="int" default="" precision="" isArray="false">
<annotation id="cbad948e-1391-4cc6-9203-742bc0142aa4" attributeId="9c3f03d0-91d5-4a5d-8433-5befad02d34b" name="length" value="undefined"/>
</attribute>
<hibernate>/xyst.dinas.statistics/src/main/resources/config/SalesSummary.hbm.xml</hibernate>
</dataModel>
</content>
</model>
# Auto Configure
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
com.xyst.dinas.statistics.config.StatisticsConfiguration
\ 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/bcp-type">
<specification>1.0</specification>
<id>b7d206d6-8ae9-4c21-880d-2487e9162545</id>
<name>com.xyst.dinas.statistics.datamodel.SalesSummary</name>
<title>销售汇总</title>
<define>bcp.type.Class</define>
<define-version>1.0</define-version>
<dependency>javax.persistence.Entity</dependency>
<dependency>javax.persistence.ManyToOne</dependency>
<dependency>com.xyst.dinas.biz.datamodel.DinasType</dependency>
<dependency>bcp.type.constraint.Numeric</dependency>
<dependency>javax.persistence.JoinColumn</dependency>
<dependency>javax.persistence.OneToMany</dependency>
<dependency>bcp.type.constraint.NotNull</dependency>
<dependency>com.xyst.dinas.project.datamodel.PurchaseSandCompany</dependency>
<dependency>javax.persistence.Column</dependency>
<dependency>javax.persistence.Table</dependency>
<dependency>com.xyst.dinas.biz.datamodel.Station</dependency>
<dependency>com.xyst.dinas.project.datamodel.ProjectFiled</dependency>
<dependency>javax.persistence.Id</dependency>
<content>
<m:class>
<m:annotations>
<m:annotation>
<m:type>javax.persistence.Entity</m:type>
</m:annotation>
<m:annotation>
<m:type>javax.persistence.Table</m:type>
<m:properties>
<m:property>
<m:key>name</m:key>
<m:value>xyst_dinas_statistics_sale_summary</m:value>
</m:property>
</m:properties>
</m:annotation>
</m:annotations>
<m:parents/>
<m:attributes>
<m:attribute>
<m:annotations>
<m:annotation>
<m:type>bcp.type.constraint.NotNull</m:type>
</m:annotation>
<m:annotation>
<m:type>javax.persistence.Id</m:type>
</m:annotation>
<m:annotation>
<m:type>javax.persistence.Column</m:type>
<m:properties>
<m:property>
<m:key>name</m:key>
<m:value>id</m:value>
</m:property>
<m:property>
<m:key>length</m:key>
<m:value>16</m:value>
</m:property>
</m:properties>
</m:annotation>
</m:annotations>
<m:id>1f580264-2863-451d-ad02-8d12e7d59495</m:id>
<m:name>id</m:name>
<m:title>id</m:title>
<m:type>uuid</m:type>
<m:description></m:description>
<m:default></m:default>
</m:attribute>
<m:attribute>
<m:annotations>
<m:annotation>
<m:type>javax.persistence.ManyToOne</m:type>
</m:annotation>
<m:annotation>
<m:type>javax.persistence.JoinColumn</m:type>
<m:properties>
<m:property>
<m:key>name</m:key>
<m:value>project_id</m:value>
</m:property>
<m:property>
<m:key>referencedColumnName</m:key>
<m:value>ID</m:value>
</m:property>
</m:properties>
</m:annotation>
</m:annotations>
<m:id>b776206f-5143-4e0b-a4ef-08bfc30ce3b8</m:id>
<m:name>project</m:name>
<m:title>项目</m:title>
<m:type>com.xyst.dinas.project.datamodel.ProjectFiled</m:type>
<m:description></m:description>
<m:default></m:default>
</m:attribute>
<m:attribute>
<m:annotations>
<m:annotation>
<m:type>javax.persistence.ManyToOne</m:type>
</m:annotation>
<m:annotation>
<m:type>javax.persistence.JoinColumn</m:type>
<m:properties>
<m:property>
<m:key>name</m:key>
<m:value>purchase_sand_unit_id</m:value>
</m:property>
<m:property>
<m:key>referencedColumnName</m:key>
<m:value>ID</m:value>
</m:property>
</m:properties>
</m:annotation>
</m:annotations>
<m:id>8d37a49f-3be8-48e0-a110-fe0f4a3a3c5e</m:id>
<m:name>purchaseSandUnit</m:name>
<m:title>购砂单位</m:title>
<m:type>com.xyst.dinas.project.datamodel.PurchaseSandCompany</m:type>
<m:description></m:description>
<m:default></m:default>
</m:attribute>
<m:attribute>
<m:annotations>
<m:annotation>
<m:type>javax.persistence.ManyToOne</m:type>
</m:annotation>
<m:annotation>
<m:type>javax.persistence.JoinColumn</m:type>
<m:properties>
<m:property>
<m:key>name</m:key>
<m:value>station_id</m:value>
</m:property>
<m:property>
<m:key>referencedColumnName</m:key>
<m:value>ID</m:value>
</m:property>
</m:properties>
</m:annotation>
</m:annotations>
<m:id>72b22178-e4d0-45ea-bd6a-81f413eff469</m:id>
<m:name>station</m:name>
<m:title>场站</m:title>
<m:type>com.xyst.dinas.biz.datamodel.Station</m:type>
<m:description></m:description>
<m:default></m:default>
</m:attribute>
<m:attribute>
<m:annotations>
<m:annotation>
<m:type>javax.persistence.ManyToOne</m:type>
</m:annotation>
<m:annotation>
<m:type>javax.persistence.JoinColumn</m:type>
<m:properties>
<m:property>
<m:key>name</m:key>
<m:value>dinas_type_id</m:value>
</m:property>
<m:property>
<m:key>referencedColumnName</m:key>
<m:value>ID</m:value>
</m:property>
</m:properties>
</m:annotation>
</m:annotations>
<m:id>6cb8ac5f-e6d6-4c87-a7e5-9fbfccff0424</m:id>
<m:name>dinasType</m:name>
<m:title>砂石种类</m:title>
<m:type>com.xyst.dinas.biz.datamodel.DinasType</m:type>
<m:description></m:description>
<m:default></m:default>
</m:attribute>
<m:attribute>
<m:annotations>
<m:annotation>
<m:type>bcp.type.constraint.Numeric</m:type>
<m:properties>
<m:property>
<m:key>precision</m:key>
<m:value>12</m:value>
</m:property>
<m:property>
<m:key>scale</m:key>
<m:value>4</m:value>
</m:property>
</m:properties>
</m:annotation>
<m:annotation>
<m:type>javax.persistence.Column</m:type>
<m:properties>
<m:property>
<m:key>name</m:key>
<m:value>sale_deal_amount</m:value>
</m:property>
</m:properties>
</m:annotation>
</m:annotations>
<m:id>72e3edfb-f932-4bca-b961-fd8eaeb2bb1f</m:id>
<m:name>saleDealAmount</m:name>
<m:title>销量(吨)</m:title>
<m:type>fixnum</m:type>
<m:description></m:description>
<m:default></m:default>
</m:attribute>
<m:attribute>
<m:annotations>
<m:annotation>
<m:type>bcp.type.constraint.Numeric</m:type>
<m:properties>
<m:property>
<m:key>precision</m:key>
<m:value>12</m:value>
</m:property>
<m:property>
<m:key>scale</m:key>
<m:value>4</m:value>
</m:property>
</m:properties>
</m:annotation>
<m:annotation>
<m:type>javax.persistence.Column</m:type>
<m:properties>
<m:property>
<m:key>name</m:key>
<m:value>sale_amount</m:value>
</m:property>
</m:properties>
</m:annotation>
</m:annotations>
<m:id>a82a3104-c5fc-44f5-b429-77555952c6cf</m:id>
<m:name>saleAmount</m:name>
<m:title>销量额</m:title>
<m:type>fixnum</m:type>
<m:description></m:description>
<m:default></m:default>
</m:attribute>
<m:attribute>
<m:annotations>
<m:annotation>
<m:type>javax.persistence.Column</m:type>
<m:properties>
<m:property>
<m:key>name</m:key>
<m:value>deal_time</m:value>
</m:property>
</m:properties>
</m:annotation>
</m:annotations>
<m:id>f01adf22-fc33-4409-bcd7-730ab91155e0</m:id>
<m:name>dealTime</m:name>
<m:title>销售时间</m:title>
<m:type>datetime</m:type>
<m:description></m:description>
<m:default></m:default>
</m:attribute>
<m:attribute>
<m:annotations>
<m:annotation>
<m:type>javax.persistence.Column</m:type>
<m:properties>
<m:property>
<m:key>name</m:key>
<m:value>deal_year</m:value>
</m:property>
</m:properties>
</m:annotation>
</m:annotations>
<m:id>cc8122be-7459-4a56-a27b-2bde38f3f489</m:id>
<m:name>dealYear</m:name>
<m:title></m:title>
<m:type>int</m:type>
<m:description></m:description>
<m:default></m:default>
</m:attribute>
<m:attribute>
<m:annotations>
<m:annotation>
<m:type>javax.persistence.Column</m:type>
<m:properties>
<m:property>
<m:key>name</m:key>
<m:value>deal_month</m:value>
</m:property>
</m:properties>
</m:annotation>
</m:annotations>
<m:id>e58dab22-a14d-4289-8790-cf566f8c9099</m:id>
<m:name>dealMonth</m:name>
<m:title></m:title>
<m:type>int</m:type>
<m:description></m:description>
<m:default></m:default>
</m:attribute>
<m:attribute>
<m:annotations>
<m:annotation>
<m:type>javax.persistence.Column</m:type>
<m:properties>
<m:property>
<m:key>name</m:key>
<m:value>deal_day</m:value>
</m:property>
</m:properties>
</m:annotation>
</m:annotations>
<m:id>211d0538-d149-44e9-9b8b-23c72bcddb25</m:id>
<m:name>dealDay</m:name>
<m:title></m:title>
<m:type>int</m:type>
<m:description></m:description>
<m:default></m:default>
</m:attribute>
</m:attributes>
</m:class>
</content>
</metadata>
<?xml version="1.0" encoding="UTF-8"?>
<metadata xmlns="http://www.beecode.cn/schema/amino-metadata">
<specification>1.0</specification>
<id>6955f0bb-c150-4151-9b1b-553ae896106a</id>
<name>com.xyst.dinas.statistics.statisticsquery.PaymentDetailsAdvQuery</name>
<title>回款明细</title>
<description>回款明细</description>
<define>advanced.query.template</define>
<define-version>1.0</define-version>
<content>
<template>
<sql-type>SQL</sql-type>
<sql>
SELECT
artificialRecharge.id as id,
artificialRecharge.createTime AS createTime,
purchaseSandCompanyon.name AS purchaseSandUnit,
projectFiled.projectName AS project,
CASE
WHEN artificialRecharge.fundType ='DEPOSIT' then '保证金充值'
ELSE '预付款充值'
END
as fundType,
artificialRecharge.rechargeAmount AS rechargeAmount,
'' AS actualRefundAmount,
artificialRecharge.remark AS remark
FROM
ArtificialRecharge as artificialRecharge
LEFT JOIN PurchaseSandCompany as purchaseSandCompanyon on purchaseSandCompanyon.id = artificialRecharge.purchaseSandUnit
LEFT JOIN ProjectFiled AS projectFiled ON projectFiled.id = artificialRecharge.project
UNION ALL
SELECT
expenseAdjust.id as id,
expenseAdjust.createTime AS createTime,
purchaseSandCompanyon.name AS purchaseSandUnit,
projectFiled.projectName AS project,
CASE
WHEN expenseAdjust.fundType ='DEPOSIT' then '保证金费用调整'
ELSE '预付款费用调整'
END
as fundType,
CASE
WHEN expenseAdjust.expenseAdjustAmount &gt;= '0' THEN
expenseAdjust.expenseAdjustAmount ELSE ''
END AS expenseAdjustAmount,
CASE
WHEN expenseAdjust.expenseAdjustAmount &lt; '0'
THEN (- expenseAdjust.expenseAdjustAmount) ELSE ''
END AS actualRefundAmount,
expenseAdjust.remark AS remark
FROM
ExpenseAdjust as expenseAdjust
LEFT JOIN PurchaseSandCompany as purchaseSandCompanyon on purchaseSandCompanyon.id = expenseAdjust.purchaseSandUnit
LEFT JOIN ProjectFiled AS projectFiled ON projectFiled.id = expenseAdjust.project
UNION ALL
SELECT
financeRefund.id as id,
financeRefund.createTime AS createTime,
purchaseSandCompanyon.name AS purchaseSandUnit,
projectFiled.projectName AS project,
CASE
WHEN financeRefund.fundType ='1' THEN '保证金退费'
ELSE '预付款退费'
END
as fundType,
'' AS rechargeAmount,
financeRefund.actualRefundAmount AS actualRefundAmount,
financeRefund.refundExplain AS remark
FROM
FinanceRefund as financeRefund
LEFT JOIN PurchaseSandCompany as purchaseSandCompanyon on purchaseSandCompanyon.id = financeRefund.purchaseSandCompany
LEFT JOIN ProjectFiled AS projectFiled ON projectFiled.id = financeRefund.project
ORDER BY createTime DESC
</sql>
</template>
</content>
</metadata>
<?xml version="1.0" encoding="UTF-8"?>
<metadata xmlns="http://www.beecode.cn/schema/amino-metadata">
<specification>1.0</specification>
<id>e22370f8-8226-4711-a996-764db3360dff</id>
<name>com.xyst.dinas.statistics.statisticsquery.PaymentDetailsQueryView</name>
<title>回款明细</title>
<description>回款明细</description>
<define>advanced.query.view</define>
<define-version>1.0</define-version>
<content>
<view>
{
"name": "回款明细",
"title": "回款明细",
"description": "回款明细",
"actions": [],
"scenes" : {
"isShowScenes" : true
},
"fuzzySearch": [
],
"isShowTabCountZero": true,
"groups": [
{
"name": "all",
"title": "全部",
"content": {
"datasource": "com.xyst.dinas.statistics.statisticsquery.PaymentDetailsAdvQuery"
}
}
],
"content": {
"isShowView": "table",
"datasource": "com.xyst.dinas.statistics.statisticsquery.PaymentDetailsAdvQuery",
"arguments": {
"items": [
]
},
"actions": [
],
"table": {
"selectType": "MULTI",
"serialNumber": "series",
"pageSize": 10,
"orders":[
],
"expand": false,
"columns": [
{
"type": "VALUE",
"title": "id",
"key": "id",
"columnType": {
"name" : "inner",
"data": {
"selected": true
}
}
},
{
"type": "VALUE",
"title": "时间",
"key": "createTime",
"columnType": {
"name": "select",
"data": {
"selected": true
}
}
},
{
"type": "VALUE",
"title": "购砂单位",
"key": "purchaseSandUnit",
"columnType": {
"name": "select",
"data": {
"selected": true
}
}
},
{
"type": "VALUE",
"title": "项目名称",
"key": "project",
"columnType": {
"name": "select",
"data": {
"selected": true
}
}
},
{
"type": "VALUE",
"title": "资金类型",
"key": "fundType",
"columnType": {
"name": "select",
"data": {
"selected": true
}
}
},
{
"type": "VALUE",
"title": "收款金额",
"key": "rechargeAmount",
"columnType": {
"name": "select",
"data": {
"selected": true
}
}
},
{
"type": "VALUE",
"title": "退款金额",
"key": "actualRefundAmount",
"columnType": {
"name": "select",
"data": {
"selected": true
}
}
},
{
"type": "VALUE",
"title": "备注",
"key": "remark",
"columnType": {
"name": "select",
"data": {
"selected": true
}
}
}
]
}
}
}
</view>
</content>
</metadata>
<?xml version="1.0" encoding="UTF-8"?>
<hibernate-mapping xmlns="http://www.hibernate.org/xsd/hibernate-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.hibernate.org/xsd/hibernate-mapping
http://www.hibernate.org/xsd/hibernate-mapping/hibernate-mapping-4.0.xsd">
<class entity-name="com.xyst.dinas.statistics.datamodel.AdvancePaymentAndBalanceSummary" table="xyst_dinas_statistics_advancepayment_Balance_summary" optimistic-lock="version">
<tuplizer entity-mode="dynamic-map" class="com.beecode.bcp.store.hibernate.KObjectEntityTuplizer"/>
<id name="id" type="uuid-binary" column="id" length="16">
<generator class="uuid2"/>
</id>
<many-to-one name="project" entity-name="com.xyst.dinas.project.datamodel.ProjectFiled" fetch="select">
<column name="project_id" not-null="false"/>
</many-to-one>
<many-to-one name="regionalCompany" entity-name="com.xyst.dinas.biz.datamodel.xystOrganization" fetch="select">
<column name="regional_company_id" not-null="false"/>
</many-to-one>
<many-to-one name="purchaseSandUnit" entity-name="com.xyst.dinas.project.datamodel.PurchaseSandCompany" fetch="select">
<column name="purchase_sand_unit_id" not-null="false"/>
</many-to-one>
<property name="lastYearAdvance" type="big_decimal" not-null="false">
<column name="last_year_advance" precision="12" scale="4"/>
</property>
<property name="paymentSales" type="big_decimal" not-null="false">
<column name="payment_sales" precision="12" scale="4"/>
</property>
<property name="totalAdvancePayment" type="big_decimal" not-null="false">
<column name="total_advance_payment" precision="12" scale="4"/>
</property>
<property name="advancePaymentRefundAmount" type="big_decimal" not-null="false">
<column name="advance_payment_refund_amount" precision="12" scale="4"/>
</property>
<property name="advanceBalance" type="big_decimal" not-null="false">
<column name="advance_balance" precision="12" scale="4"/>
</property>
<property name="dealTime" type="timestamp" not-null="false">
<column name="deal_time"/>
</property>
<property name="dealYear" type="integer" not-null="false">
<column name="deal_year"/>
</property>
<property name="dealMonth" type="integer" not-null="false">
<column name="deal_month"/>
</property>
<property name="dealDay" type="integer" not-null="false">
<column name="deal_day"></column>
</property>
<property name="totalMargin" type="big_decimal" not-null="false">
<column name="total_margin" precision="12" scale="4"/>
</property>
<property name="marginRefund" type="big_decimal" not-null="false">
<column name="margin_refund" precision="12" scale="4"/>
</property>
</class>
</hibernate-mapping>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<hibernate-mapping xmlns="http://www.hibernate.org/xsd/hibernate-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.hibernate.org/xsd/hibernate-mapping
http://www.hibernate.org/xsd/hibernate-mapping/hibernate-mapping-4.0.xsd">
<class entity-name="com.xyst.dinas.statistics.datamodel.SalesSummary" table="xyst_dinas_statistics_sale_summary" optimistic-lock="version">
<tuplizer entity-mode="dynamic-map" class="com.beecode.bcp.store.hibernate.KObjectEntityTuplizer"/>
<id name="id" type="uuid-binary" column="id" length="16">
<generator class="uuid2" />
</id>
<many-to-one name="project" entity-name="com.xyst.dinas.project.datamodel.ProjectFiled" fetch="select">
<column name="project_id" not-null="false"/>
</many-to-one>
<many-to-one name="purchaseSandUnit" entity-name="com.xyst.dinas.project.datamodel.PurchaseSandCompany" fetch="select">
<column name="purchase_sand_unit_id" not-null="false"/>
</many-to-one>
<many-to-one name="station" entity-name="com.xyst.dinas.biz.datamodel.Station" fetch="select">
<column name="station_id" not-null="false"/>
</many-to-one>
<many-to-one name="dinasType" entity-name="com.xyst.dinas.biz.datamodel.DinasType" fetch="select">
<column name="dinas_type_id" not-null="false"/>
</many-to-one>
<property name="saleDealAmount" type="big_decimal" not-null="false">
<column name="sale_deal_amount" precision="12" scale="4"></column>
</property>
<property name="saleAmount" type="big_decimal" not-null="false">
<column name="sale_amount" precision="12" scale="4"></column>
</property>
<property name="dealTime" type="timestamp" not-null="false">
<column name="deal_time"></column>
</property>
<property name="dealYear" type="integer" not-null="false">
<column name="deal_year"></column>
</property>
<property name="dealMonth" type="integer" not-null="false">
<column name="deal_month"></column>
</property>
<property name="dealDay" type="integer" not-null="false">
<column name="deal_day"></column>
</property>
</class>
</hibernate-mapping>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context"
xmlns:util="http://www.springframework.org/schema/util" xmlns:jee="http://www.springframework.org/schema/jee"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.0.xsd
http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-4.0.xsd">
<!-- 数据库映射 -->
<bean id="dataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="${jdbc.driverClassName}" />
<property name="url" value="${jdbc.url}" />
<property name="username" value="${jdbc.user}" />
<property name="password" value="${jdbc.pass}" />
</bean>
<bean id="sessionFactory"
class="com.beecode.bcp.store.hibernate.HibernateSessionFactoryBean"
scope="metadata" lazy-init="true">
<property name="dataSource" ref="dataSource" />
<property name="mappingLocations">
<list>
<value>classpath*:/**/*.hbm.xml</value>
</list>
</property>
<property name="packagesToScan">
<list>
<value>com.beecode.amino.test.war.entity</value>
<value>com.beecode.inz.authmgr.**.*</value>
<value>com.beecode.bap.scheduler.entity</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.hbm2ddl.auto">${hibernate.hbm2ddl.auto}</prop>
<prop key="hibernate.dialect">${hibernate.dialect}</prop>
<prop key="hibernate.show_sql">${hibernate.show_sql}</prop>
</props>
</property>
</bean>
<!-- 配置Hibernate事务管理器 -->
<bean id="transactionManager"
class="com.beecode.bcp.store.hibernate.HibernateTransactionManager">
<property name="sessionFactoryName" value="sessionFactory" />
</bean>
<!-- 配置Hibernate模板 -->
<bean id="hibernateOperations"
class="com.beecode.bcp.store.hibernate.HibernateTemplate">
<property name="sessionFactoryName" value="sessionFactory" />
</bean>
<!-- 配置事务异常封装 -->
<bean id="persistenceExceptionTranslationPostProcessor"
class="org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor" />
</beans>
\ No newline at end of file
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