Commit 81170a96 by kangxiaoshan

Merge branch '2578_bugfix'

parents 601bacca 84820006
package common.controller;
import common.model.DmpIncome;
import common.model.User;
import common.service.DmpIncomeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import security.annotation.CurrentAccount;
import util.ResultModel;
//DMP 收入管理
@RestController
@RequestMapping("dmp/income")
public class DmpIncomeController {
@Autowired
DmpIncomeService dmpIncomeService;
@GetMapping("/list/bycode")
public ResultModel listByContract(String code) {
//按合同查询
return ResultModel.OK(dmpIncomeService.listByCode(code));
}
@GetMapping("/list/byds")
public ResultModel listByDs(String start, String end) {
//按日期范围查询
return ResultModel.OK(dmpIncomeService.listByDs(start, end));
}
@PostMapping("/update")
public ResultModel updateItem(@RequestBody DmpIncome dmpIncome) {
//更新数据
return ResultModel.OK(dmpIncomeService.update(dmpIncome));
}
@PostMapping("/delete")
public ResultModel deleteItem(Long id) {
//删除数据
return ResultModel.OK(dmpIncomeService.delete(id));
}
@PostMapping("/upload")
public ResultModel uploadList(@RequestParam("file") MultipartFile file, @CurrentAccount User loginAccount) {
//上传收入数据
dmpIncomeService.uploadFile(file, "dmp", loginAccount);
return ResultModel.OK();
}
}
......@@ -107,6 +107,8 @@ public class Contract {
private int businessType; //业务类型 1 VIP 2 共管
private int agreementType; //协议类型 1 普通协议 2 框架协议
private String businessTypeName; //业务类型 1 VIP 2 共管
private String agreementTypeName; //协议类型 1 普通协议 2 框架协议
@Id
@GeneratedValue
......@@ -791,4 +793,22 @@ public class Contract {
public void setAgreementType(int agreementType) {
this.agreementType = agreementType;
}
@Transient
public String getBusinessTypeName() {
return businessTypeName;
}
public void setBusinessTypeName(String businessTypeName) {
this.businessTypeName = businessTypeName;
}
@Transient
public String getAgreementTypeName() {
return agreementTypeName;
}
public void setAgreementTypeName(String agreementTypeName) {
this.agreementTypeName = agreementTypeName;
}
}
package common.model;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Transient;
import java.util.Date;
@Entity
public class DmpIncome {
private Long id;// ID
private String contractCode;//合同编号
private String incomeMonth;//收入月份
private String period;//结算周期
private String sysSettlement;//系统结算
private String monthSettlement;//按月结算
private String confirmSettlement;//确认结算
private String taxRate;//税率
private Date createTime;
private Date modifyTime;
private String uploadUser;
//contract_code, my_body_name, customer_body, customer_short, business_type, agreement_type
private String myBodyName,
customerBody,
customerShort,
businessType,
agreementType;
@Id
@GeneratedValue
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getContractCode() {
return contractCode;
}
public void setContractCode(String contractCode) {
this.contractCode = contractCode;
}
public String getIncomeMonth() {
return incomeMonth;
}
public void setIncomeMonth(String incomeMonth) {
this.incomeMonth = incomeMonth;
}
public String getPeriod() {
return period;
}
public void setPeriod(String period) {
this.period = period;
}
public String getSysSettlement() {
return sysSettlement;
}
public void setSysSettlement(String sysSettlement) {
this.sysSettlement = sysSettlement;
}
public String getMonthSettlement() {
return monthSettlement;
}
public void setMonthSettlement(String monthSettlement) {
this.monthSettlement = monthSettlement;
}
public String getConfirmSettlement() {
return confirmSettlement;
}
public void setConfirmSettlement(String confirmSettlement) {
this.confirmSettlement = confirmSettlement;
}
public String getTaxRate() {
return taxRate;
}
public void setTaxRate(String taxRate) {
this.taxRate = taxRate;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getModifyTime() {
return modifyTime;
}
public void setModifyTime(Date modifyTime) {
this.modifyTime = modifyTime;
}
public String getUploadUser() {
return uploadUser;
}
public void setUploadUser(String uploadUser) {
this.uploadUser = uploadUser;
}
@Transient
public String getMyBodyName() {
return myBodyName;
}
public void setMyBodyName(String myBodyName) {
this.myBodyName = myBodyName;
}
@Transient
public String getCustomerBody() {
return customerBody;
}
public void setCustomerBody(String customerBody) {
this.customerBody = customerBody;
}
@Transient
public String getCustomerShort() {
return customerShort;
}
public void setCustomerShort(String customerShort) {
this.customerShort = customerShort;
}
@Transient
public String getBusinessType() {
return businessType;
}
public void setBusinessType(String businessType) {
this.businessType = businessType;
}
@Transient
public String getAgreementType() {
return agreementType;
}
public void setAgreementType(String agreementType) {
this.agreementType = agreementType;
}
}
......@@ -3,6 +3,7 @@ package common.repository;
import common.model.Contract;
import common.model.Role;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.transaction.annotation.Transactional;
......@@ -100,6 +101,9 @@ public interface ContractRepository extends JpaRepository<Contract, Long> {
@Query(value = "select contract_code,my_body_code,sale,platform from contract where contract_code in ?1", nativeQuery = true)
List<Object[]> findByContractCode(List<String> codesList);
@Query(value = "select contract_code,my_body_code, my_body_name, customer_body, customer_short, business_type, agreement_type from contract where platform = 'dmp' and contract_code in ?1", nativeQuery = true)
List<Object[]> findByDmpContractCode(List<String> codesList);
@Query(value = "select * from contract where ((start_date <= ?1 and end_date >= ?1) or (start_date <= ?2 and end_date >= ?2) or (start_date >= ?1 and end_date <= ?2) or (start_date <= ?1 and end_date >= ?2)) and platform=?3 and status!='del' and (share_sign = 1 or share_sign is null) ", nativeQuery = true)
List<Contract> findShareContranctByDate3(String startDate, String endDate, String platform);
......@@ -137,12 +141,12 @@ public interface ContractRepository extends JpaRepository<Contract, Long> {
List<Long> findRelationContractBySideAgre();
@Query(value = "SELECT * from contract where contract_code = ?1 UNION SELECT * from contract where relation_code = ?1 and create_time <= ?2 and id<> ?3 and contract_type = '2'", nativeQuery = true)
List<Contract> findByCreateTimeAndCodeNotOwn(String contractCode, String createTime,Long id);
List<Contract> findByCreateTimeAndCodeNotOwn(String contractCode, String createTime, Long id);
@Query(value = "select * from contract where next_signed_contract_code=?1 limit 1 ",nativeQuery = true)
@Query(value = "select * from contract where next_signed_contract_code=?1 limit 1 ", nativeQuery = true)
Contract findByNextSignedContractCode(String contractCode);
@Query(value = "select * from contract where platform=?1 and share_sign = ?2 ",nativeQuery = true)
@Query(value = "select * from contract where platform=?1 and share_sign = ?2 ", nativeQuery = true)
List<Contract> findByPlatformAndShareSign(String platform, int share_sign);
@Query(value = "select * from contract where contract_code = ?1 and status != 'del'", nativeQuery = true)
......@@ -150,4 +154,12 @@ public interface ContractRepository extends JpaRepository<Contract, Long> {
@Query(value = "select * from contract where relation_code = ?1 and status != 'del'", nativeQuery = true)
List<Contract> findByRelationCode(String contractCode);
@Query(value = "select id from contract where contract_code = ?1 ", nativeQuery = true)
List<Long> findIdByCode(String relationCode);
@Transactional
@Modifying
@Query(value = "delete from contract where contract_code = ?1 and platform=?2", nativeQuery = true)
void deleteByCode(String contractCode, String platform);
}
package common.repository;
import common.model.DmpIncome;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import java.util.List;
public interface DmpIncomeRepository extends JpaRepository<DmpIncome, Long> {
@Query(value = "select * from dmp_income where contract_code = ?1 order by income_month", nativeQuery = true)
List<DmpIncome> findByContractCode(String contractCode);
@Query(value = "select * from dmp_income where income_month >= ?1 and income_month <=?2 order by income_month", nativeQuery = true)
List<DmpIncome> findByContractDs(String start, String end);
@Query(value = "select * from dmp_income where contract_code = ?1 and income_month =?2 limit 1 ", nativeQuery = true)
DmpIncome findByCodeMonth(String contractCode, String incomeMonth);
}
package common.service;
import common.model.DmpIncome;
import common.model.User;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.springframework.web.multipart.MultipartFile;
import util.ResultModel;
import java.util.List;
public interface DmpIncomeService {
List<DmpIncome> listByCode(String contractCode);
List<DmpIncome> listByDs(String start, String end);
HSSFWorkbook exportIncomeList(String startDate, String endDate, String bodyCode, String serchName);
DmpIncome update(DmpIncome dmpIncome);
Long delete(Long id);
ResultModel uploadFile(MultipartFile file, String platform, User loginAccount);
ResultModel contractUploadFile(MultipartFile file, String platform, User loginAccount);
}
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