Commit 6b8d9ca7 by 王军业

【统计值】

1 parent 8e4fe85e
......@@ -113,4 +113,15 @@ public class ContractController extends BaseController {
return contractService.importExcel(file,ranke);
}
/**
* @Description: 总的合同金额,合同余额等统计
* @Param: [selectVo]
* @return: java.lang.Object
* @Date: 2019/1/16
*/
@GetMapping(value = "/totalCount")
@ResponseBody
public Object getTotalCount(SelectVo selectVo){
return contractService.selectByConditionAll(selectVo);
}
}
......@@ -18,6 +18,7 @@ public interface ContractMapper {
void deleteOne(String contract_unid);
List<String> queryList();
List<ContractVo> selectByCondition(SelectVo selectVo);
List<ContractVo> selectByConditionAll(SelectVo selectVo);
int count(SelectVo selectVo);
Boolean isDelete(String contract_unid);
List<ExportModel> exportContracts(SelectVo selectVo);
......
......@@ -751,6 +751,178 @@
</if>
</select>
<!--统计所有的符合条件的合同的某些项累加-->
<select id="selectByConditionAll" parameterType="com.vion.financial.vo.SelectVo" resultType="com.vion.financial.vo.ContractVo">
select
cast(CASE WHEN contract_amount IS null THEN 0 ELSE contract_amount END as decimal(18,2)) ,
(select cast(total_reback_view.sum as decimal(18,2)) from total_reback_view where total_reback_view.contract_unid=tb_contract.contract_unid) as total_reback_amount,
-- <!--(select cast(total_recv_amount_view.total_recv_amount as decimal(18,2)) from total_recv_amount_view where tb_contract.contract_unid=total_recv_amount_view.contract_unid) as total_receive_amount ,-->
(cast(CASE WHEN contract_amount IS NULL THEN 0 ELSE contract_amount END as decimal(18,2))-(select cast(CASE WHEN total_reback_view.sum IS NULL THEN 0 ELSE total_reback_view.sum END as decimal(18,2)) from total_reback_view where total_reback_view.contract_unid=tb_contract.contract_unid)-cast(CASE WHEN deduct_amount IS NULL THEN 0 ELSE deduct_amount end as decimal(18,2))-cast(CASE WHEN stop_amount IS NULL THEN 0 ELSE stop_amount END as decimal(18,2))
-cast(CASE WHEN exemptions_amount IS NULL THEN 0 ELSE exemptions_amount END as decimal(18,2))-cast(CASE WHEN bad_amount IS NULL THEN 0 ELSE bad_amount END as decimal(18,2))) as contract_remain,
(select receive_amount_view.leave_amount_point from receive_amount_view where receive_amount_view.contract_unid=tb_contract.contract_unid) as total_amount_remain
from tb_contract where 1=1
<if test="contract_unid !=null and contract_unid !=''">
and
contract_unid=#{contract_unid}
</if>
<if test="salesperson_unids !=null">
and
salesperson_unid in
<foreach collection="salesperson_unids" index="index" item="salesperson_unid" open="(" close=")" separator=",">
#{salesperson_unid}
</foreach>
</if>
<if test="amount_state_unids !=null and amount_state_unids.length > 0">
and
amount_state_unid in
<foreach collection="amount_state_unids" index="index" item="amount_state_unid_item" open="(" close=")" separator=",">
#{amount_state_unid_item}
</foreach>
</if>
<if test="contract_states !=null and contract_states.length > 0">
and
contract_state in
<foreach collection="contract_states" index="index" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
<if test="salesperson_unid_columns !=null and salesperson_unid_columns.length > 0">
and
salesperson_unid in
<foreach collection="salesperson_unid_columns" index="index" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
<if test="project_name__like !=null and project_name__like !=''">
and
tb_contract.project_unid in (select tb_project.project_unid from tb_project where project_name like '%'||#{project_name__like}||'%')
</if>
<if test="customer_name__like !=null and customer_name__like !=''">
and
tb_contract.customer_unid in (select tb_customer.customer_unid from tb_customer where customer_name like '%'||#{customer_name__like}||'%')
</if>
<if test="province !=null and province !=''">
and
province=#{province}
</if>
<if test="city !=null and city !=''">
and
city=#{city}
</if>
<if test="county !=null and county !=''">
and
county=#{county}
</if>
<if test="guarantee_period !=null ">
and
guarantee_period=#{guarantee_period}
</if>
<if test="year !=null and year !=''">
and
to_char(sign_date,'yyyy')=#{year}
</if>
<if test="month !=null and month!=''">
and
to_char(sign_date,'MM')=#{month}
</if>
<if test="product_line_type !=null and product_line_type !=''">
and
product_line_type=#{product_line_type}
</if>
<if test="contract_state !=null and contract_state !=''">
and
contract_state=#{contract_state}
</if>
<if test="contract_type !=null and contract_type !=''">
and
contract_type=#{contract_type}
</if>
<if test="final_user !=null ">
and
final_user=#{final_user}
</if>
<if test="relation_customer !=null and relation_customer !=''">
and
relation_customer=#{relation_customer}
</if>
<if test="first_industry !=null and first_industry !=''">
and
first_industry=#{first_industry}
</if>
<if test="second_industry !=null and second_industry !=''">
and
second_industry=#{second_industry}
</if>
<if test="final_user_name !=null and final_user_name !=''">
and
final_user_name=#{final_user_name}
</if>
<if test="relation_customer_name !=null and relation_customer_name !=''">
and
relation_customer_name=#{relation_customer_name}
</if>
<if test="first_industry_name !=null and first_industry_name !=''">
and
first_industry_name=#{first_industry_name}
</if>
<if test="second_industry_name !=null and second_industry_name !=''">
and
second_industry_name=#{second_industry_name}
</if>
<if test="is_archive !=null">
and
is_archive=#{is_archive}
</if>
<if test="acceptanc_type !=null and acceptanc_type !=''">
and
contract_unid in (select tb_project_acceptanc.contract_unid from tb_project_acceptanc where tb_project_acceptanc.acceptanc_type=#{acceptanc_type})
</if>
<if test="confirm_income_amount !=null">
and
confirm_income_amount=#{confirm_income_amount}
</if>
<if test="amount_state_unid !=null and amount_state_unid !=''">
and
amount_state_unid=#{amount_state_unid}
</if>
<if test="start_date != null and end_date !=null">
and
#{start_date,typeHandler=com.vion.financial.handler.MilliDateTypeHandler} <![CDATA[<=]]> sign_date and sign_date <![CDATA[<=]]> #{end_date,typeHandler=com.vion.financial.handler.MilliDateTypeHandler}
</if>
<if test="amount_start_point !=null ">
and
contract_amount <![CDATA[>=]]> #{amount_start_point}
</if>
<if test="amount_end_point !=null ">
and
contract_amount <![CDATA[<=]]> #{amount_end_point}
</if>
<if test="overdays_start_point !=null and overdays_end_point == null">
and
<!--逾期天数-->contract_unid in (select over_days_view.contract_unid from over_days_view where over_days <![CDATA[>=]]> #{overdays_start_point})
</if>
<if test="overdays_start_point !=null and overdays_end_point !=null ">
and
<!--逾期天数-->contract_unid in (select over_days_view.contract_unid from over_days_view where over_days <![CDATA[>=]]> #{overdays_start_point} and over_days <![CDATA[<=]]> #{overdays_end_point})
</if>
<if test="overdays_start_point ==null and overdays_end_point !=null">
contract_unid in (select over_days_view.contract_unid from over_days_view where over_days <![CDATA[<=]]> #{overdays_end_point})
</if>
<if test="leave_amount_start_point !=null ">
<!--应收款余额-->and
contract_unid in (select receive_amount_view.contract_unid from receive_amount_view where receive_amount_view.leave_amount_point <![CDATA[>=]]> #{leave_amount_start_point})
</if>
<if test="leave_amount_end_point !=null ">
and
contract_unid in (select receive_amount_view.contract_unid from receive_amount_view where receive_amount_view.leave_amount_point <![CDATA[<=]]> #{leave_amount_end_point})
</if>
and is_delete=false
and project_unid is not null
and customer_unid is not null
</select>
<!--end-->
<select id="exportContracts" parameterType="com.vion.financial.vo.SelectVo" resultType="com.vion.financial.excel.ExportModel">
select
......
......@@ -15,6 +15,7 @@ public interface ContractService {
Object queryList();
Boolean isDelete(String s);
Object selectByCondition(SelectVo selectVo);
Object selectByConditionAll(SelectVo selectVo);
void exportExcel(SelectVo selectVo,HttpServletResponse response);
Object importExcel(MultipartFile file,String ranke);
}
......@@ -347,6 +347,7 @@ public class ContractServiceImpl implements ContractService {
}
}
@Override
public Boolean isDelete(String s) {
return contractMapper.isDelete(s);
}
......@@ -459,6 +460,21 @@ public class ContractServiceImpl implements ContractService {
}
}
}
List<ContractVo> listAll = contractMapper.selectByConditionAll(selectVo);
Double contract_amount = 0.0; //合同金额
Double total_reback_amount = 0.0; //
Double contract_remain=0.0;
Double total_amount_remain=0.0;
for(ContractVo contractVo : listAll){
contract_amount += contractVo.getContract_amount();
total_reback_amount += contractVo.getTotal_reback_amount();
contract_remain += contractVo.getContract_remain();
total_amount_remain += contractVo.getTotal_amount_remain();
}
resultVo.setAllContractAmount(contract_amount);
resultVo.setAlltotalReBack(total_reback_amount);
resultVo.setAllRemainAmount(contract_remain);
resultVo.setAllReceiveAmount(total_amount_remain);
resultVo.setList_data(list);
resultVo.setList_size(list.size());
resultVo.setOffset(selectVo.getOffset());
......@@ -474,6 +490,32 @@ public class ContractServiceImpl implements ContractService {
}
@Override
public Object selectByConditionAll(SelectVo selectVo) {
// List<ContractVo> list = contractMapper.selectByConditionAll(selectVo);
// Map<String,Double> totalCountMap = new HashMap<>();
// Double contract_amount = 0.0; //合同金额
// Double total_reback_amount = 0.0; //
// Double contract_remain=0.0;
// Double total_amount_remain=0.0;
// for(ContractVo contractVo : list){
// contract_amount += contractVo.getContract_amount();
// total_reback_amount += contractVo.getTotal_reback_amount();
// contract_remain += contractVo.getContract_remain();
// total_amount_remain += contractVo.getTotal_amount_remain();
// }
// //总的合同金额
// totalCountMap.put("allContractAmount",0.0);
// //总的累计回款金额
// totalCountMap.put("alltotalReBack",0.0);
// //总的合同余额
// totalCountMap.put("allRemainAmount",0.0);
// //总的应收余额
// totalCountMap.put("allReceiveAmount",0.0);
// return totalCountMap;
return null;
}
@Override
public void exportExcel(SelectVo selectVo,HttpServletResponse response) {
logger.info("========================导出合同Excel表格===========================");
List<Map> list_data = null;
......
......@@ -10,6 +10,14 @@ public class ResultVo {
private Integer total_number;
private Integer list_size;
private Integer offset;
//总的合同金额
private Double allContractAmount;
//总的累计回款金额
private Double alltotalReBack;
//总的合同余额
private Double allRemainAmount;
//总的应收余额
private Double allReceiveAmount;
List<ContractVo> list_data;
public Integer getTotal_number() {
return total_number;
......@@ -36,5 +44,35 @@ public class ResultVo {
this.list_data = list_data;
}
public Double getAllContractAmount() {
return allContractAmount;
}
public void setAllContractAmount(Double allContractAmount) {
this.allContractAmount = allContractAmount;
}
public Double getAlltotalReBack() {
return alltotalReBack;
}
public void setAlltotalReBack(Double alltotalReBack) {
this.alltotalReBack = alltotalReBack;
}
public Double getAllRemainAmount() {
return allRemainAmount;
}
public void setAllRemainAmount(Double allRemainAmount) {
this.allRemainAmount = allRemainAmount;
}
public Double getAllReceiveAmount() {
return allReceiveAmount;
}
public void setAllReceiveAmount(Double allReceiveAmount) {
this.allReceiveAmount = allReceiveAmount;
}
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!