Commit 5d9ab311 by 谢明辉

Merge branch 'develop' of http://192.168.9.26/platform/finance_serv into develop

2 parents 60e3bbc6 c6433d9d
Showing 19 changed files with 779 additions and 152 deletions
......@@ -81,6 +81,17 @@
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.1.2</version>
</dependency>
<dependency>
<groupId>net.sf.json-lib</groupId>
<artifactId>json-lib</artifactId>
<version>2.4</version>
<classifier>jdk15</classifier>
</dependency>
</dependencies>
<build>
......
......@@ -9,7 +9,7 @@ import org.springframework.context.annotation.ComponentScan;
@SpringBootApplication
@MapperScan(basePackages="com.vion.financial.mapper")
@ComponentScan(basePackages="com.vion.financial")
@ComponentScan(basePackages="com.vion.financial.*")
public class FinancialSystemApplication extends SpringBootServletInitializer {
public static void main(String[] args) {
......
package com.vion.financial.config;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
@Component
@ConfigurationProperties(prefix = "finance")
public class FinanceConfig {
private String authurl;
public String getAuthurl() {
return authurl;
}
public void setAuthurl(String authurl) {
this.authurl = authurl;
}
}
......@@ -52,7 +52,7 @@ public class ContractController extends BaseController {
return contractService.queryList();
}
@GetMapping
@GetMapping()
@ResponseBody
public Object queryByCondition(SelectVo selectVo) {
return contractService.selectByCondition(selectVo);
......
......@@ -4,6 +4,7 @@ import java.util.List;
import org.springframework.transaction.annotation.Transactional;
import com.vion.financial.vo.ContractVo;
import com.vion.financial.vo.SelectVo;
......@@ -19,5 +20,5 @@ public interface ContractMapper {
public List<ContractVo> selectByCondition(SelectVo selectVo);
public boolean isDelete(String contract_unid);
public int countNumber();
}
......@@ -16,10 +16,10 @@
<if test="county != null and county != ''">
,county
</if>
<if test="guarantee_period != null and guarantee_period != ''">
<if test="guarantee_period != null">
,guarantee_period
</if>
<if test="sign_date != null and sign_date != ''">
<if test="sign_date != null">
,sign_date
</if>
<if test="product_line_type != null and product_line_type != ''">
......@@ -274,31 +274,37 @@
</delete>
<select id="selectByCondition" parameterType="com.vion.financial.vo.SelectVo" resultType="com.vion.financial.vo.ContractVo">
select contract_unid, salesperson_unid, province, city, county,
select
contract_unid, salesperson_unid, province, city, county,
guarantee_period, sign_date, product_line_type, contract_state,
contract_type, contract_amount, deduct_amount, contract_amount_note,
stop_amount, reback_note, exemptions_amount, contract_remain_note,
is_archive, bad_amount, bad_amount_note, confirm_income_amount,
contract_type, cast(contract_amount as decimal(18,2)), cast(deduct_amount as decimal(18,2)), contract_amount_note,
cast(stop_amount as decimal(18,2)), reback_note, cast(exemptions_amount as decimal(18,2)), contract_remain_note,
is_archive, cast(bad_amount as decimal(18,2)), bad_amount_note, cast(confirm_income_amount as decimal(18,2)),
amount_state_unid, start_guarantee_date, end_guarantee_date,
mainten_start_point, contract_note, is_delete, project_unid,
customer_unid,
(select total_reback_view.sum from total_reback_view where total_reback_view.contract_unid=tb_contract.contract_unid) as total_reback_amount,
(contract_amount-(select total_reback_view.sum from total_reback_view where total_reback_view.contract_unid=tb_contract.contract_unid)-deduct_amount-stop_amount-exemptions_amount-bad_amount) as contract_remain,
(select total_recv_amount_view.total_recv_amount from total_recv_amount_view where tb_contract.contract_unid=total_recv_amount_view.contract_unid) as total_receive_amount ,
((select total_recv_amount_view.total_recv_amount from total_recv_amount_view where tb_contract.contract_unid=total_recv_amount_view.contract_unid)-(select total_reback_view.sum from total_reback_view where total_reback_view.contract_unid=tb_contract.contract_unid)-deduct_amount-stop_amount-exemptions_amount-bad_amount) as total_amount_remain ,
(select over_days_view.over_days from over_days_view where over_days_view.contract_unid=tb_contract.contract_unid) as over_days
(cast(contract_amount 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)-cast(deduct_amount as decimal(18,2))-cast(stop_amount as decimal(18,2))-cast(exemptions_amount as decimal(18,2))-cast(bad_amount as decimal(18,2))) as contract_remain,
(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 ,
((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)-(select cast(total_reback_view.sum as decimal(18,2)) from total_reback_view where total_reback_view.contract_unid=tb_contract.contract_unid)-(cast(deduct_amount as decimal(18,2)))-(cast(stop_amount as decimal(18,2)))-(cast(exemptions_amount as decimal(18,2)))-(cast(bad_amount as decimal(18,2)))) as total_amount_remain ,
(select over_days_view.over_days from over_days_view where over_days_view.contract_unid=tb_contract.contract_unid) as over_days,
(select tb_project.project_name from tb_project where tb_project.project_unid=tb_contract.project_unid) as project_name,
(select tb_customer.customer_name from tb_customer where tb_customer.customer_unid=tb_contract.customer_unid) as customer_name
from tb_contract where 1=1
<if test="salesperson_name__like !=null and salesperson_name__like !=''">
<if test="salesperson_unids !=null">
and
salesperson_unid like #{salesperson_name__like}
salesperson_unid in
<foreach collection="salesperson_unids" index="index" item="salesperson_unid" open="(" close=")" separator=",">
#{salesperson_unid}
</foreach>
</if>
<if test="project_name__like !=null and project_name__like !=''">
and
project_unid like #{project_name__like}
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
customer_unid like #{customer_name__like}
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
......@@ -312,17 +318,17 @@
and
county=#{county}
</if>
<if test="guarantee_period !=null">
<if test="guarantee_period !=null and guarantee_period !=0">
and
guarantee_period=#{guarantee_period}
</if>
<if test="year !=null and year !=''">
and
to_char(sign_date,"yyyy")=#{year}
to_char(sign_date,'yyyy')=#{year}
</if>
<if test="month !=null and month!=''">
and
to_char(sign_date,"MM")=#{month}
to_char(sign_date,'MM')=#{month}
</if>
<if test="product_line_type !=null and product_line_type !=''">
and
......@@ -348,7 +354,7 @@
and
confirm_income_amount=#{confirm_income_amount}
</if>
<if test="amount_state_unid !=null">
<if test="amount_state_unid !=null and amount_state_unid !=''">
and
amount_state_unid=#{amount_state_unid}
</if>
......@@ -356,18 +362,19 @@
and
#{start_date} <![CDATA[<=]]> sign_date and sign_date <![CDATA[<=]]> #{end_date}
</if>
<if test="amount_point !=null">
<if test="amount_point !=null and amount_point !=0.0">
and
contract_amount <![CDATA[>=]]> #{amount_point}
</if>
<if test="overdays_point !=null">
<if test="overdays_point !=null and overdays_point !=0">
and
<!--逾期天数-->contract_unid in (select over_days_view.contract_unid from over_days_view where over_days <![CDATA[>=]]> #{overdays_point})
</if>
<if test="leave_amount_point !=null">
<if test="leave_amount_point !=null and leave_amount_point !=0.0">
<!--应收款余额-->and
contract_unid in (select receive_amount_view.contract_unid from receive_amount_view where receive_amount_view.leave_amount_point <![CDATA[>=]]> #{leave_amount_point})
</if>
and is_delete=false
<if test="limit !=null and offset !=null">
limit #{limit} offset #{offset}
</if>
......@@ -378,4 +385,7 @@
<select id="queryList" resultType="String">
select contract_unid from tb_contract
</select>
<select id="countNumber" resultType="int">
select count(contract_unid) from tb_contract where is_delete=false
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.vion.financial.mapper.PaymentAgreeMapper">
<insert id="addPaymentAgree" parameterType="com.vion.financial.entity.PaymentAgree">
insert into tb_payment_agree (
contract_unid,
<if test="payment_type !=null and payment_type !=''">
payment_type,
</if>
<if test="payment_progress !=null and payment_progress !=''">
payment_progress,
</if>
<if test="days !=null and days !=''">
days,
</if>
<if test="payment_propority !=null and payment_propority !=''">
payment_propority,
</if>
<if test="payment_requirement !=null and payment_requirement !=''">
payment_requirement
</if>
)
values(
#{contract_unid},
<if test="payment_type !=null and payment_type !=''">
#{payment_type},
</if>
<if test="payment_progress !=null and payment_progress !=''">
#{payment_progress},
</if>
<if test="days !=null and days !=''">
#{days},
</if>
<if test="payment_propority !=null and payment_propority !=''">
#{payment_propority},
</if>
<if test="payment_requirement !=null and payment_requirement !=''">
#{payment_requirement}
</if>
)
</insert>
<update id="updatePaymentAgree" parameterType="com.vion.financial.entity.PaymentAgree">
update tb_payment_agree set
contract_unid=#{contract_unid},
<if test="payment_type != null and payment_type !=''">
payment_type = #{payment_type} ,
</if>
<if test="payment_progress !=null and payment_progress !=''">
payment_progress = #{payment_progress} ,
</if>
<if test="days !=null and days !=''">
days = #{days} ,
</if>
<if test="payment_propority !=null and payment_propority !=''">
payment_propority = #{payment_propority} ,
</if>
<if test="payment_requirement !=null and payment_requirement !=''">
payment_requirement = #{payment_requirement}
</if>
where payment_unid = #{payment_unid}
</update>
<select id="queryPaymentAgree" parameterType="String" resultType="com.vion.financial.entity.PaymentAgree">
select * from tb_payment_agree where contract_unid = #{contract_unid}
</select>
<delete id="deletePaymentAgree" parameterType="int">
delete from tb_payment_agree where payment_unid = #{payment_unid}
</delete>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.vion.financial.mapper.PaymentAgreeMapper">
<insert id="addPaymentAgree" parameterType="com.vion.financial.entity.PaymentAgree">
insert into tb_payment_agree (
contract_unid,
<if test="payment_type !=null and payment_type !=''">
payment_type,
</if>
<if test="payment_progress !=null and payment_progress !=''">
payment_progress,
</if>
<if test="days !=null and days !=''">
days,
</if>
<if test="payment_propority !=null and payment_propority !=''">
payment_propority,
</if>
<if test="payment_requirement !=null and payment_requirement !=''">
payment_requirement
</if>
)
values(
#{contract_unid},
<if test="payment_type !=null and payment_type !=''">
#{payment_type},
</if>
<if test="payment_progress !=null and payment_progress !=''">
#{payment_progress},
</if>
<if test="days !=null and days !=''">
#{days},
</if>
<if test="payment_propority !=null and payment_propority !=''">
#{payment_propority},
</if>
<if test="payment_requirement !=null and payment_requirement !=''">
#{payment_requirement}
</if>
)
</insert>
<update id="updatePaymentAgree" parameterType="com.vion.financial.entity.PaymentAgree">
update tb_payment_agree set
contract_unid=#{contract_unid},
<if test="payment_type != null and payment_type !=''">
payment_type = #{payment_type} ,
</if>
<if test="payment_progress !=null and payment_progress !=''">
payment_progress = #{payment_progress} ,
</if>
<if test="days !=null and days !=''">
days = #{days} ,
</if>
<if test="payment_propority !=null and payment_propority !=''">
payment_propority = #{payment_propority} ,
</if>
<if test="payment_requirement !=null and payment_requirement !=''">
payment_requirement = #{payment_requirement}
</if>
where payment_unid = #{payment_unid}
</update>
<select id="queryPaymentAgree" parameterType="String" resultType="com.vion.financial.entity.PaymentAgree">
select payment_unid,contract_unid,payment_type,payment_progress,days,cast(payment_propority as decimal(18,2)),payment_requirement from tb_payment_agree where contract_unid = #{contract_unid}
</select>
<delete id="deletePaymentAgree" parameterType="int">
delete from tb_payment_agree where payment_unid = #{payment_unid}
</delete>
</mapper>
\ No newline at end of file
......@@ -2,64 +2,76 @@ package com.vion.financial.service.imp;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.vion.financial.config.FinanceConfig;
import com.vion.financial.entity.Appendix;
import com.vion.financial.mapper.AppendixMapper;
import com.vion.financial.mapper.ContractMapper;
import com.vion.financial.mapper.PaymentAgreeMapper;
import com.vion.financial.service.ContractService;
import com.vion.financial.utils.HttpNetClient;
import com.vion.financial.utils.JavaBean2Json;
import com.vion.financial.vo.ContractVo;
import com.vion.financial.vo.FailCode;
import com.vion.financial.vo.ResultVo;
import com.vion.financial.vo.SelectVo;
import com.vion.financial.vo.SuccessCode;
import net.sf.json.JSONObject;
@Service
public class ContractServiceImpl implements ContractService {
Logger logger = LoggerFactory.getLogger(ContractServiceImpl.class);
Logger logger = LoggerFactory.getLogger(ContractServiceImpl.class);
@Autowired
ContractMapper contractMapper;
@Autowired
AppendixMapper appendixMapper;
@Autowired
PaymentAgreeMapper paymentAgreeMapper;
@Autowired
SuccessCode successCode;
@Autowired
FailCode failCode;
@Autowired
FinanceConfig financeConfig;
/***
* 新增合同信息
*/
@Override
public Object addOne(ContractVo contractVo) {
try {
//先插入合同信息
// 先插入合同信息
logger.info("============新增合同 start ============");
//根据附件unid集合更新附件表信息
// 根据附件unid集合更新附件表信息
Appendix appendix = new Appendix();
if(contractMapper.queryOne(contractVo.getContract_unid()) !=null) {
if (contractMapper.queryOne(contractVo.getContract_unid()) != null) {
contractMapper.updateOne(contractVo);
}else {
} else {
contractMapper.addOne(contractVo);
}
appendix.setBusiness_table("tb_contract");
appendix.setBusiness_unid(contractVo.getContract_unid());
for(int n:contractVo.getAppendix_unids()) {
for (int n : contractVo.getAppendix_unids()) {
appendix.setAppendix_unid(n);
appendixMapper.updateAppendix(appendix);
}
return successCode;
} catch (Exception e) {
e.printStackTrace();
logger.error("增加合同异常:"+e.getLocalizedMessage(), e);
logger.error("增加合同异常:" + e.getLocalizedMessage(), e);
failCode.setEcode("500");
failCode.setEnote("增加异常");
return failCode;
......@@ -70,17 +82,23 @@ public class ContractServiceImpl implements ContractService {
public Object queryOne(String s) {
try {
logger.info("================查询合同start===================");
ContractVo contractVo = contractMapper.queryOne(s);
Appendix appendix = new Appendix();
appendix.setBusiness_table("tb_contract");
appendix.setBusiness_unid(s);
List<Appendix> appendixs = appendixMapper.queryAppendixList(appendix);
contractVo.setAppendix_list(appendixs);
return contractVo;
if (contractMapper.isDelete(s)) {
ContractVo contractVo = contractMapper.queryOne(s);
Appendix appendix = new Appendix();
appendix.setBusiness_table("tb_contract");
appendix.setBusiness_unid(s);
List<Appendix> appendixs = appendixMapper.queryAppendixList(appendix);
contractVo.setAppendix_list(appendixs);
return contractVo;
} else {
failCode.setEcode("100");
failCode.setEnote("合同已删除");
return failCode;
}
} catch (Exception e) {
// TODO: handle exception
/* return failCode;*/
logger.error("查询合同异常"+e.getLocalizedMessage(),e);
/* return failCode; */
logger.error("查询合同异常" + e.getLocalizedMessage(), e);
e.printStackTrace();
failCode.setEcode("500");
failCode.setEnote("查询异常");
......@@ -96,14 +114,14 @@ public class ContractServiceImpl implements ContractService {
Appendix appendix = new Appendix();
appendix.setBusiness_table("tb_contract");
appendix.setBusiness_unid(vontractVo.getContract_unid());
for(int n:vontractVo.getAppendix_unids()) {
for (int n : vontractVo.getAppendix_unids()) {
appendix.setAppendix_unid(n);
appendixMapper.updateAppendix(appendix);
}
return successCode;
} catch (Exception e) {
// TODO: handle exception
logger.error("修改合同异常"+e.getLocalizedMessage(), e);
logger.error("修改合同异常" + e.getLocalizedMessage(), e);
e.printStackTrace();
failCode.setEcode("500");
failCode.setEnote("修改异常");
......@@ -115,11 +133,14 @@ public class ContractServiceImpl implements ContractService {
public Object deleteOne(String s) {
try {
logger.info("=================删除合同=================");
//contractMapper.updateSingleContract(contractVo);
Appendix appendix = new Appendix();
appendix.setBusiness_unid(s);
// contractMapper.updateSingleContract(contractVo);
contractMapper.deleteOne(s);
appendixMapper.deleteAppendix(appendix);
return successCode;
} catch (Exception e) {
logger.error("删除合同异常"+e.getLocalizedMessage(),e);
logger.error("删除合同异常" + e.getLocalizedMessage(), e);
e.printStackTrace();
failCode.setEcode("500");
failCode.setEnote("删除异常");
......@@ -139,7 +160,7 @@ public class ContractServiceImpl implements ContractService {
return contractMapper.queryList();
} catch (Exception e) {
// TODO: handle exception
logger.error("查询合同列表异常"+e.getLocalizedMessage(),e);
logger.error("查询合同列表异常" + e.getLocalizedMessage(), e);
e.printStackTrace();
failCode.setEcode("500");
failCode.setEnote("查询异常");
......@@ -151,16 +172,49 @@ public class ContractServiceImpl implements ContractService {
public Object selectByCondition(SelectVo selectVo) {
// TODO Auto-generated method stub
try {
ResultVo resultVo=new ResultVo();
logger.info("========================筛选合同列表===========================");
List<ContractVo> list=new ArrayList<ContractVo>();
for(ContractVo contractVo:contractMapper.selectByCondition(selectVo)) {
List<Map> list_data = null;
if (StringUtils.isNotBlank(selectVo.getSalesperson_name__like())) {
// 调用auth服务的接口获取用户列表信息
String url = financeConfig.getAuthurl();
String result = HttpNetClient.doGet(url+"?username="+selectVo.getSalesperson_name__like(), null);
Map map = JavaBean2Json.Json2JavaBean(result, Map.class);
list_data = (List<Map>) map.get("list_data");
if(list_data != null && list_data.size() > 0) {
List<String> salesperson_unids = new ArrayList<String>(list_data.size());
for(Map _map:list_data) {
salesperson_unids.add((String) _map.get("user_unid"));
}
selectVo.setSalesperson_unids(salesperson_unids);
}else {
resultVo.setList_data(new ArrayList<>());
resultVo.setList_size(selectVo.getLimit()== null ? 0 : selectVo.getLimit());
resultVo.setOffset(selectVo.getOffset()== null ? 0 : selectVo.getOffset());
resultVo.setTotal_number(0);
return resultVo;
}
}
List<ContractVo> list = contractMapper.selectByCondition(selectVo);
for (ContractVo contractVo : list) {
contractVo.setPaymentAgree_list(paymentAgreeMapper.queryPaymentAgree(contractVo.getContract_unid()));
list.add(contractVo);
if(list_data != null && list_data.size() > 0) {
for(Map _map:list_data) {
if (contractVo.getSalesperson_unid().equals(_map.get("user_unid"))) {
contractVo.setSalesperson_name((String) _map.get("name"));
}
}
}
}
return list;
resultVo.setList_data(list);
resultVo.setList_size(selectVo.getLimit());
resultVo.setOffset(selectVo.getOffset());
resultVo.setTotal_number(contractMapper.countNumber());
return resultVo;
} catch (Exception e) {
// TODO: handle exception
logger.error("筛选合同列表异常"+e.getLocalizedMessage(),e);
logger.error("筛选合同列表异常" + e.getLocalizedMessage(), e);
failCode.setEcode("500");
failCode.setEnote("筛选异常");
return failCode;
......
......@@ -39,7 +39,7 @@ public class DeliverGoodsServiceImpl implements DeliverGoodsService {
try {
Appendix appendix = new Appendix();
logger.info("=====================增加发货信息=====================");
if((boolean)contractService.isDelete(s)) {
if(!contractService.isDelete(s)) {
List<DeliverGoods> list=deliverGoodsVo.getList_deliver_data();
for(DeliverGoods deliverGoods:list) {
deliverGoods.setContract_unid(s);
......@@ -73,7 +73,7 @@ public class DeliverGoodsServiceImpl implements DeliverGoodsService {
deliverGoodsVo.setList_deliver_data(new ArrayList());
Appendix appendix = null;
logger.info("========================查询发货信息========================");
if(contractService.isDelete(s)) {
if(!contractService.isDelete(s)) {
List<DeliverGoods> list=deliverGoodsMapper.queryDeliverGoods(s);
for(DeliverGoods deliverGoods:list) {
appendix = new Appendix();
......@@ -105,7 +105,7 @@ public class DeliverGoodsServiceImpl implements DeliverGoodsService {
try {
Appendix appendix=null;
logger.info("===========================修改发货信息===========================");
if(contractService.isDelete(s)) {
if(!contractService.isDelete(s)) {
List<DeliverGoods> list_deliver_data=deliverGoodsVo.getList_deliver_data();
for(DeliverGoods deliverGoods:list_deliver_data) {
deliverGoodsMapper.updateDeliverGoods(deliverGoods);
......@@ -138,7 +138,7 @@ public class DeliverGoodsServiceImpl implements DeliverGoodsService {
try {
logger.info("=========================删除合同发货信息=======================");
Appendix appendix=null;
if(contractService.isDelete(s)) {
if(!contractService.isDelete(s)) {
for(int deliverUnid :deliverGoodsVo.getDeliver_unids()) {
deliverGoodsMapper.deleteDeliverGoods(deliverUnid);
appendix=new Appendix();
......
......@@ -31,7 +31,7 @@ public class PaymentAgreeServiceImpl implements PaymentAgreeService {
public Object addPaymentAgree(PaymentAgreeVo paymentAgreeVo,String s) {
try {
logger.info("==============增加付款约定信息===================");
if((boolean) contractServiceImpl.isDelete(s)) {
if(! contractServiceImpl.isDelete(s)) {
List<PaymentAgree> list = paymentAgreeVo.getList_payment_data();
for(PaymentAgree paymentAgree:list) {
paymentAgree.setContract_unid(s);
......@@ -56,7 +56,7 @@ public class PaymentAgreeServiceImpl implements PaymentAgreeService {
public Object queryPaymentAgree(String s) {
try {
logger.info("===============查询付款约定信息start=====================");
if((boolean) contractServiceImpl.isDelete(s)) {
if(! contractServiceImpl.isDelete(s)) {
return paymentAgreeMapper.queryPaymentAgree(s);
}
failCode.setEcode("100");
......@@ -77,7 +77,7 @@ public class PaymentAgreeServiceImpl implements PaymentAgreeService {
try {
logger.info("==============修改付款约定信息===================");
if((boolean) contractServiceImpl.isDelete(s)) {
if(! contractServiceImpl.isDelete(s)) {
List<PaymentAgree> list = paymentAgreeVo.getList_payment_data();
for(PaymentAgree paymentAgree:list) {
paymentAgree.setContract_unid(s);
......@@ -103,7 +103,7 @@ public class PaymentAgreeServiceImpl implements PaymentAgreeService {
// TODO Auto-generated method stub
try {
logger.info("==============删除付款约定信息===================");
if((boolean) contractServiceImpl.isDelete(s)) {
if(! contractServiceImpl.isDelete(s)) {
List<PaymentAgree> list = paymentAgreeVo.getList_payment_data();
for(PaymentAgree paymentAgree:list) {
paymentAgree.setContract_unid(s);
......
......@@ -39,7 +39,7 @@ public class ProjectAcceptancServiceImpl implements ProjectAcceptancService {
try {
Appendix appendix = new Appendix();
logger.info("=====================增加合同验收信息=====================");
if((boolean)contractService.isDelete(s)) {
if(!contractService.isDelete(s)) {
List<ProjectAcceptanc> list=projectAcceptancVo.getList_check_data();
for(ProjectAcceptanc projectAcceptanc:list) {
projectAcceptanc.setContract_unid(s);
......@@ -74,7 +74,7 @@ public class ProjectAcceptancServiceImpl implements ProjectAcceptancService {
projectAcceptancVo.setList_check_data(new ArrayList());
Appendix appendix = null;
logger.info("========================查询合同验收信息========================");
if(contractService.isDelete(s)) {
if(!contractService.isDelete(s)) {
List<ProjectAcceptanc> list=projectAcceptancMapper.queryProjectAcceptanc(s);
for(ProjectAcceptanc projectAcceptanc:list) {
appendix = new Appendix();
......@@ -106,7 +106,7 @@ public class ProjectAcceptancServiceImpl implements ProjectAcceptancService {
try {
logger.info("===========================修改合同验收信息===========================");
Appendix appendix=null;
if(contractService.isDelete(s)) {
if(!contractService.isDelete(s)) {
List<ProjectAcceptanc> list=projectAcceptancVo.getList_check_data();
for(ProjectAcceptanc projectAcceptanc:list) {
projectAcceptanc.setContract_unid(s);
......@@ -140,7 +140,7 @@ public class ProjectAcceptancServiceImpl implements ProjectAcceptancService {
try {
logger.info("===========================删除合同验收信息===========================");
Appendix appendix =null;
if(contractService.isDelete(s)) {
if(!contractService.isDelete(s)) {
List<Integer> list=projectAcceptancVo.getAcceptanc_unids();
for(int n:list) {
projectAcceptancMapper.deleteProjectAcceptanc(n);
......
......@@ -31,7 +31,7 @@ public class ReceiptServiceImpl implements ReceiptService {
// TODO Auto-generated method stub
try {
logger.info("=====================增加合同开票信息=====================");
if((boolean) contractServiceImpl.isDelete(s)) {
if(! contractServiceImpl.isDelete(s)) {
List<Receipt> list=receiptVo.getList_receipt_data();
for(Receipt receipt: list) {
receipt.setContract_unid(s);
......@@ -56,7 +56,7 @@ public class ReceiptServiceImpl implements ReceiptService {
// TODO Auto-generated method stub
try {
logger.info("========================查询合同开票信息=======================");
if((boolean)contractServiceImpl.isDelete(s)) {
if(!contractServiceImpl.isDelete(s)) {
return receiptMapper.queryReceipt(s);
}else {
failCode.setEcode("100");
......@@ -76,7 +76,7 @@ public class ReceiptServiceImpl implements ReceiptService {
// TODO Auto-generated method stub
try {
logger.info("===================修改合同开票信息========================");
if((boolean)contractServiceImpl.isDelete(s)) {
if(!contractServiceImpl.isDelete(s)) {
List<Receipt> list=receiptVo.getList_receipt_data();
for(Receipt receipt:list) {
receipt.setContract_unid(s);
......@@ -102,7 +102,7 @@ public class ReceiptServiceImpl implements ReceiptService {
// TODO Auto-generated method stub
try {
logger.info("=========================删除合同开票信息=======================");
if((boolean)contractServiceImpl.isDelete(s)) {
if(!contractServiceImpl.isDelete(s)) {
List<Receipt> list=receiptVo.getReceipt_unids();
for(Receipt receiptUnid :list) {
receiptMapper.deleteReceipt(receiptUnid.getReceipt_unid());
......
......@@ -33,7 +33,7 @@ public class ReturnInfoServiceImpl implements ReturnInfoService {
// TODO Auto-generated method stub
try {
logger.info("==============增加合同回款信息===================");
if((boolean) contractServiceImpl.isDelete(s)) {
if(! contractServiceImpl.isDelete(s)) {
List<ReturnInfo> list = returnInfoVo.getList_reback_data();
for(ReturnInfo returnInfo:list) {
returnInfo.setContract_unid(s);
......@@ -59,7 +59,7 @@ public class ReturnInfoServiceImpl implements ReturnInfoService {
// TODO Auto-generated method stub
try {
logger.info("===============查询回款信息=====================");
if((boolean) contractServiceImpl.isDelete(s)){
if(!contractServiceImpl.isDelete(s)){
return returnInfoMapper.queryReturnInfo(s);
}else {
failCode.setEcode("100");
......@@ -80,7 +80,7 @@ public class ReturnInfoServiceImpl implements ReturnInfoService {
// TODO Auto-generated method stub
try {
logger.info("==============修改回款信息===================");
if((boolean) contractServiceImpl.isDelete(s)) {
if(! contractServiceImpl.isDelete(s)) {
List<ReturnInfo> list = returnInfoVo.getList_reback_data();
for(ReturnInfo returnInfo:list) {
returnInfo.setContract_unid(s);
......@@ -106,7 +106,7 @@ public class ReturnInfoServiceImpl implements ReturnInfoService {
// TODO Auto-generated method stub
try {
logger.info("==============删除回款信息===================");
if((boolean) contractServiceImpl.isDelete(s)) {
if(!contractServiceImpl.isDelete(s)) {
List<ReturnInfo> list = paymentAgreeVo.getReback_unids();
for(ReturnInfo returnInfo:list) {
returnInfo.setContract_unid(s);
......
package com.vion.financial.utils;
import java.io.IOException;
import java.nio.charset.Charset;
import java.util.Map;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpResponse;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpDelete;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.methods.HttpPut;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.util.EntityUtils;
public class HttpNetClient {
public static String doGet(String url,String atoken) {
String result = "";
HttpResponse response;
if (url != null && url.length() != 0) {
HttpGet httpGet = new HttpGet(url);
httpGet.setHeader("Accept-Encoding", "gzip, deflate");
httpGet.setHeader("Accept-Language", "zh-CN");
httpGet.setHeader("Accept",
"application/json, application/xml, text/html, text/*, image/*, */*");
httpGet.setHeader("authorization",atoken);
try {
response = new DefaultHttpClient().execute(httpGet);
if (response != null) {
int statusCode = response.getStatusLine().getStatusCode();
if (statusCode == 200 || statusCode == 403) {
result = EntityUtils.toString(response.getEntity());
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
return result;
}
public static String doPost(String url, String msg,String authorization) {
HttpResponse response;
String result = "";
if (url != null && url.length() != 0) {
HttpPost post = new HttpPost(url);
//post.setHeader("Accept-Encoding", "gzip, deflate");
//post.setHeader("Accept-Language", "zh-CN");
post.setHeader("Accept","application/json, application/xml, text/html, text/*, image/*, */*");
post.setHeader("Content-type", "application/json; charset=utf-8");
if(StringUtils.isNotBlank(authorization)){
post.setHeader("authorization", authorization);
}
DefaultHttpClient client = new DefaultHttpClient();
try {
StringEntity se = new StringEntity(msg,String.valueOf(Charset.forName("utf-8")));
se.setContentEncoding("UTF-8");
se.setContentType("application/json");
post.setEntity(se);
response = client.execute(post);
System.out.println("response:" + response);
if (response != null) {
int statusCode = response.getStatusLine().getStatusCode();
//if (statusCode == 200 || statusCode == 403) {
result = EntityUtils.toString(response.getEntity());
//}
}
}catch (Exception e) {
e.printStackTrace();
}
}
return result;
}
public static String doPut(String url, String msg) {
String result = "";
if (url != null && url.length() > 0) {
StringBuilder sb = new StringBuilder();;
HttpPut request = new HttpPut(url);
String sck = sb.toString();
if (sck.length() > 0) {
request.setHeader("Cookie", sck);
}
request.setHeader("Accept-Encoding", "gzip, deflate");
request.setHeader("Accept-Language", "zh-CN");
request.setHeader("Accept",
"application/json, application/xml, text/html, text/*, image/*, */*");
DefaultHttpClient client = new DefaultHttpClient();
HttpResponse response;
try {
StringEntity se = new StringEntity(msg,String.valueOf(Charset.forName("utf-8")));
se.setContentEncoding("UTF-8");
request.setEntity(se);
response = client.execute(request);
if (response != null) {
int statusCode = response.getStatusLine().getStatusCode();
if (statusCode == 200 || statusCode == 403) {
result = EntityUtils.toString(response.getEntity());
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
return result;
}
public static String doDelete(String url) {
HttpResponse response;
String result = "";
if (url != null && url.length() != 0) {
HttpDelete delete = new HttpDelete(url);
delete.setHeader("Accept-Encoding", "gzip, deflate");
delete.setHeader("Accept-Language", "zh-CN");
delete.setHeader("Accept",
"application/json, application/xml, text/html, text/*, image/*, */*");
try {
response = new DefaultHttpClient().execute(delete);
if (response != null) {
int statusCode = response.getStatusLine().getStatusCode();
if (statusCode == 200 || statusCode == 403) {
result = EntityUtils.toString(response.getEntity());
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
return result;
}
public static String getAuthority(String url,String authorization,String msg) throws ClientProtocolException, IOException{
//参数+解决中文乱码问题
StringEntity entity = new StringEntity(msg, String.valueOf(Charset.forName("UTF-8")));
entity.setContentEncoding("UTF-8");
entity.setContentType("application/json");
HttpPost post = new HttpPost(url);
post.setHeader("authorization", authorization);
post.setEntity(entity);
HttpClient client = new DefaultHttpClient();
HttpResponse response = client.execute(post);
String result="";
if (response != null) {
int statusCode = response.getStatusLine().getStatusCode();
result = EntityUtils.toString(response.getEntity());
Map map = JavaBean2Json.Json2JavaBean(result, Map.class);
map.put("responseStatusCode", statusCode);
result = JavaBean2Json.javaBean2Json(map);
}
return result;
}
}
package com.vion.financial.utils;
import java.beans.BeanInfo;
import java.beans.IntrospectionException;
import java.beans.Introspector;
import java.beans.PropertyDescriptor;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import net.sf.json.JsonConfig;
import net.sf.json.util.PropertyFilter;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
public class JavaBean2Json {
public static String javaBean2Json(Object obj) {
return JSONObject.fromObject(obj,getJsonConfig()).toString();
}
public static <T> T Json2JavaBean(String json,Class<T> clas) {
try {
ObjectMapper om = new ObjectMapper();
om.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
return om.readValue(json, clas);
} catch (Exception e) {
JSONObject jsb = new JSONObject();
return (T) jsb.toBean(JSONObject.fromObject(json), clas, getJsonConfig());
}
}
/**
* json转List
* @param json
* @param clazz
* @param <T>
* @return
*/
public static <T> List<T> json2List(String json,Class<T> clazz) {
if(json.startsWith("[")){//json.indexOf("[")==0
JSONArray array = JSONArray.fromObject(json);
List<T> list = JSONArray.toList(array, clazz);
return list;
}
return null;
}
/**
* json转Array
* @param json
* @param clazz
* @param <T>
* @return
*/
public static <T> T[] json2Array(String json,Class<T> clazz) {
if(json.indexOf("[")==0){
JSONArray array = JSONArray.fromObject(json);
T[] ray = (T[]) JSONArray.toArray(array, clazz);
return ray;
}
return null;
}
private static JsonConfig getJsonConfig(){
JsonConfig jsonConfig = new JsonConfig();
jsonConfig.setJsonPropertyFilter(new PropertyFilter() {
public boolean apply(Object source/* 属性的拥有者 */, String name /* 属性名字 */,Object value/* 属性值 */) {
if(value instanceof List){
List<Object> list = (List<Object>) value;
if (list == null || list.size()==0) {
return true;
}
}else if(value instanceof Map){
Map map = (Map) value;
if (map == null || map.size() == 0) {
return true;
}
}
return null == value || "".equals(value);
}
});
return jsonConfig;
}
public static void jsonToMap(String json, Map map) {
JSONObject jsonObject = JSONObject.fromObject(json);
populate(jsonObject, map);
}
private static void populate(JSONObject jsonObject, Map map) {
for (Iterator iterator = jsonObject.entrySet().iterator(); iterator
.hasNext();) {
String entryStr = String.valueOf(iterator.next());
String key = entryStr.substring(0, entryStr.indexOf("="));
String value = entryStr.substring(entryStr.indexOf("=") + 1,entryStr.length());
if (jsonObject.get(key).getClass().equals(JSONObject.class)) {
HashMap _map = new HashMap();
map.put(key, _map);
populate(jsonObject.getJSONObject(key), ((Map) (_map)));
} else if (jsonObject.get(key).getClass().equals(JSONArray.class)) {
ArrayList list = new ArrayList();
map.put(key, list);
populateArray(jsonObject.getJSONArray(key), list);
} else {
map.put(key, jsonObject.get(key));
}
}
}
private static void populateArray(JSONArray jsonArray, List list) {
for (int i = 0; i < jsonArray.size(); i++)
if (jsonArray.get(i).getClass().equals(JSONArray.class)) {
ArrayList _list = new ArrayList();
list.add(_list);
populateArray(jsonArray.getJSONArray(i), _list);
} else if (jsonArray.get(i).getClass().equals(JSONObject.class)) {
HashMap _map = new HashMap();
list.add(_map);
populate(jsonArray.getJSONObject(i), _map);
} else {
list.add(jsonArray.get(i));
}
}
/***
* 判断客户端发过来的信息是否是json格式
*
* @param json
* @return
*/
public static boolean isJson(String json) {
try {
JSONObject.fromObject(json);
return true;
} catch (Exception e) {
return false;
}
}
@SuppressWarnings("rawtypes")
public static <T> T convertMap(Class<T> type, Map map)
throws IntrospectionException, IllegalAccessException,
InstantiationException, InvocationTargetException {
BeanInfo beanInfo = Introspector.getBeanInfo(type); // 获取类属性
T obj = (T) type.newInstance(); // 创建 JavaBean 对象
// 给 JavaBean 对象的属性赋值
PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors();
for (int i = 0; i< propertyDescriptors.length; i++) {
PropertyDescriptor descriptor = propertyDescriptors[i];
String propertyName = descriptor.getName();
if (map.containsKey(propertyName)) {
// 下面一句可以 try 起来,这样当一个属性赋值失败的时候就不会影响其他属性赋值。
try {
Object value = map.get(propertyName);
Object[] args = new Object[1];
args[0] = value;
descriptor.getWriteMethod().invoke(obj, args);
} catch (IllegalArgumentException e) {
}
}
}
return obj;
}
}
package com.vion.financial.vo;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
@JsonInclude(value=Include.NON_NULL)
public class ResultVo {
private Integer total_number;
private Integer list_size;
private Integer offset;
List<ContractVo> list_data;
public Integer getTotal_number() {
return total_number;
}
public void setTotal_number(Integer total_number) {
this.total_number = total_number;
}
public Integer getList_size() {
return list_size;
}
public void setList_size(Integer list_size) {
this.list_size = list_size;
}
public Integer getOffset() {
return offset;
}
public void setOffset(Integer offset) {
this.offset = offset;
}
public List<ContractVo> getList_data() {
return list_data;
}
public void setList_data(List<ContractVo> list_data) {
this.list_data = list_data;
}
}
package com.vion.financial.vo;
import java.util.Date;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
......@@ -13,24 +14,172 @@ public class SelectVo {
private String province; //所属省份
private String city; //所属市
private String county; //所属县
private int guarantee_period; //保质周
private Integer guarantee_period; //保质周
private String year; //所属年份
private String month; //所属月份
private String product_line_type; //生产线类型
private String contract_state; //合同状态
private String contract_type; //合同性质
private String acceptanc_type; //验收类型
private boolean is_archive; //是否归档
private double confirm_income_amount; //确认收入金额
private Boolean is_archive; //是否归档
private Double confirm_income_amount; //确认收入金额
private String amount_state_unid; //账款状态
private Date start_date; //设置开始查询时间
private Date end_date; //设置结束时间
private double amount_point; //设置金额查询节点
private int overdays_point; //逾期天数查询节点
private double leave_amount_point; //账款余额查询节点
private int offset; //设置查询起始位置
private int limit; //设置每次查询条数
private Double amount_point; //设置金额查询节点
private Integer overdays_point; //逾期天数查询节点
private Double leave_amount_point; //账款余额查询节点
private Integer offset; //设置查询起始位置
private Integer limit; //设置每次查询条数
private List<String> salesperson_unids;
/*
* 查询条件
*/
public String getSalesperson_name__like() {
return salesperson_name__like;
}
public void setSalesperson_name__like(String salesperson_name__like) {
this.salesperson_name__like = salesperson_name__like;
}
public String getProject_name__like() {
return project_name__like;
}
public void setProject_name__like(String project_name__like) {
this.project_name__like = project_name__like;
}
public String getCustomer_name__like() {
return customer_name__like;
}
public void setCustomer_name__like(String customer_name__like) {
this.customer_name__like = customer_name__like;
}
public String getProvince() {
return province;
}
public void setProvince(String province) {
this.province = province;
}
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
public String getCounty() {
return county;
}
public void setCounty(String county) {
this.county = county;
}
public Integer getGuarantee_period() {
return guarantee_period;
}
public void setGuarantee_period(Integer guarantee_period) {
this.guarantee_period = guarantee_period;
}
public String getYear() {
return year;
}
public void setYear(String year) {
this.year = year;
}
public String getMonth() {
return month;
}
public void setMonth(String month) {
this.month = month;
}
public String getProduct_line_type() {
return product_line_type;
}
public void setProduct_line_type(String product_line_type) {
this.product_line_type = product_line_type;
}
public String getContract_state() {
return contract_state;
}
public void setContract_state(String contract_state) {
this.contract_state = contract_state;
}
public String getContract_type() {
return contract_type;
}
public void setContract_type(String contract_type) {
this.contract_type = contract_type;
}
public String getAcceptanc_type() {
return acceptanc_type;
}
public void setAcceptanc_type(String acceptanc_type) {
this.acceptanc_type = acceptanc_type;
}
public Boolean getIs_archive() {
return is_archive;
}
public void setIs_archive(Boolean is_archive) {
this.is_archive = is_archive;
}
public Double getConfirm_income_amount() {
return confirm_income_amount;
}
public void setConfirm_income_amount(Double confirm_income_amount) {
this.confirm_income_amount = confirm_income_amount;
}
public String getAmount_state_unid() {
return amount_state_unid;
}
public void setAmount_state_unid(String amount_state_unid) {
this.amount_state_unid = amount_state_unid;
}
public Date getStart_date() {
return start_date;
}
public void setStart_date(Date start_date) {
this.start_date = start_date;
}
public Date getEnd_date() {
return end_date;
}
public void setEnd_date(Date end_date) {
this.end_date = end_date;
}
public Double getAmount_point() {
return amount_point;
}
public void setAmount_point(Double amount_point) {
this.amount_point = amount_point;
}
public Integer getOverdays_point() {
return overdays_point;
}
public void setOverdays_point(Integer overdays_point) {
this.overdays_point = overdays_point;
}
public Double getLeave_amount_point() {
return leave_amount_point;
}
public void setLeave_amount_point(Double leave_amount_point) {
this.leave_amount_point = leave_amount_point;
}
public Integer getOffset() {
return offset;
}
public void setOffset(Integer offset) {
this.offset = offset;
}
public Integer getLimit() {
return limit;
}
public void setLimit(Integer limit) {
this.limit = limit;
}
public List<String> getSalesperson_unids() {
return salesperson_unids;
}
public void setSalesperson_unids(List<String> salesperson_unids) {
this.salesperson_unids = salesperson_unids;
}
}
......@@ -37,11 +37,15 @@ mybatis:
logging:
level:
root: INFO
root: DEBUG
pattern:
level: INFO
level: DEBUG
console: "[financial_serv]-[%d{yyyy-MM-dd HH:mm:ss.SSS}]-%m%n"
path: F:\LOG\
finance:
authurl: http://192.168.9.162:20080/api/v1/auth/users
#pagehelper:
# helperDialect: postgresql
# reasonable: true
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!