结算代码提交
This commit is contained in:
parent
201f7d4f5c
commit
8b1ecec6c1
|
|
@ -0,0 +1,56 @@
|
|||
package com.bonus.sgzb.base.api.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author c liu
|
||||
* @date 2024/2/21
|
||||
*/
|
||||
@Data
|
||||
public class SltAgreementApply {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private Long id;
|
||||
/**
|
||||
*协议id
|
||||
*/
|
||||
private String agreementId;
|
||||
/**
|
||||
*结算单号
|
||||
*/
|
||||
private String code;
|
||||
/**
|
||||
*创建人
|
||||
*/
|
||||
private String creator;
|
||||
/**
|
||||
*创建时间
|
||||
*/
|
||||
private String create_time;
|
||||
/**
|
||||
*审核人
|
||||
*/
|
||||
private String auditor;
|
||||
/**
|
||||
*审核时间
|
||||
*/
|
||||
private String audit_time;
|
||||
/**
|
||||
*状态0待审核1审核通过2审核驳回
|
||||
*/
|
||||
private String status;
|
||||
/**
|
||||
*数据所属
|
||||
*/
|
||||
private String company_id;
|
||||
/**
|
||||
*结算总费用
|
||||
*/
|
||||
private String cost;
|
||||
|
||||
private List<String> agreementIds;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
package com.bonus.sgzb.base.api.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author c liu
|
||||
* @date 2024/2/21
|
||||
*/
|
||||
@Data
|
||||
public class SltAgreementDetails {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private Long id;
|
||||
/**
|
||||
*申请id
|
||||
*/
|
||||
private String apply_id;
|
||||
/**
|
||||
*机具规格id
|
||||
*/
|
||||
private String type_id;
|
||||
/**
|
||||
*机具id
|
||||
*/
|
||||
private String ma_id;
|
||||
/**
|
||||
*费用类型:1租赁2丢失3维修4报废
|
||||
*/
|
||||
private String slt_type;
|
||||
/**
|
||||
*数量
|
||||
*/
|
||||
private String num;
|
||||
/**
|
||||
*开始时间
|
||||
*/
|
||||
private String start_time;
|
||||
/**
|
||||
*结束时间
|
||||
*/
|
||||
private String end_time;
|
||||
/**
|
||||
*单价
|
||||
*/
|
||||
private String price;
|
||||
/**
|
||||
*金额
|
||||
*/
|
||||
private String money;
|
||||
/**
|
||||
*是否收费
|
||||
*/
|
||||
private String is_charge;
|
||||
|
||||
}
|
||||
|
|
@ -60,5 +60,46 @@ public class SltAgreementInfo {
|
|||
*
|
||||
*/
|
||||
private String companyId;
|
||||
/**
|
||||
* 项目名称
|
||||
*/
|
||||
private String unitName;
|
||||
/**
|
||||
* 工程名称
|
||||
*/
|
||||
private String projectName;
|
||||
/**
|
||||
* 设备名称
|
||||
*/
|
||||
private String typeName;
|
||||
/**
|
||||
* 规格型号
|
||||
*/
|
||||
private String modelName;
|
||||
/**
|
||||
* 计量单位
|
||||
*/
|
||||
private String nuitName;
|
||||
/**
|
||||
* 租赁天数
|
||||
*/
|
||||
private String leaseDays;
|
||||
/**
|
||||
* 租赁费用
|
||||
*/
|
||||
private String costs;
|
||||
/**
|
||||
* 类型(0不收费,1收费)
|
||||
*/
|
||||
private String partType;
|
||||
/**
|
||||
* 维修审核:0未审核,1已审核,2已驳回
|
||||
*/
|
||||
private String repairStatus;
|
||||
/**
|
||||
* (0自然,1人为)
|
||||
*/
|
||||
private String scrapType;
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,34 @@
|
|||
package com.bonus.sgzb.base.api.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author c liu
|
||||
* @date 2024/2/23
|
||||
*/
|
||||
@Data
|
||||
public class SltInfoVo {
|
||||
/**
|
||||
* 租赁费用列表
|
||||
*/
|
||||
List<SltAgreementInfo> leaseList;
|
||||
/**
|
||||
* 维修费用列表
|
||||
*/
|
||||
List<SltAgreementInfo> repairList;
|
||||
/**
|
||||
* 报废费用列表
|
||||
*/
|
||||
List<SltAgreementInfo> scrapList;
|
||||
/**
|
||||
* 丢失费用列表
|
||||
*/
|
||||
List<SltAgreementInfo> loseList;
|
||||
String loseCost;
|
||||
String leaseCost;
|
||||
String scrapCost;
|
||||
String repairCost;
|
||||
|
||||
}
|
||||
|
|
@ -183,4 +183,6 @@ public interface BackReceiveMapper {
|
|||
int updateStlInfoTwo(@Param("info") SltAgreementInfo info,@Param("record") BackApplyInfo record, @Param("backNum") Double backNum);
|
||||
|
||||
int insStlInfoTwo(@Param("info")SltAgreementInfo info, @Param("many")Double many);
|
||||
|
||||
List<BackApplyInfo> getAllList(BackApplyInfo record);
|
||||
}
|
||||
|
|
@ -127,10 +127,7 @@ public class BackReceiveServiceImpl implements BackReceiveService {
|
|||
if(res == 0) {
|
||||
throw new RuntimeException("ma_machines");
|
||||
}
|
||||
res = updateSlt(record,hgList);
|
||||
if(res == 0) {
|
||||
throw new RuntimeException("slt_agreement_info");
|
||||
}
|
||||
|
||||
}
|
||||
//维修的创建维修任务,插入任务协议表
|
||||
List<BackApplyInfo> wxList = backReceiveMapper.getWxList(record);
|
||||
|
|
@ -153,6 +150,14 @@ public class BackReceiveServiceImpl implements BackReceiveService {
|
|||
//插入维修记录表scrap_apply_details
|
||||
res = insertSad(newTaskId,bfList);
|
||||
}
|
||||
|
||||
List<BackApplyInfo> allList = backReceiveMapper.getAllList(record);
|
||||
if(allList!=null && allList.size()>0){
|
||||
res = updateSlt(record,allList);
|
||||
if(res == 0) {
|
||||
throw new RuntimeException("slt_agreement_info");
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
throw new RuntimeException(e.getMessage());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import com.bonus.sgzb.system.api.domain.SysUser;
|
|||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
|
@ -158,4 +159,6 @@ public interface RepairMapper {
|
|||
* @return
|
||||
*/
|
||||
List<RepairTask> exportRepairTaskList(RepairTask bean);
|
||||
|
||||
int addRepairCost(@Param("bean") RepairApplyRecord bean, @Param("costs") BigDecimal costs,@Param("partType") String partType);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
|
@ -42,6 +43,7 @@ public class RepairServiceImpl implements RepairService {
|
|||
|
||||
@Override
|
||||
public List<RepairTaskDetails> getRepairMaTypeList(RepairTaskDetails bean) {
|
||||
Long companyId = SecurityUtils.getLoginUser().getSysUser().getCompanyId();
|
||||
List<RepairTaskDetails> repairMaTypeList = mapper.getRepairMaTypeList(bean);
|
||||
return repairMaTypeList;
|
||||
}
|
||||
|
|
@ -53,8 +55,12 @@ public class RepairServiceImpl implements RepairService {
|
|||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
bean.setCreateBy(loginUser.getUserid());
|
||||
List<RepairPartDetails> partList = bean.getPartList();
|
||||
BigDecimal sfCosts = new BigDecimal("0");
|
||||
BigDecimal bsfCosts = new BigDecimal("0");
|
||||
String nbType = "1";
|
||||
String fcType = "2";
|
||||
String sfPart = "1";
|
||||
String bsfPart = "0";
|
||||
if (partList != null && partList.size()>0){
|
||||
bean.setRepairNum(partList.get(0).getRepairNum());
|
||||
bean.setRepairer(partList.get(0).getRepairer());
|
||||
|
|
@ -83,7 +89,6 @@ public class RepairServiceImpl implements RepairService {
|
|||
int num = scrapNum + details.getRepairedNum();
|
||||
if (num > details.getRepairNum()) {
|
||||
throw new ServiceException("维修数量大于维修总量");
|
||||
//添加维修记录
|
||||
}
|
||||
mapper.updateScrapNum(bean.getId(), scrapNum,loginUser.getUserid());
|
||||
break;
|
||||
|
|
@ -123,7 +128,23 @@ public class RepairServiceImpl implements RepairService {
|
|||
}
|
||||
bean.setPartNum(partList.get(0).getPartNum());
|
||||
}
|
||||
|
||||
for (RepairPartDetails partDetails : partList){
|
||||
if (sfPart.equals(partDetails.getPartType())){
|
||||
BigDecimal partCost = new BigDecimal(partDetails.getPartCost());
|
||||
sfCosts = sfCosts.add(partCost);
|
||||
} else if (bsfPart.equals(partDetails.getPartType())) {
|
||||
BigDecimal partCost = new BigDecimal(partDetails.getPartCost());
|
||||
bsfCosts = bsfCosts.add(partCost);
|
||||
} else{
|
||||
throw new ServiceException("请选择配件收费类型");
|
||||
}
|
||||
}
|
||||
if (!sfCosts.toString().equals("0")){
|
||||
mapper.addRepairCost(bean,sfCosts,sfPart);
|
||||
}
|
||||
if (!bsfCosts.toString().equals("0")){
|
||||
mapper.addRepairCost(bean,bsfCosts,bsfPart);
|
||||
}
|
||||
}
|
||||
mapper.addRecord(bean);
|
||||
return AjaxResult.success();
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
|
||||
<select id="getDayLeaseNum" resultType="java.lang.Integer">
|
||||
select COALESCE(SUM(audit_num), 0)
|
||||
select COALESCE(SUM(pre_num), 0)
|
||||
from lease_apply_details
|
||||
WHERE create_time >= #{startTime} AND create_time <= #{endTime} AND status in ('1','2')
|
||||
</select>
|
||||
|
|
|
|||
|
|
@ -667,7 +667,6 @@
|
|||
WHERE
|
||||
parent_id=#{parentId}
|
||||
and bcd.back_status='1'
|
||||
|
||||
</select>
|
||||
|
||||
<select id="getWxList" resultType="com.bonus.sgzb.app.domain.BackApplyInfo">
|
||||
|
|
@ -815,6 +814,25 @@
|
|||
</if>
|
||||
order by start_time asc
|
||||
</select>
|
||||
<select id="getAllList" resultType="com.bonus.sgzb.app.domain.BackApplyInfo">
|
||||
SELECT
|
||||
tta.agreement_id AS agreementId,
|
||||
bai.id,
|
||||
bai.task_id AS taskId,
|
||||
bcd.type_id AS typeId,
|
||||
SUM(bcd.back_num) AS backNum,
|
||||
bcd.parent_id AS parentId,
|
||||
bcd.create_by AS createBy,
|
||||
bcd.ma_id AS maId,
|
||||
bai.company_id AS companyId
|
||||
FROM
|
||||
back_check_details bcd
|
||||
LEFT JOIN back_apply_info bai ON bai.id = bcd.parent_id
|
||||
LEFT JOIN tm_task_agreement tta ON tta.task_id = bai.task_id
|
||||
WHERE
|
||||
parent_id = #{parentId}
|
||||
GROUP BY bcd.type_id,bcd.ma_id
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
|
@ -21,6 +21,10 @@
|
|||
insert into repair_audit_details (task_id,repair_id,ma_id,type_id,repair_num,repaired_num,scrap_num,status,create_by,create_time,company_id)
|
||||
values (#{taskId},#{id},#{maId},#{typeId},#{repairNum},#{repairedNum},#{scrapNum},'0',#{createBy},now(),#{companyId});
|
||||
</insert>
|
||||
<insert id="addRepairCost">
|
||||
insert into repair_cost (task_id,repair_id,type_id,ma_id,repair_num,costs,part_type,status,company_id)
|
||||
values (#{bean.taskId},#{bean.id},#{bean.typeId},#{bean.maId},#{bean.repairNum},#{costs},#{partType},'0',#{bean.companyId});
|
||||
</insert>
|
||||
<update id="updateRepairedNum">
|
||||
update repair_apply_details
|
||||
set repaired_num = #{repairNum},
|
||||
|
|
|
|||
|
|
@ -1,15 +1,17 @@
|
|||
package com.bonus.sgzb.material.controller;
|
||||
|
||||
import com.bonus.sgzb.base.api.domain.SltAgreementApply;
|
||||
import com.bonus.sgzb.base.api.domain.SltInfoVo;
|
||||
import com.bonus.sgzb.common.core.web.controller.BaseController;
|
||||
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.sgzb.common.core.web.page.TableDataInfo;
|
||||
import com.bonus.sgzb.material.domain.AgreementInfo;
|
||||
import com.bonus.sgzb.material.service.SltAgreementInfoService;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
|
@ -30,8 +32,35 @@ public class SltAgreementInfoController extends BaseController {
|
|||
public TableDataInfo getSltAgreementInfo(AgreementInfo bean)
|
||||
{
|
||||
startPage();
|
||||
List<AgreementInfo> list = service.getSltAgreementInfo(bean);
|
||||
List<AgreementInfo> list = new ArrayList<>();
|
||||
if (bean.getUnitId() == null && bean.getProjectId() == null && bean.getSltStatus()== null){
|
||||
|
||||
}else {
|
||||
list = service.getSltAgreementInfo(bean);
|
||||
}
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据协议获取结算清单
|
||||
*/
|
||||
@ApiOperation(value = "根据协议获取结算清单")
|
||||
@PostMapping("/getSltInfo")
|
||||
public AjaxResult getSltInfo(@RequestBody List<AgreementInfo> list)
|
||||
{
|
||||
SltInfoVo bean = service.getSltInfo(list);
|
||||
return AjaxResult.success(bean);
|
||||
}
|
||||
|
||||
/**
|
||||
* 费用结算提交
|
||||
*/
|
||||
@ApiOperation(value = "费用结算提交")
|
||||
@PostMapping("/submitFee")
|
||||
public AjaxResult submitFee(@RequestBody SltAgreementApply apply)
|
||||
{
|
||||
AjaxResult res = service.submitFee(apply);
|
||||
return res;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -80,6 +80,7 @@ public class RepairTaskDetails {
|
|||
private Long typeId;
|
||||
private Long companyId;
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 任务创建人
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -91,6 +91,7 @@ public class ScrapApplyDetails extends BaseEntity
|
|||
|
||||
@ApiModelProperty(value = "机具编号")
|
||||
private String maCode;
|
||||
private String buyPrice;
|
||||
|
||||
/**
|
||||
* 传入参数
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import com.bonus.sgzb.material.domain.RepairTaskDetails;
|
|||
import com.bonus.sgzb.material.vo.RepairAuditDetailsVO;
|
||||
import com.bonus.sgzb.material.vo.ScrapApplyDetailsVO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
|
@ -142,4 +143,6 @@ public interface RepairAuditDetailsMapper
|
|||
RepairAuditDetails getRepairId(RepairAuditDetails repairAuditDetails);
|
||||
|
||||
List<RepairPart> getPartRecord(RepairAuditDetails bean);
|
||||
|
||||
int updateRepairCost(@Param("inputDetails")RepairAuditDetails inputDetails, @Param("status") String status);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,12 @@
|
|||
package com.bonus.sgzb.material.mapper;
|
||||
|
||||
import com.bonus.sgzb.base.api.domain.SltAgreementInfo;
|
||||
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 org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
|
@ -12,4 +17,14 @@ import java.util.List;
|
|||
@Mapper
|
||||
public interface SltAgreementInfoMapper {
|
||||
List<AgreementInfo> getSltAgreementInfo(AgreementInfo bean);
|
||||
|
||||
List<SltAgreementInfo> getLeaseList(AgreementInfo bean);
|
||||
|
||||
List<TmTask> getTaskList(@Param("bean") AgreementInfo bean, @Param("taskType")String taskType);
|
||||
|
||||
List<SltAgreementInfo> getRepairDetailsList(@Param("taskList") List<TmTask> taskList);
|
||||
|
||||
List<SltAgreementInfo> getScrapDetailsList(@Param("taskList") List<TmTask> taskList);
|
||||
|
||||
List<SltAgreementInfo> getLoseList(AgreementInfo bean);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,8 @@
|
|||
package com.bonus.sgzb.material.service;
|
||||
|
||||
import com.bonus.sgzb.base.api.domain.SltAgreementApply;
|
||||
import com.bonus.sgzb.base.api.domain.SltInfoVo;
|
||||
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.sgzb.material.domain.AgreementInfo;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
|
@ -11,4 +14,8 @@ import java.util.List;
|
|||
*/
|
||||
public interface SltAgreementInfoService {
|
||||
List<AgreementInfo> getSltAgreementInfo(AgreementInfo bean);
|
||||
|
||||
SltInfoVo getSltInfo(List<AgreementInfo> list);
|
||||
|
||||
AjaxResult submitFee(SltAgreementApply apply);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -219,7 +219,6 @@ public class RepairAuditDetailsServiceImpl implements IRepairAuditDetailsService
|
|||
Long typeId = inputDetails.getTypeId();
|
||||
Long maId = inputDetails.getMaId();
|
||||
BigDecimal repairNum = inputDetails.getRepairedNum();
|
||||
|
||||
// 创建修饰后入库任务
|
||||
if (repairNum.compareTo(b) > 0) {
|
||||
// 添加修试后入库任务
|
||||
|
|
@ -236,6 +235,7 @@ public class RepairAuditDetailsServiceImpl implements IRepairAuditDetailsService
|
|||
repairInputDetails.setCompanyId((long) companyId);
|
||||
repairTestInputMapper.insertRepairInputDetails(repairInputDetails);
|
||||
}
|
||||
repairAuditDetailsMapper.updateRepairCost(inputDetails,status);
|
||||
}
|
||||
}
|
||||
if (scrapNumList != null && scrapNumList.size() > 0) {
|
||||
|
|
@ -313,6 +313,8 @@ public class RepairAuditDetailsServiceImpl implements IRepairAuditDetailsService
|
|||
repairTaskDetails.setCompanyId((long) companyId);
|
||||
repairTaskDetails.setBackId(backId);
|
||||
repairAuditDetailsMapper.insertRepairDetails(repairTaskDetails);
|
||||
|
||||
repairAuditDetailsMapper.updateRepairCost(inputDetails,status);
|
||||
}
|
||||
}
|
||||
// 修饰审核任务不通过时
|
||||
|
|
|
|||
|
|
@ -1,11 +1,20 @@
|
|||
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.SltInfoVo;
|
||||
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
|
||||
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 org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
|
@ -21,4 +30,119 @@ public class SltAgreementInfoServiceImpl implements SltAgreementInfoService {
|
|||
public List<AgreementInfo> getSltAgreementInfo(AgreementInfo bean) {
|
||||
return mapper.getSltAgreementInfo(bean);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SltInfoVo getSltInfo(List<AgreementInfo> list) {
|
||||
SltInfoVo sltInfoVo = new SltInfoVo();
|
||||
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);
|
||||
return sltInfoVo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult submitFee(SltAgreementApply apply) {
|
||||
List<String> agreementIds = apply.getAgreementIds();
|
||||
List<AgreementInfo> list = new ArrayList<>();
|
||||
for (String agreementId : agreementIds){
|
||||
AgreementInfo info = new AgreementInfo();
|
||||
info.setAgreementId(Long.valueOf(agreementId));
|
||||
list.add(info);
|
||||
}
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private List<SltAgreementInfo> getLoseList(List<AgreementInfo> list) {
|
||||
List<SltAgreementInfo> loseList = new ArrayList<>();
|
||||
for (AgreementInfo bean : list){
|
||||
List<SltAgreementInfo> oneOflist = mapper.getLoseList(bean);
|
||||
loseList.addAll(oneOflist);
|
||||
}
|
||||
for (SltAgreementInfo bean : loseList){
|
||||
if (bean.getBuyPrice() == null){
|
||||
bean.setBuyPrice("0");
|
||||
}
|
||||
if (bean.getNum() == null){
|
||||
bean.setNum("0");
|
||||
}
|
||||
BigDecimal buyPrice = new BigDecimal(bean.getBuyPrice());
|
||||
BigDecimal num = new BigDecimal(bean.getNum());
|
||||
BigDecimal costs = buyPrice.multiply(num);
|
||||
bean.setCosts(String.valueOf(costs));
|
||||
}
|
||||
return loseList;
|
||||
}
|
||||
|
||||
private List<SltAgreementInfo> getScrapList(List<AgreementInfo> list) {
|
||||
List<SltAgreementInfo> scrapList = new ArrayList<>();
|
||||
String taskType = "57";
|
||||
for (AgreementInfo bean : list){
|
||||
List<TmTask> taskList = mapper.getTaskList(bean,taskType);
|
||||
if (taskList != null && taskList.size() > 0){
|
||||
List<SltAgreementInfo> scrapDetailsList = mapper.getScrapDetailsList(taskList);
|
||||
scrapList.addAll(scrapDetailsList);
|
||||
}
|
||||
}
|
||||
if (scrapList != null && scrapList.size() > 0){
|
||||
for (SltAgreementInfo bean : scrapList){
|
||||
if (bean.getBuyPrice() == null){
|
||||
bean.setBuyPrice("0");
|
||||
}
|
||||
if (bean.getNum() == null){
|
||||
bean.setNum("0");
|
||||
}
|
||||
BigDecimal buyPrice = new BigDecimal(bean.getBuyPrice());
|
||||
BigDecimal num = new BigDecimal(bean.getNum());
|
||||
BigDecimal costs = buyPrice.multiply(num);
|
||||
bean.setCosts(String.valueOf(costs));
|
||||
}
|
||||
}
|
||||
|
||||
return scrapList;
|
||||
}
|
||||
|
||||
private List<SltAgreementInfo> getRepairList(List<AgreementInfo> list) {
|
||||
List<SltAgreementInfo> repairList = new ArrayList<>();
|
||||
String taskType = "41";
|
||||
for (AgreementInfo bean : list){
|
||||
List<TmTask> taskList = mapper.getTaskList(bean,taskType);
|
||||
if (taskList != null && taskList.size() > 0){
|
||||
List<SltAgreementInfo> repairDetailsList = mapper.getRepairDetailsList(taskList);
|
||||
repairList.addAll(repairDetailsList);
|
||||
}
|
||||
}
|
||||
return repairList;
|
||||
}
|
||||
|
||||
private List<SltAgreementInfo> getLeaseList(List<AgreementInfo> list) {
|
||||
List<SltAgreementInfo> leaseList = new ArrayList<>();
|
||||
for (AgreementInfo bean : list){
|
||||
List<SltAgreementInfo> oneOflist = mapper.getLeaseList(bean);
|
||||
leaseList.addAll(oneOflist);
|
||||
}
|
||||
for (SltAgreementInfo bean : leaseList){
|
||||
if (bean.getLeasePrice() == null){
|
||||
bean.setLeasePrice("0");
|
||||
}
|
||||
if (bean.getNum() == null){
|
||||
bean.setNum("0");
|
||||
}
|
||||
if (bean.getLeaseDays() == null){
|
||||
bean.setLeaseDays("0");
|
||||
}
|
||||
BigDecimal leasePrice = new BigDecimal(bean.getLeasePrice());
|
||||
BigDecimal num = new BigDecimal(bean.getNum());
|
||||
BigDecimal leaseDays = new BigDecimal(bean.getLeaseDays());
|
||||
BigDecimal costs = leasePrice.multiply(num).multiply(leaseDays);
|
||||
bean.setCosts(String.valueOf(costs));
|
||||
}
|
||||
return leaseList;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -218,6 +218,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
audit_remark = #{auditRemark}
|
||||
where id = #{id}
|
||||
</update>
|
||||
<update id="updateRepairCost">
|
||||
update repair_cost
|
||||
set part_type = #{status}
|
||||
where repair_id = #{inputDetails.repairId}
|
||||
</update>
|
||||
|
||||
<delete id="deleteRepairAuditDetailsById" parameterType="Long">
|
||||
delete from repair_audit_details where id = #{id}
|
||||
|
|
|
|||
|
|
@ -4,14 +4,37 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.bonus.sgzb.material.mapper.SltAgreementInfoMapper">
|
||||
|
||||
<resultMap type="com.bonus.sgzb.material.domain.AgreementInfo" id="BmAgreementInfoResult">
|
||||
<result property="agreementId" column="agreement_id"/>
|
||||
<result property="agreementCode" column="agreement_code"/>
|
||||
<result property="signTime" column="sign_time"/>
|
||||
<result property="unitId" column="unit_id"/>
|
||||
<result property="unitName" column="unit_name"/>
|
||||
<result property="projectId" column="project_id"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="leaseDay" column="lease_day"/>
|
||||
<result property="planStartTime" column="plan_start_time"/>
|
||||
<result property="contractCode" column="contract_code"/>
|
||||
<result property="authPerson" column="auth_person"/>
|
||||
<result property="phone" column="phone"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="remark" column="remark"/>
|
||||
<result property="protocol" column="protocol"/>
|
||||
<result property="companyId" column="company_id"/>
|
||||
<result property="fileName" column="file_name"/>
|
||||
<result property="fileUrl" column="file_url"/>
|
||||
</resultMap>
|
||||
|
||||
<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,
|
||||
plan_start_time,lease_day,auth_person,phone,bai.remark,bai.protocol,saa.cost as cost
|
||||
plan_start_time,lease_day,auth_person,phone,bai.remark,bai.protocol,sar.cost as cost
|
||||
FROM bm_agreement_info bai
|
||||
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
|
||||
left join slt_agreement_apply saa on bai.agreement_id = saa.agreement_id
|
||||
left join slt_agreement_relation sar on bai.agreement_id = sar.agreement_id
|
||||
where bai.status = '1'
|
||||
<if test="unitId != null and unitId != ''">
|
||||
and bui.unit_id = #{unitId}
|
||||
|
|
@ -19,22 +42,133 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="projectId != null and projectId != ''">
|
||||
and bp.lot_id = #{projectId}
|
||||
</if>
|
||||
<if test="sltStatus != null and sltStatus != ''">
|
||||
<choose>
|
||||
<when test="sltStatus == '1'">
|
||||
<when test="sltStatus == '1'.toString()">
|
||||
and saa.id is null
|
||||
</when>
|
||||
<when test="sltStatus == '2'">
|
||||
<when test="sltStatus == '2'.toString()">
|
||||
and saa.status = '0'
|
||||
</when>
|
||||
<when test="sltStatus == '3'">
|
||||
<when test="sltStatus == '3'.toString()">
|
||||
and saa.status = '1'
|
||||
</when>
|
||||
<otherwise>
|
||||
|
||||
</otherwise>
|
||||
</choose>
|
||||
</if>
|
||||
ORDER BY bai.agreement_id asc
|
||||
ORDER BY bai.agreement_id desc
|
||||
</select>
|
||||
|
||||
<select id="getLeaseList" resultType="com.bonus.sgzb.base.api.domain.SltAgreementInfo">
|
||||
select sai.id,
|
||||
sai.agreement_id as agreementId,
|
||||
bui.unit_name as unitName,
|
||||
bp.lot_name as projectName,
|
||||
sai.agreement_id as agreementId,
|
||||
sai.type_id as typeId,
|
||||
sai.ma_id as maId,
|
||||
mt1.type_name as typeName,
|
||||
mt.type_name as modelName,
|
||||
mt.unit_name as nuitName,
|
||||
sai.lease_price as leasePrice,
|
||||
sai.num as num,
|
||||
sai.start_time as startTime,
|
||||
sai.end_time as endTime,
|
||||
DATEDIFF(sai.end_time, sai.start_time) + 1 as leaseDays
|
||||
from slt_agreement_info sai
|
||||
LEFT JOIN bm_agreement_info bai on sai.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
|
||||
left join ma_type mt on sai.type_id = mt.type_id
|
||||
left join ma_type mt1 on mt.parent_id = mt1.type_id
|
||||
where sai.agreement_id = #{agreementId} and sai.end_time is not null
|
||||
</select>
|
||||
<select id="getLoseList" resultType="com.bonus.sgzb.base.api.domain.SltAgreementInfo">
|
||||
select sai.id,
|
||||
sai.agreement_id as agreementId,
|
||||
bui.unit_name as unitName,
|
||||
bp.lot_name as projectName,
|
||||
sai.agreement_id as agreementId,
|
||||
sai.type_id as typeId,
|
||||
sai.ma_id as maId,
|
||||
mt1.type_name as typeName,
|
||||
mt.type_name as modelName,
|
||||
mt.unit_name as nuitName,
|
||||
sai.buy_price as buyPrice,
|
||||
sai.num as num,
|
||||
sai.start_time as startTime,
|
||||
sai.end_time as endTime,
|
||||
DATEDIFF(sai.end_time, sai.start_time) + 1 as leaseDays
|
||||
from slt_agreement_info sai
|
||||
LEFT JOIN bm_agreement_info bai on sai.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
|
||||
left join ma_type mt on sai.type_id = mt.type_id
|
||||
left join ma_type mt1 on mt.parent_id = mt1.type_id
|
||||
where sai.agreement_id = #{agreementId} and sai.end_time is null
|
||||
</select>
|
||||
<select id="getTaskList" resultType="com.bonus.sgzb.material.domain.TmTask">
|
||||
select tt.task_id as taskId
|
||||
from tm_task_agreement tta
|
||||
left join tm_task tt on tta.task_id = tt.task_id
|
||||
where tta.agreement_id = #{bean.agreementId} and tt.task_type = #{taskType}
|
||||
</select>
|
||||
<select id="getRepairDetailsList" resultType="com.bonus.sgzb.base.api.domain.SltAgreementInfo">
|
||||
select tta.agreement_id as agreementId,
|
||||
bui.unit_name as unitName,
|
||||
bp.lot_name as projectName,
|
||||
rc.type_id as typeId,
|
||||
rc.ma_id as maId,
|
||||
mt1.type_name as typeName,
|
||||
mt.type_name as modelName,
|
||||
mt.unit_name as nuitName,
|
||||
sum(rc.repair_num) as num,
|
||||
sum(rc.costs) as costs,
|
||||
rc.part_type as partType,
|
||||
rc.status as repairStatus
|
||||
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
|
||||
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
|
||||
left join ma_type mt on rc.type_id = mt.type_id
|
||||
left join ma_type mt1 on mt.parent_id = mt1.type_id
|
||||
where rc.status in ('0','1')
|
||||
<if test="taskList != null and taskList.size() > 0">
|
||||
and rc.task_id in
|
||||
<foreach item="task" collection="taskList" open="(" separator="," close=")">
|
||||
#{task.taskId}
|
||||
</foreach>
|
||||
</if>
|
||||
group by rc.type_id,rc.ma_id,rc.part_type,rc.status
|
||||
</select>
|
||||
<select id="getScrapDetailsList" resultType="com.bonus.sgzb.base.api.domain.SltAgreementInfo">
|
||||
select tta.agreement_id as agreementId,
|
||||
bui.unit_name as unitName,
|
||||
bp.lot_name as projectName,
|
||||
sad.type_id as typeId,
|
||||
sad.ma_id as maId,
|
||||
mt1.type_name as typeName,
|
||||
mt.type_name as modelName,
|
||||
mt.unit_name as nuitName,
|
||||
sum(sad.scrap_num) as num,
|
||||
mt.buy_price as buyPrice,
|
||||
sad.scrap_type as scrapType
|
||||
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
|
||||
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
|
||||
left join ma_type mt on sad.type_id = mt.type_id
|
||||
left join ma_type mt1 on mt.parent_id = mt1.type_id
|
||||
where 1=1
|
||||
<if test="taskList != null and taskList.size() > 0">
|
||||
and sad.task_id in
|
||||
<foreach item="task" collection="taskList" open="(" separator="," close=")">
|
||||
#{task.taskId}
|
||||
</foreach>
|
||||
</if>
|
||||
group by sad.type_id,sad.ma_id,sad.scrap_type
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue