Commit 71852b7e by 杨清松

对账单明细接口

parent 07799ad6
......@@ -22,6 +22,7 @@ dependencies {
compile project(":xyst.dinas.biz")
compile project(":xyst.dinas.project")
compile project(":xyst.dinas.contract")
compile project(":xyst.dinas.sales")
testCompile lib.amino_boot_web
......
......@@ -4,16 +4,21 @@ import org.springframework.context.annotation.Bean;
import com.xyst.dinas.finance.dao.BankRechargeDetailDao;
import com.xyst.dinas.finance.dao.ExpenseAdjustDao;
import com.xyst.dinas.finance.dao.StatementAccountDao;
import com.xyst.dinas.finance.internal.dao.BankRechargeDetailDaoImpl;
import com.xyst.dinas.finance.internal.dao.ExpenseAdjustDaoImpl;
import com.xyst.dinas.finance.internal.dao.StatementAccountDaoImpl;
import com.xyst.dinas.finance.internal.service.BankRechargeDetailServiceImpl;
import com.xyst.dinas.finance.internal.service.ExpenseAdjustServiceImpl;
import com.xyst.dinas.finance.internal.service.StatementAccountServiceImpl;
import com.xyst.dinas.finance.processor.FinanceRefundProcessor;
import com.xyst.dinas.finance.service.BankRechargeDetailService;
import com.xyst.dinas.finance.service.ExpenseAdjustService;
import com.xyst.dinas.finance.service.StatementAccountService;
import com.xyst.dinas.finance.web.BankRechargeDetailController;
import com.xyst.dinas.finance.web.ExpenseAdjustController;
import com.xyst.dinas.finance.web.RefundController;
import com.xyst.dinas.finance.web.StatementAccountController;
public class FinanceConfiguration {
......@@ -57,5 +62,20 @@ public class FinanceConfiguration {
return new BankRechargeDetailDaoImpl();
}
@Bean
public StatementAccountController statementAccountController() {
return new StatementAccountController();
}
@Bean
public StatementAccountService statementAccountService() {
return new StatementAccountServiceImpl();
}
@Bean
public StatementAccountDao statementAccountDao() {
return new StatementAccountDaoImpl();
}
}
package com.xyst.dinas.finance.dao;
import java.util.List;
import java.util.UUID;
import com.beecode.bcp.type.KObject;
public interface StatementAccountDao {
List<KObject> queryStatementAccountByContractId(UUID contractId, String modelPath);
}
package com.xyst.dinas.finance.entity;
import java.math.BigDecimal;
public class StatementAccount {
private String dealDate;
private String dealType;
private BigDecimal dealAmount;
public String getDealDate() {
return dealDate;
}
public void setDealDate(String dealDate) {
this.dealDate = dealDate;
}
public String getDealType() {
return dealType;
}
public void setDealType(String dealType) {
this.dealType = dealType;
}
public BigDecimal getDealAmount() {
return dealAmount;
}
public void setDealAmount(BigDecimal dealAmount) {
this.dealAmount = dealAmount;
}
}
package com.xyst.dinas.finance.internal.dao;
import java.util.List;
import java.util.UUID;
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.beecode.bcp.type.KObject;
import com.mchange.v2.c3p0.stmt.StatementCache;
import com.xyst.dinas.finance.constant.ArtificialRechargeConstant;
import com.xyst.dinas.finance.dao.StatementAccountDao;
public class StatementAccountDaoImpl implements StatementAccountDao{
@Autowired
private HibernateOperations template;
@Override
public List<KObject> queryStatementAccountByContractId(UUID contractId, String modelPath) {
return (List<KObject>)template.execute(new HibernateCallback<List<KObject>>() {
@SuppressWarnings("unchecked")
@Override
public List<KObject> doInHibernate(Session session) throws HibernateException {
Query<KObject> query = session.createQuery("from " + modelPath + " where contract.id=:contractId", KObject.class);
query.setParameter("contractId", contractId);
List<KObject> resultList = query.getResultList();
return resultList;
}
});
}
}
package com.xyst.dinas.finance.internal.service;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import org.springframework.beans.factory.annotation.Autowired;
import com.beecode.bcp.type.KObject;
import com.beecode.inz.basis.team.pojo.ResponseObj;
import com.xyst.dinas.finance.constant.ArtificialRechargeConstant;
import com.xyst.dinas.finance.constant.ExpenseAdjustConstant;
import com.xyst.dinas.finance.constant.FinanceRefundConstant;
import com.xyst.dinas.finance.dao.StatementAccountDao;
import com.xyst.dinas.finance.entity.StatementAccount;
import com.xyst.dinas.finance.enumeration.FundTypeEnum;
import com.xyst.dinas.finance.service.StatementAccountService;
import com.xyst.dinas.sales.constant.SalesRecordConstant;
public class StatementAccountServiceImpl implements StatementAccountService{
@Autowired
private StatementAccountDao statementAccountDao;
@Override
public Object queryStatementAccountByContractId(UUID contractId) {
try {
List<KObject> artificialRechargeList = statementAccountDao.queryStatementAccountByContractId(contractId, ArtificialRechargeConstant.ENTITY);
List<StatementAccount> statementAccounts = new ArrayList<StatementAccount>();
//人工充值
if (artificialRechargeList.size() > 0) {
for (int i = 0; i < artificialRechargeList.size(); i++) {
KObject kObject = artificialRechargeList.get(i);
StatementAccount statementAccount = new StatementAccount();
if (kObject.getString("fundType").equals(FundTypeEnum.ADVANCE.name())) { //预付款
statementAccount.setDealType("预付款充值");
} else if (kObject.getString("fundType").equals(FundTypeEnum.DEPOSIT.name())){
statementAccount.setDealType("保证金充值");
}
statementAccount.setDealAmount(kObject.getBigDecimal("rechargeAmount"));
statementAccount.setDealDate(kObject.getString("createTime"));
statementAccounts.add(statementAccount);
}
}
//退费
List<KObject> financeRefundList = statementAccountDao.queryStatementAccountByContractId(contractId, FinanceRefundConstant.ENTITY);
if (financeRefundList.size() > 0) {
for (int i = 0; i < financeRefundList.size(); i++) {
KObject kObject = financeRefundList.get(i);
StatementAccount statementAccount = new StatementAccount();
if (kObject.getString("fundType").equals(FundTypeEnum.ADVANCE.name())) { //预付款
statementAccount.setDealType("预付款退费");
} else if (kObject.getString("fundType").equals(FundTypeEnum.DEPOSIT.name())){
statementAccount.setDealType("保证金退费");
}
statementAccount.setDealAmount(kObject.getBigDecimal("applyRefundAmount"));
statementAccount.setDealDate(kObject.getString("createTime"));
statementAccounts.add(statementAccount);
}
}
//费用调整
List<KObject> expenseAdjustList = statementAccountDao.queryStatementAccountByContractId(contractId, ExpenseAdjustConstant.ENTITY);
if (expenseAdjustList.size() > 0) {
for (int i = 0; i < expenseAdjustList.size(); i++) {
KObject kObject = expenseAdjustList.get(i);
StatementAccount statementAccount = new StatementAccount();
if (kObject.getString("fundType").equals(FundTypeEnum.ADVANCE.name())) { //预付款
statementAccount.setDealType("预付款费用调整");
} else if (kObject.getString("fundType").equals(FundTypeEnum.DEPOSIT.name())){
statementAccount.setDealType("保证金费用调整");
}
statementAccount.setDealAmount(kObject.getBigDecimal("expenseAdjustAmount"));
statementAccount.setDealDate(kObject.getString("createTime"));
statementAccounts.add(statementAccount);
}
}
//销售
List<KObject> saleRecordList = statementAccountDao.queryStatementAccountByContractId(contractId, SalesRecordConstant.ENTITY);
if (saleRecordList.size() > 0) {
for (int i = 0; i < saleRecordList.size(); i++) {
KObject kObject = saleRecordList.get(i);
StatementAccount statementAccount = new StatementAccount();
statementAccount.setDealType("销售");
statementAccount.setDealAmount(kObject.getBigDecimal("amount"));
statementAccount.setDealDate(kObject.getString("createTime"));
statementAccounts.add(statementAccount);
}
}
return ResponseObj.success("查询成功", statementAccounts);
} catch (Exception e) {
e.printStackTrace();
return ResponseObj.error();
}
}
}
package com.xyst.dinas.finance.service;
import java.util.UUID;
public interface StatementAccountService {
Object queryStatementAccountByContractId(UUID fromString);
}
package com.xyst.dinas.finance.web;
import java.util.UUID;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import com.xyst.dinas.finance.service.StatementAccountService;
/**
* 费用调整
*
* @author yangqingsong
* @date 2021年4月25日
*/
@RestController
public class StatementAccountController {
@Autowired
private StatementAccountService statementAccountService;
@ResponseBody
@RequestMapping(value = "/finance/statementAccount/queryStatementAccountByContractId", method = RequestMethod.GET)
public Object queryStatementAccountByContractId(@RequestParam String contractId) {
return statementAccountService.queryStatementAccountByContractId(UUID.fromString(contractId));
}
}
package com.xyst.dinas.sales.constant;
public interface SalesRecordConstant {
public static String ENTITY = "com.xyst.dinas.sales.datamodel.SalesRecord";
}
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