结算代码提交
This commit is contained in:
parent
2856200294
commit
82c2a32a17
|
|
@ -18,6 +18,14 @@ public class SltAgreementApply {
|
|||
*协议id
|
||||
*/
|
||||
private String agreementId;
|
||||
/**
|
||||
* 项目名称
|
||||
*/
|
||||
private String unitName;
|
||||
/**
|
||||
* 工程名称
|
||||
*/
|
||||
private String projectName;
|
||||
/**
|
||||
*结算单号
|
||||
*/
|
||||
|
|
@ -29,7 +37,7 @@ public class SltAgreementApply {
|
|||
/**
|
||||
*创建时间
|
||||
*/
|
||||
private String create_time;
|
||||
private String createTime;
|
||||
/**
|
||||
*审核人
|
||||
*/
|
||||
|
|
@ -37,20 +45,21 @@ public class SltAgreementApply {
|
|||
/**
|
||||
*审核时间
|
||||
*/
|
||||
private String audit_time;
|
||||
private String audiTime;
|
||||
/**
|
||||
*状态0待审核1审核通过2审核驳回
|
||||
*/
|
||||
private String status;
|
||||
private String remark;
|
||||
/**
|
||||
*数据所属
|
||||
*/
|
||||
private String company_id;
|
||||
private String companyId;
|
||||
/**
|
||||
*结算总费用
|
||||
*/
|
||||
private String cost;
|
||||
|
||||
private List<String> agreementIds;
|
||||
private List<SltAgreementRelation> relations;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,19 +17,19 @@ public class SltAgreementDetails {
|
|||
/**
|
||||
*申请id
|
||||
*/
|
||||
private String apply_id;
|
||||
private String applyId;
|
||||
/**
|
||||
*机具规格id
|
||||
*/
|
||||
private String type_id;
|
||||
private String typeId;
|
||||
/**
|
||||
*机具id
|
||||
*/
|
||||
private String ma_id;
|
||||
private String maId;
|
||||
/**
|
||||
*费用类型:1租赁2丢失3维修4报废
|
||||
*/
|
||||
private String slt_type;
|
||||
private String sltType;
|
||||
/**
|
||||
*数量
|
||||
*/
|
||||
|
|
@ -37,11 +37,11 @@ public class SltAgreementDetails {
|
|||
/**
|
||||
*开始时间
|
||||
*/
|
||||
private String start_time;
|
||||
private String startTime;
|
||||
/**
|
||||
*结束时间
|
||||
*/
|
||||
private String end_time;
|
||||
private String endTime;
|
||||
/**
|
||||
*单价
|
||||
*/
|
||||
|
|
@ -53,6 +53,6 @@ public class SltAgreementDetails {
|
|||
/**
|
||||
*是否收费
|
||||
*/
|
||||
private String is_charge;
|
||||
private String isCharge;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -100,6 +100,11 @@ public class SltAgreementInfo {
|
|||
* (0自然,1人为)
|
||||
*/
|
||||
private String scrapType;
|
||||
/**
|
||||
* 费用类型:1租赁2丢失3维修4报废
|
||||
*/
|
||||
private String sltType;
|
||||
private String applyId;
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,63 @@
|
|||
package com.bonus.sgzb.base.api.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author c liu
|
||||
* @date 2024/2/21
|
||||
*/
|
||||
@Data
|
||||
public class SltAgreementRelation {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private Long id;
|
||||
/**
|
||||
*结算id
|
||||
*/
|
||||
private String applyId;
|
||||
/**
|
||||
*协议id
|
||||
*/
|
||||
private String agreementId;
|
||||
/**
|
||||
*增加费用
|
||||
*/
|
||||
private String addCost;
|
||||
/**
|
||||
*减免费用
|
||||
*/
|
||||
private String subCost;
|
||||
/**
|
||||
*增减原因
|
||||
*/
|
||||
private String remark;
|
||||
/**
|
||||
*结算总费用
|
||||
*/
|
||||
private String cost;
|
||||
/**
|
||||
*状态0待审核1审核通过2审核驳回
|
||||
*/
|
||||
private String status;
|
||||
|
||||
String loseCost;
|
||||
String leaseCost;
|
||||
String scrapCost;
|
||||
String repairCost;
|
||||
/**
|
||||
* 项目名称
|
||||
*/
|
||||
private String unitName;
|
||||
/**
|
||||
* 工程名称
|
||||
*/
|
||||
private String projectName;
|
||||
|
||||
/**
|
||||
*数据所属
|
||||
*/
|
||||
private String companyId;
|
||||
}
|
||||
|
|
@ -26,9 +26,9 @@ public class SltInfoVo {
|
|||
* 丢失费用列表
|
||||
*/
|
||||
List<SltAgreementInfo> loseList;
|
||||
String loseCost;
|
||||
String leaseCost;
|
||||
String scrapCost;
|
||||
String repairCost;
|
||||
|
||||
List<SltAgreementRelation> relations;
|
||||
|
||||
String cost;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -542,8 +542,8 @@
|
|||
)
|
||||
</insert>
|
||||
<insert id="insStlInfoTwo">
|
||||
insert into slt_agreement_info (agreement_id,type_id,ma_id,num,start_time,status,lease_id,lease_price,buy_price,company_id)
|
||||
values (#{info.agreementId},#{info.typeId},#{info.maId},#{many},#{info.startTime},#{info.status},#{info.leaseId},#{info.leasePrice},#{info.buyPrice},#{info.companyId});
|
||||
insert into slt_agreement_info (agreement_id,type_id,ma_id,num,start_time,status,lease_id,lease_price,buy_price,is_slt,company_id)
|
||||
values (#{info.agreementId},#{info.typeId},#{info.maId},#{many},#{info.startTime},#{info.status},#{info.leaseId},#{info.leasePrice},#{info.buyPrice},'0',#{info.companyId});
|
||||
</insert>
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -342,7 +342,7 @@
|
|||
</trim>
|
||||
</insert>
|
||||
<insert id="insSltInfo">
|
||||
insert into slt_agreement_info (agreement_id,type_id,ma_id,num,start_time,status,lease_id,lease_price,buy_price,company_id)
|
||||
values (#{agreementId},#{record.typeId},#{record.maId},#{record.outNum},now(),0,#{record.parentId},#{ma.finalPrice},#{ma.buyPrice},#{record.companyId});
|
||||
insert into slt_agreement_info (agreement_id,type_id,ma_id,num,start_time,status,lease_id,lease_price,buy_price,is_slt,company_id)
|
||||
values (#{agreementId},#{record.typeId},#{record.maId},#{record.outNum},now(),0,#{record.parentId},#{ma.finalPrice},#{ma.buyPrice},'0',#{record.companyId});
|
||||
</insert>
|
||||
</mapper>
|
||||
|
|
@ -59,8 +59,40 @@ public class SltAgreementInfoController extends BaseController {
|
|||
@PostMapping("/submitFee")
|
||||
public AjaxResult submitFee(@RequestBody SltAgreementApply apply)
|
||||
{
|
||||
AjaxResult res = service.submitFee(apply);
|
||||
return res;
|
||||
return service.submitFee(apply);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取结算审核列表
|
||||
*/
|
||||
@ApiOperation(value = "获取结算审核列表")
|
||||
@GetMapping("/getSltExam")
|
||||
public TableDataInfo getSltExam(AgreementInfo bean)
|
||||
{
|
||||
startPage();
|
||||
List<SltAgreementApply> list = service.getSltExam(bean);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取结算审核清单
|
||||
*/
|
||||
@ApiOperation(value = "获取结算审核清单")
|
||||
@GetMapping("/getSltExamInfo")
|
||||
public AjaxResult getSltExamInfo(SltAgreementApply apply)
|
||||
{
|
||||
SltInfoVo bean = service.getSltExamInfo(apply);
|
||||
return AjaxResult.success(bean);
|
||||
}
|
||||
|
||||
/**
|
||||
* 结算审核
|
||||
*/
|
||||
@ApiOperation(value = "结算审核")
|
||||
@GetMapping("/settlementReview")
|
||||
public AjaxResult settlementReview(SltAgreementApply apply)
|
||||
{
|
||||
return toAjax(service.settlementReview(apply));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
package com.bonus.sgzb.material.mapper;
|
||||
|
||||
import com.bonus.sgzb.base.api.domain.SltAgreementApply;
|
||||
import com.bonus.sgzb.base.api.domain.SltAgreementInfo;
|
||||
import com.bonus.sgzb.base.api.domain.SltAgreementRelation;
|
||||
import com.bonus.sgzb.material.domain.AgreementInfo;
|
||||
import com.bonus.sgzb.material.domain.RepairTaskDetails;
|
||||
import com.bonus.sgzb.material.domain.ScrapApplyDetails;
|
||||
|
|
@ -8,6 +10,7 @@ import com.bonus.sgzb.material.domain.TmTask;
|
|||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
|
@ -27,4 +30,26 @@ public interface SltAgreementInfoMapper {
|
|||
List<SltAgreementInfo> getScrapDetailsList(@Param("taskList") List<TmTask> taskList);
|
||||
|
||||
List<SltAgreementInfo> getLoseList(AgreementInfo bean);
|
||||
|
||||
int selectNumByDate(Date nowDate);
|
||||
|
||||
int insApply(SltAgreementApply apply);
|
||||
|
||||
int insRelation(SltAgreementRelation relation);
|
||||
|
||||
int insDetails(SltAgreementInfo info);
|
||||
|
||||
List<SltAgreementApply> getSltExam(AgreementInfo bean);
|
||||
|
||||
List<SltAgreementRelation> getRelations(SltAgreementApply apply);
|
||||
|
||||
String getCost(SltAgreementApply apply);
|
||||
|
||||
int updateInfoStatus(String agreementId);
|
||||
|
||||
int updateRelation(SltAgreementApply apply);
|
||||
|
||||
int updateApply(SltAgreementApply apply);
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,4 +18,10 @@ public interface SltAgreementInfoService {
|
|||
SltInfoVo getSltInfo(List<AgreementInfo> list);
|
||||
|
||||
AjaxResult submitFee(SltAgreementApply apply);
|
||||
|
||||
List<SltAgreementApply> getSltExam(AgreementInfo bean);
|
||||
|
||||
SltInfoVo getSltExamInfo(SltAgreementApply apply);
|
||||
|
||||
int settlementReview(SltAgreementApply apply);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,19 +2,27 @@ package com.bonus.sgzb.material.service.impl;
|
|||
|
||||
import com.bonus.sgzb.base.api.domain.SltAgreementApply;
|
||||
import com.bonus.sgzb.base.api.domain.SltAgreementInfo;
|
||||
import com.bonus.sgzb.base.api.domain.SltAgreementRelation;
|
||||
import com.bonus.sgzb.base.api.domain.SltInfoVo;
|
||||
import com.bonus.sgzb.common.core.exception.ServiceException;
|
||||
import com.bonus.sgzb.common.core.utils.DateUtils;
|
||||
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.sgzb.common.security.utils.SecurityUtils;
|
||||
import com.bonus.sgzb.material.domain.AgreementInfo;
|
||||
import com.bonus.sgzb.material.domain.RepairTaskDetails;
|
||||
import com.bonus.sgzb.material.domain.ScrapApplyDetails;
|
||||
import com.bonus.sgzb.material.domain.TmTask;
|
||||
import com.bonus.sgzb.material.mapper.SltAgreementInfoMapper;
|
||||
import com.bonus.sgzb.material.service.SltAgreementInfoService;
|
||||
import com.bonus.sgzb.material.vo.GlobalContants;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
|
@ -42,23 +50,162 @@ public class SltAgreementInfoServiceImpl implements SltAgreementInfoService {
|
|||
sltInfoVo.setRepairList(repairList);
|
||||
sltInfoVo.setScrapList(scrapList);
|
||||
sltInfoVo.setLoseList(loseList);
|
||||
List<SltAgreementRelation> relations = getRelations(leaseList,repairList,scrapList,loseList,list);
|
||||
sltInfoVo.setRelations(relations);
|
||||
return sltInfoVo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult submitFee(SltAgreementApply apply) {
|
||||
List<String> agreementIds = apply.getAgreementIds();
|
||||
public SltInfoVo getSltExamInfo(SltAgreementApply apply) {
|
||||
SltInfoVo sltInfoVo = new SltInfoVo();
|
||||
List<AgreementInfo> list = new ArrayList<>();
|
||||
for (String agreementId : agreementIds){
|
||||
String cost = mapper.getCost(apply);
|
||||
List<SltAgreementRelation> relations = mapper.getRelations(apply);
|
||||
sltInfoVo.setRelations(relations);
|
||||
for (SltAgreementRelation relation : relations){
|
||||
AgreementInfo info = new AgreementInfo();
|
||||
info.setAgreementId(Long.valueOf(agreementId));
|
||||
info.setAgreementId(Long.valueOf(relation.getAgreementId()));
|
||||
list.add(info);
|
||||
}
|
||||
|
||||
|
||||
return null;
|
||||
List<SltAgreementInfo> leaseList = getLeaseList(list);
|
||||
List<SltAgreementInfo> repairList = getRepairList(list);
|
||||
List<SltAgreementInfo> scrapList = getScrapList(list);
|
||||
List<SltAgreementInfo> loseList = getLoseList(list);
|
||||
sltInfoVo.setLeaseList(leaseList);
|
||||
sltInfoVo.setRepairList(repairList);
|
||||
sltInfoVo.setScrapList(scrapList);
|
||||
sltInfoVo.setLoseList(loseList);
|
||||
sltInfoVo.setCost(cost);
|
||||
return sltInfoVo;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public int settlementReview(SltAgreementApply apply) {
|
||||
Long userid = SecurityUtils.getLoginUser().getUserid();
|
||||
apply.setAuditor(String.valueOf(userid));
|
||||
int i = mapper.updateRelation(apply);
|
||||
int j = 0;
|
||||
if (i > 0){
|
||||
j = mapper.updateApply(apply);
|
||||
}else {
|
||||
throw new ServiceException("结算审核失败");
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
||||
private List<SltAgreementRelation> getRelations(List<SltAgreementInfo> leaseList, List<SltAgreementInfo> repairList, List<SltAgreementInfo> scrapList, List<SltAgreementInfo> loseList, List<AgreementInfo> list) {
|
||||
List<SltAgreementRelation> relations = new ArrayList<>();
|
||||
for (AgreementInfo info : list){
|
||||
SltAgreementRelation relation = new SltAgreementRelation();
|
||||
BigDecimal loseCost = new BigDecimal("0");
|
||||
BigDecimal leaseCost = new BigDecimal("0");
|
||||
BigDecimal scrapCost = new BigDecimal("0");
|
||||
BigDecimal repairCost = new BigDecimal("0");
|
||||
for (SltAgreementInfo lease : leaseList){
|
||||
if (lease.getAgreementId().equals(info.getAgreementId().toString())){
|
||||
relation.setAgreementId(lease.getAgreementId());
|
||||
relation.setProjectName(lease.getProjectName());
|
||||
relation.setUnitName(lease.getUnitName());
|
||||
relation.setCompanyId(lease.getCompanyId());
|
||||
BigDecimal cost = new BigDecimal(lease.getCosts());
|
||||
leaseCost = leaseCost.add(cost);
|
||||
}
|
||||
}
|
||||
for (SltAgreementInfo repair : repairList){
|
||||
if (repair.getAgreementId().equals(info.getAgreementId().toString())){
|
||||
BigDecimal cost = new BigDecimal(repair.getCosts());
|
||||
repairCost = repairCost.add(cost);
|
||||
}
|
||||
}
|
||||
for (SltAgreementInfo scrap : scrapList){
|
||||
if (scrap.getAgreementId().equals(info.getAgreementId().toString())){
|
||||
BigDecimal cost = new BigDecimal(scrap.getCosts());
|
||||
scrapCost = scrapCost.add(cost);
|
||||
}
|
||||
}
|
||||
for (SltAgreementInfo lose : loseList){
|
||||
if (lose.getAgreementId().equals(info.getAgreementId().toString())){
|
||||
relation.setAgreementId(lose.getAgreementId());
|
||||
relation.setProjectName(lose.getProjectName());
|
||||
relation.setUnitName(lose.getUnitName());
|
||||
relation.setCompanyId(lose.getCompanyId());
|
||||
BigDecimal cost = new BigDecimal(lose.getCosts());
|
||||
loseCost = loseCost.add(cost);
|
||||
}
|
||||
}
|
||||
relation.setLeaseCost(leaseCost.toString());
|
||||
relation.setRepairCost(repairCost.toString());
|
||||
relation.setScrapCost(scrapCost.toString());
|
||||
relation.setLoseCost(loseCost.toString());
|
||||
relations.add(relation);
|
||||
}
|
||||
return relations;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public AjaxResult submitFee(SltAgreementApply apply) {
|
||||
List<SltAgreementRelation> relations = apply.getRelations();
|
||||
List<AgreementInfo> list = new ArrayList<>();
|
||||
Long userid = SecurityUtils.getLoginUser().getUserid();
|
||||
String code = sltCodeRule("JS");
|
||||
apply.setCreator(String.valueOf(userid));
|
||||
apply.setCode(code);
|
||||
apply.setCompanyId(relations.get(0).getCompanyId());
|
||||
int i = mapper.insApply(apply);
|
||||
if (i > 0){
|
||||
for (SltAgreementRelation relation : relations){
|
||||
AgreementInfo info = new AgreementInfo();
|
||||
info.setAgreementId(Long.valueOf(relation.getAgreementId()));
|
||||
list.add(info);
|
||||
relation.setApplyId(String.valueOf(apply.getId()));
|
||||
mapper.updateInfoStatus(relation.getAgreementId());
|
||||
int j = mapper.insRelation(relation);
|
||||
if (j < 0){
|
||||
throw new ServiceException("新增协议结算记录失败");
|
||||
}
|
||||
}
|
||||
List<SltAgreementInfo> leaseList = getLeaseList(list);
|
||||
List<SltAgreementInfo> repairList = getRepairList(list);
|
||||
List<SltAgreementInfo> scrapList = getScrapList(list);
|
||||
List<SltAgreementInfo> loseList = getLoseList(list);
|
||||
for (SltAgreementInfo info : leaseList){
|
||||
info.setSltType("1");
|
||||
info.setApplyId(String.valueOf(apply.getId()));
|
||||
info.setPartType("1");
|
||||
mapper.insDetails(info);
|
||||
}
|
||||
for (SltAgreementInfo info : repairList){
|
||||
info.setSltType("3");
|
||||
info.setApplyId(String.valueOf(apply.getId()));
|
||||
mapper.insDetails(info);
|
||||
}
|
||||
for (SltAgreementInfo info : scrapList){
|
||||
info.setSltType("4");
|
||||
info.setApplyId(String.valueOf(apply.getId()));
|
||||
info.setPartType(info.getScrapType());
|
||||
mapper.insDetails(info);
|
||||
}
|
||||
for (SltAgreementInfo info : loseList){
|
||||
info.setSltType("2");
|
||||
info.setApplyId(String.valueOf(apply.getId()));
|
||||
info.setPartType("1");
|
||||
mapper.insDetails(info);
|
||||
}
|
||||
|
||||
}else {
|
||||
throw new ServiceException("新增结算单号失败");
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SltAgreementApply> getSltExam(AgreementInfo bean) {
|
||||
return mapper.getSltExam(bean);
|
||||
}
|
||||
|
||||
|
||||
private List<SltAgreementInfo> getLoseList(List<AgreementInfo> list) {
|
||||
List<SltAgreementInfo> loseList = new ArrayList<>();
|
||||
for (AgreementInfo bean : list){
|
||||
|
|
@ -145,4 +292,21 @@ public class SltAgreementInfoServiceImpl implements SltAgreementInfoService {
|
|||
}
|
||||
return leaseList;
|
||||
}
|
||||
|
||||
/**结算单号编码生成规则*/
|
||||
private String sltCodeRule(String code) {
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
|
||||
Date nowDate = DateUtils.getNowDate();
|
||||
String format = dateFormat.format(nowDate);
|
||||
int taskNum = mapper.selectNumByDate(nowDate) + 1;
|
||||
String codeNum = "";
|
||||
if (taskNum > GlobalContants.NUM1 && taskNum < GlobalContants.NUM2) {
|
||||
codeNum = code + format + "-00" + taskNum;
|
||||
} else if (taskNum > GlobalContants.NUM3 && taskNum < GlobalContants.NUM4) {
|
||||
codeNum = code + format + "-0" + taskNum;
|
||||
} else {
|
||||
codeNum = code + format + "-000" + taskNum;
|
||||
}
|
||||
return codeNum;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,7 +26,60 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<result property="fileName" column="file_name"/>
|
||||
<result property="fileUrl" column="file_url"/>
|
||||
</resultMap>
|
||||
|
||||
<insert id="insApply" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into slt_agreement_apply (code,creator,create_time,status,company_id,cost)
|
||||
values (#{code},#{creator},now(),'0',#{companyId},#{cost});
|
||||
</insert>
|
||||
<insert id="insRelation">
|
||||
insert into slt_agreement_relation (apply_id,agreement_id,add_cost,sub_cost,remark,cost,status)
|
||||
values (#{applyId},#{agreementId},#{addCost},#{subCost},#{remark},#{cost},'0');
|
||||
</insert>
|
||||
<insert id="insDetails">
|
||||
insert into slt_agreement_details
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="applyId != null">apply_id,</if>
|
||||
<if test="typeId != null">type_id,</if>
|
||||
<if test="maId != null">ma_id,</if>
|
||||
<if test="sltType != null">slt_type,</if>
|
||||
<if test="num != null">num,</if>
|
||||
<if test="startTime != null">start_time,</if>
|
||||
<if test="endTime != null">end_time,</if>
|
||||
<if test="leasePrice != null">price,</if>
|
||||
<if test="costs != null">money,</if>
|
||||
<if test="partType != null">is_charge,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="applyId != null">#{applyId},</if>
|
||||
<if test="typeId != null">#{typeId},</if>
|
||||
<if test="maId != null">#{maId},</if>
|
||||
<if test="sltType != null">#{sltType},</if>
|
||||
<if test="num != null">#{num},</if>
|
||||
<if test="startTime != null">#{startTime},</if>
|
||||
<if test="endTime != null">#{endTime},</if>
|
||||
<if test="leasePrice != null">#{leasePrice},</if>
|
||||
<if test="costs != null">#{costs},</if>
|
||||
<if test="partType != null">#{partType},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<update id="updateInfoStatus">
|
||||
update slt_agreement_info
|
||||
set is_slt = '1',
|
||||
slt_time = now()
|
||||
where agreement_id = #{agreementId}
|
||||
</update>
|
||||
<update id="updateRelation">
|
||||
update slt_agreement_relation
|
||||
set status = #{status}
|
||||
where apply_id = #{id}
|
||||
</update>
|
||||
<update id="updateApply">
|
||||
update slt_agreement_apply
|
||||
set status = #{status},
|
||||
auditor = #{auditor},
|
||||
audit_time = now(),
|
||||
remark = #{remark}
|
||||
where id = #{id}
|
||||
</update>
|
||||
<select id="getSltAgreementInfo" resultType="com.bonus.sgzb.material.domain.AgreementInfo">
|
||||
SELECT bai.agreement_id, bai.agreement_code , contract_code,file_url ,file_name,sign_time,
|
||||
bui.unit_id,bui.unit_name , bp.lot_id as projectId , bp.lot_name as projectName,
|
||||
|
|
@ -44,13 +97,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</if>
|
||||
<choose>
|
||||
<when test="sltStatus == '1'.toString()">
|
||||
and saa.id is null
|
||||
and sar.id is null
|
||||
</when>
|
||||
<when test="sltStatus == '2'.toString()">
|
||||
and saa.status = '0'
|
||||
and sar.status = '0'
|
||||
</when>
|
||||
<when test="sltStatus == '3'.toString()">
|
||||
and saa.status = '1'
|
||||
and sar.status = '1'
|
||||
</when>
|
||||
<otherwise>
|
||||
|
||||
|
|
@ -64,7 +117,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
sai.agreement_id as agreementId,
|
||||
bui.unit_name as unitName,
|
||||
bp.lot_name as projectName,
|
||||
sai.agreement_id as agreementId,
|
||||
sai.company_id as companyId,
|
||||
sai.type_id as typeId,
|
||||
sai.ma_id as maId,
|
||||
mt1.type_name as typeName,
|
||||
|
|
@ -88,7 +141,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
sai.agreement_id as agreementId,
|
||||
bui.unit_name as unitName,
|
||||
bp.lot_name as projectName,
|
||||
sai.agreement_id as agreementId,
|
||||
sai.company_id as companyId,
|
||||
sai.type_id as typeId,
|
||||
sai.ma_id as maId,
|
||||
mt1.type_name as typeName,
|
||||
|
|
@ -125,7 +178,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
sum(rc.repair_num) as num,
|
||||
sum(rc.costs) as costs,
|
||||
rc.part_type as partType,
|
||||
rc.status as repairStatus
|
||||
rc.status as repairStatus,
|
||||
rc.company_id as companyId
|
||||
from repair_cost rc
|
||||
left join tm_task_agreement tta on rc.task_id = tta.task_id
|
||||
LEFT JOIN bm_agreement_info bai on tta.agreement_id = bai.agreement_id
|
||||
|
|
@ -153,7 +207,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
mt.unit_name as nuitName,
|
||||
sum(sad.scrap_num) as num,
|
||||
mt.buy_price as buyPrice,
|
||||
sad.scrap_type as scrapType
|
||||
sad.scrap_type as scrapType,
|
||||
sad.company_id as companyId
|
||||
from scrap_apply_details sad
|
||||
left join tm_task_agreement tta on sad.task_id = tta.task_id
|
||||
LEFT JOIN bm_agreement_info bai on tta.agreement_id = bai.agreement_id
|
||||
|
|
@ -170,5 +225,52 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</if>
|
||||
group by sad.type_id,sad.ma_id,sad.scrap_type
|
||||
</select>
|
||||
|
||||
<select id="selectNumByDate" resultType="java.lang.Integer">
|
||||
select count(*) from slt_agreement_apply where DATE_FORMAT(create_time,'%y%m') = DATE_FORMAT(#{date},'%y%m')
|
||||
</select>
|
||||
<select id="getSltExam" resultType="com.bonus.sgzb.base.api.domain.SltAgreementApply">
|
||||
select saa.id,
|
||||
saa.code,
|
||||
GROUP_CONCAT(DISTINCT sar.agreement_id) as agreementId,
|
||||
GROUP_CONCAT(DISTINCT bui.unit_name) as unitName,
|
||||
GROUP_CONCAT(DISTINCT bp.lot_name) as projectName,
|
||||
saa.cost,
|
||||
saa.status
|
||||
from slt_agreement_apply saa
|
||||
left join slt_agreement_relation sar on saa.id = sar.apply_id
|
||||
LEFT JOIN bm_agreement_info bai on sar.agreement_id = bai.agreement_id
|
||||
LEFT JOIN bm_project_lot bp ON bp.lot_id = bai.project_id
|
||||
LEFT JOIN bm_unit_info bui ON bui.unit_id = bai.unit_id
|
||||
where 1=1
|
||||
<if test="unitId != null and unitId != ''">
|
||||
and bui.unit_id = #{unitId}
|
||||
</if>
|
||||
<if test="projectId != null and projectId != ''">
|
||||
and bp.lot_id = #{projectId}
|
||||
</if>
|
||||
<if test="sltStatus != null and sltStatus != ''">
|
||||
and saa.status = #{sltStatus}
|
||||
</if>
|
||||
</select>
|
||||
<select id="getRelations" resultType="com.bonus.sgzb.base.api.domain.SltAgreementRelation">
|
||||
select sar.id,
|
||||
bui.unit_name as unitName,
|
||||
bp.lot_name as projectName,
|
||||
sar.apply_id as applyId,
|
||||
sar.agreement_id as agreementId,
|
||||
sar.add_cost as addCost,
|
||||
sar.sub_cost as subCost,
|
||||
sar.remark as remark,
|
||||
sar.cost as cost
|
||||
from slt_agreement_relation sar
|
||||
LEFT JOIN bm_agreement_info bai on sar.agreement_id = bai.agreement_id
|
||||
LEFT JOIN bm_project_lot bp ON bp.lot_id = bai.project_id
|
||||
LEFT JOIN bm_unit_info bui ON bui.unit_id = bai.unit_id
|
||||
where sar.apply_id = #{id}
|
||||
</select>
|
||||
<select id="getCost" resultType="java.lang.String">
|
||||
select cost
|
||||
from slt_agreement_apply
|
||||
where id = #{id}
|
||||
</select>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue