问题修复

This commit is contained in:
hongchao 2025-10-24 17:06:51 +08:00
parent 63db53eda8
commit 83abe82c26
38 changed files with 844 additions and 53 deletions

View File

@ -193,4 +193,8 @@ public class LeaseOutDetails implements Serializable {
private int postStoreNum;
private String token;
private Integer day;
private BigDecimal leaseMoney;
}

View File

@ -237,4 +237,9 @@ public class SltAgreementInfo {
private int manageType;
/**
* 是否根据同类型最大结算时间得来01
*/
private Integer isMaxEndTime;
}

View File

@ -88,6 +88,8 @@ public interface LeaseOutDetailsMapper {
int insSltInfo(@Param("record") LeaseOutDetails record, @Param("agreementId")String agreementId,@Param("ma") MaType ma);
int insertMonthTempInfo(@Param("record") LeaseOutDetails record, @Param("agreementId")String agreementId,@Param("ma") MaType ma);
SltAgreementInfo getSltAgreementInfo(LeaseOutDetails record);
int updSltInfo(SltAgreementInfo sltAgreementInfo);

View File

@ -35,6 +35,7 @@ import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.YearMonth;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.util.*;
/**
@ -472,6 +473,46 @@ public class LeaseOutDetailsServiceImpl implements LeaseOutDetailsService {
throw new RuntimeException("出库失败,插入结算记录失败");
}
record.setPostStoreNum(getStorageNum(record));
/************************** 判断是否是补做的单子如果是补做的单子需要往project_temp_cost表插入冲减账数据 **********************/
// 1. 计算当前时间的业务月份21日及以后属于下一个业务月
LocalDate currentLocalDate = LocalDate.now();
LocalDate currentBusinessMonthDate = currentLocalDate.getDayOfMonth() > 20
? currentLocalDate.plusMonths(1) // 21日及以后业务月为下一月
: currentLocalDate; // 20日及以前业务月为当月
String currentBusinessMonth = currentBusinessMonthDate.format(DateTimeFormatter.ofPattern("yyyyMM"));
// 2. 计算创建时间的业务月份
Date createTime = record.getCreateTime();
if (createTime == null) {
throw new RuntimeException("出库时间不能为空,无法判断是否为补做单子");
}
LocalDate createLocalDate = createTime.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
LocalDate createBusinessMonthDate = createLocalDate.getDayOfMonth() > 20
? createLocalDate.plusMonths(1) // 21日及以后业务月为下一月
: createLocalDate; // 20日及以前业务月为当月
String createBusinessMonth = createBusinessMonthDate.format(DateTimeFormatter.ofPattern("yyyyMM"));
// 3. 判断创建时间业务月份是否早于当前业务月份
if (createBusinessMonth.compareTo(currentBusinessMonth) < 0) {
// 补做单子逻辑往project_temp_cost表插入冲减账数据
// 计算当前时间与创建时间的天数差包含两端日期例如5月12日-5月20日为9天
Date currentDate = Date.from(currentLocalDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
Date createDate = Date.from(createLocalDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
// 使用DateUtil计算天数差false表示不包含结束日期+1转为包含两端日期的差
long dayDifference = DateUtil.betweenDay(createDate, currentDate, false) + 1;
record.setDay((int) dayDifference);
res = insSltInfoTemp(taskId, record);
if (res == 0) {
throw new RuntimeException("插入月结冲减账表失败");
}
}
/************************** 判断是否是补做的单子如果是补做的单子需要往project_temp_cost表插入冲减账数据 **********************/
} else {
return AjaxResult.error("领料出库失败,机具库存不足");
}
@ -719,6 +760,44 @@ public class LeaseOutDetailsServiceImpl implements LeaseOutDetailsService {
return res;
}
public int insSltInfoTemp(String taskId, LeaseOutDetails record) {
int res = 0;
String agreementId = leaseOutDetailsMapper.getAgreementId(taskId);
String protocol = leaseOutDetailsMapper.getProtocol(agreementId);
MaType ma = leaseOutDetailsMapper.getMaType(record.getTypeId());
Integer replaceTypeId = record.getReplaceTypeId();
if (StringUtils.isEmpty(protocol)) {
if(replaceTypeId != null){
ma.setFinalPrice(record.getLeasePrice());
ma.setTypeName(record.getMaName());
ma.setModelName(record.getMaModel());
ma.setReplaceTypeId(record.getReplaceTypeId());
}else{
ma.setFinalPrice(ma.getLeasePrice());
}
} else {
if (Constants.INNER_PROTOCAL.equals(protocol)) {
if(replaceTypeId != null){
ma.setFinalPrice(record.getLeasePrice());
}else{
ma.setFinalPrice(ma.getLeasePrice());
}
} else if (Constants.OUTER_PROTOCAL.equals(protocol)) {
ma.setFinalPrice(ma.getRentPrice());
} else {
ma.setFinalPrice(ma.getLeasePrice());
}
}
record.setLeaseMoney(ma.getFinalPrice().multiply(BigDecimal.valueOf(record.getOutNum())).multiply(BigDecimal.valueOf(record.getDay())));
res = leaseOutDetailsMapper.insertMonthTempInfo(record, agreementId, ma);
return res;
}
/**
* @param maCode 编码ID
* @return 数据

View File

@ -260,7 +260,7 @@ public class TmTaskServiceImpl implements TmTaskService {
public List<TmTask> getLeaseAuditListByOne(TmTask record) {
Set<String> roles = SecurityUtils.getLoginUser().getRoles();
List<TmTask> leaseDetailByParentId = new ArrayList<>();
if (roles.contains(STRING_ADMIN) || roles.contains("sysadmin")) {
if (roles.contains(STRING_ADMIN) || roles.contains("sysadmin") || roles.contains("jjfgs-jhdpzy") || roles.contains("jjfgs-sbbz") || roles.contains("jjfgs-sbfbz")) {
leaseDetailByParentId = tmTaskMapper.getLeaseDetailByParentIdTwo(record);
} else {
leaseDetailByParentId = tmTaskMapper.getLeaseDetailByParentId(record);
@ -466,7 +466,7 @@ public class TmTaskServiceImpl implements TmTaskService {
public List<TmTask> getLeaseAuditList(TmTask record) {
Set<String> roles = SecurityUtils.getLoginUser().getRoles();
List<TmTask> tmTaskList;
if (roles.contains(STRING_ADMIN) || roles.contains("sysadmin")) {
if (roles.contains(STRING_ADMIN) || roles.contains("sysadmin") || roles.contains("jjfgs-jhdpzy") || roles.contains("jjfgs-sbbz") || roles.contains("jjfgs-sbfbz")) {
tmTaskList = tmTaskMapper.getAuditListByLeaseTmTask(record);
} else {
long username = SecurityUtils.getLoginUser().getUserid();
@ -712,7 +712,7 @@ public class TmTaskServiceImpl implements TmTaskService {
public List<TmTask> getLeaseOutListByUser(TmTask task) {
Set<String> roles = SecurityUtils.getLoginUser().getRoles();
List<TmTask> tmTaskList;
if (roles.contains(STRING_ADMIN) || roles.contains("sysadmin")) {
if (roles.contains(STRING_ADMIN) || roles.contains("sysadmin") || roles.contains("jjfgs-jhdpzy") || roles.contains("jjfgs-sbbz") || roles.contains("jjfgs-sbfbz")) {
tmTaskList = tmTaskMapper.getLeaseOutList(task);
} else {

View File

@ -64,4 +64,6 @@ public interface MaMachineMapper {
* @return
*/
List<MaMachine> getMachineList(MaMachine maMachine);
List<MaMachine> selectMaMachineByMaCode(MaMachine maMachine);
}

View File

@ -156,6 +156,11 @@ public class MaMachineServiceImpl implements MaMachineService {
@Override
@Transactional
public int updateMaMachine(MaMachine maMachine) {
//判断固定资产编号是否重复
List<MaMachine> maMachine1 = maMachineMapper.selectMaMachineByMaCode(maMachine);
if (maMachine1 != null && maMachine1.size() > 0) {
throw new ServiceException("固定资产编号已存在,请重新输入");
}
// 删除类型和资产属性绑定关系
maPropInfoMapper.deleteMaPropSetByPropIds(maMachine.getTypeId());
// 新增机具和资产属性绑定关系

View File

@ -62,7 +62,7 @@ public class RepairServiceImpl implements RepairService {
public List<RepairTask> getRepairTaskListNew(RepairTask bean) {
Set<String> roles = SecurityUtils.getLoginUser().getRoles();
List<RepairTask> repairTaskList = new ArrayList<>();
if (roles.contains(STRING_ADMIN) || roles.contains("sysadmin")) {
if (roles.contains(STRING_ADMIN) || roles.contains("sysadmin") || roles.contains("jjfgs-jhdpzy") || roles.contains("jjfgs-sbbz") || roles.contains("jjfgs-sbfbz")) {
repairTaskList = mapper.getRepairTaskListNew(bean);
}else{
Long companyId = SecurityUtils.getLoginUser().getSysUser().getCompanyId();
@ -91,7 +91,7 @@ public class RepairServiceImpl implements RepairService {
Set<String> roles = SecurityUtils.getLoginUser().getRoles();
List<RepairTaskDetails> repairMaTypeList = new ArrayList<>();
if (roles.contains(STRING_ADMIN) || roles.contains("sysadmin")) {
if (roles.contains(STRING_ADMIN) || roles.contains("sysadmin") || roles.contains("jjfgs-jhdpzy") || roles.contains("jjfgs-sbbz") || roles.contains("jjfgs-sbfbz")) {
repairMaTypeList = mapper.getRepairMaTypeList(bean);
}else{
Long companyId = SecurityUtils.getLoginUser().getSysUser().getCompanyId();
@ -118,7 +118,7 @@ public class RepairServiceImpl implements RepairService {
Set<String> roles = SecurityUtils.getLoginUser().getRoles();
List<RepairTaskDetails> repairMaTypeList = new ArrayList<>();
if (roles.contains(STRING_ADMIN) || roles.contains("sysadmin")) {
if (roles.contains(STRING_ADMIN) || roles.contains("sysadmin") || roles.contains("jjfgs-jhdpzy") || roles.contains("jjfgs-sbbz") || roles.contains("jjfgs-sbfbz")) {
repairMaTypeList = mapper.getRepairMaTypeListNew(bean);
}else{
Long companyId = SecurityUtils.getLoginUser().getSysUser().getCompanyId();
@ -156,7 +156,7 @@ public class RepairServiceImpl implements RepairService {
Set<String> roles = SecurityUtils.getLoginUser().getRoles();
List<RepairTaskDetails> repairMaTypeList = new ArrayList<>();
if (roles.contains(STRING_ADMIN) || roles.contains("sysadmin")) {
if (roles.contains(STRING_ADMIN) || roles.contains("sysadmin") || roles.contains("jjfgs-jhdpzy") || roles.contains("jjfgs-sbbz") || roles.contains("jjfgs-sbfbz")) {
repairMaTypeList = mapper.getRepairNew(bean);
}else{
Long companyId = SecurityUtils.getLoginUser().getSysUser().getCompanyId();
@ -417,6 +417,7 @@ public class RepairServiceImpl implements RepairService {
RepairApplyRecord beanTempTwo = new RepairApplyRecord();
beanTempTwo.setTypeId(bean.getTypeId());
beanTempTwo.setMaId(bean.getMaId());
beanTempTwo.setParentId(Math.toIntExact(beanTemp.getId()));
beanTempTwo.setPartId(Math.toIntExact(partDetails.getPartId()));
beanTempTwo.setPartPrice(partDetails.getPartCost());
@ -452,6 +453,7 @@ public class RepairServiceImpl implements RepairService {
RepairApplyRecord beanTempTwo = new RepairApplyRecord();
beanTempTwo.setTypeId(bean.getTypeId());
beanTempTwo.setMaId(bean.getMaId());
beanTempTwo.setParentId(Math.toIntExact(beanTemp.getId()));
beanTempTwo.setPartId(null);
beanTempTwo.setPartPrice(null);
@ -1039,6 +1041,7 @@ public class RepairServiceImpl implements RepairService {
RepairApplyRecord beanTempTwo = new RepairApplyRecord();
beanTempTwo.setTypeId(bean.getTypeId());
beanTempTwo.setMaId(bean.getMaId());
beanTempTwo.setParentId(Math.toIntExact(beanTemp.getId()));
beanTempTwo.setPartId(Math.toIntExact(partDetails.getPartId()));
beanTempTwo.setPartPrice(partDetails.getPartCost());
@ -1074,6 +1077,7 @@ public class RepairServiceImpl implements RepairService {
RepairApplyRecord beanTempTwo = new RepairApplyRecord();
beanTempTwo.setTypeId(bean.getTypeId());
beanTempTwo.setMaId(bean.getMaId());
beanTempTwo.setParentId(Math.toIntExact(beanTemp.getId()));
beanTempTwo.setPartId(null);
beanTempTwo.setPartPrice(null);

View File

@ -10,6 +10,7 @@ import com.bonus.sgzb.common.log.annotation.Log;
import com.bonus.sgzb.common.log.enums.BusinessType;
import com.bonus.sgzb.common.security.annotation.RequiresPermissions;
import com.bonus.sgzb.material.domain.BackRecord;
import com.bonus.sgzb.material.domain.RepairFixRecord;
import com.bonus.sgzb.material.domain.RepairRecord;
import com.bonus.sgzb.material.service.BackRecordService;
import com.bonus.sgzb.material.service.RepairRecordService;
@ -70,4 +71,28 @@ public class RepairRecordController extends BaseController {
util.exportExcel(response, list, "综合查询--维修记录");
}
/**
* 维修记录列表
*/
@ApiOperation(value = "综合查询--维修损坏记录列表")
@GetMapping("/getRepairFixRecordList")
public AjaxResult getRepairFixRecordList(RepairFixRecord bean) {
List<RepairFixRecord> list = repairRecordService.getRepairFixRecordList(bean);
Integer pageIndex = Convert.toInt(ServletUtils.getParameter(PAGE_NUM), 1);
Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10);
return AjaxResult.success(ListPagingUtil.paging(pageIndex, pageSize, list));
}
/**
* 导出综合查询维修损坏记录列表
*/
@ApiOperation("导出综合查询维修损坏记录列表")
@Log(title = "导出综合查询维修损坏记录列表", businessType = BusinessType.EXPORT)
@PostMapping("/exportFixRecord")
public void exportFixRecord(HttpServletResponse response, RepairFixRecord bean)
{
List<RepairFixRecord> list = repairRecordService.getRepairFixRecordList(bean);
ExcelUtil<RepairFixRecord> util = new ExcelUtil<RepairFixRecord>(RepairFixRecord.class);
util.exportExcel(response, list, "综合查询--维修损坏记录");
}
}

View File

@ -326,7 +326,7 @@ public class SltAgreementInfoController extends BaseController {
projectNames.add(info.getProjectName());
unitNames.add(info.getUnitName());
}
List<SltAgreementInfo> explist = sltAgreementInfoService.getLeaseListOne(list);
List<SltAgreementInfo> explist = sltAgreementInfoService.getLeaseListOneFinish(list);
String projectName = handleData(projectNames);
String unitName = handleData(unitNames);
BigDecimal totalCost = BigDecimal.valueOf(0.00);
@ -365,16 +365,16 @@ public class SltAgreementInfoController extends BaseController {
List<LeaseInfo> leaseInfoListThree = new ArrayList<>();
if(Objects.equals(info.getCostBearingParty(), "01")){
// 获取导出数据
explist = sltAgreementInfoService.getLeaseListOne(Collections.singletonList(info));
explist = sltAgreementInfoService.getLeaseListOneFinish(Collections.singletonList(info));
leaseInfoList = Convert.toList(LeaseInfo.class, explist);
}else if(Objects.equals(info.getCostBearingParty(), "03")){
// 获取导出数据
explistThree = sltAgreementInfoService.getLeaseListThree(Collections.singletonList(info));
explistThree = sltAgreementInfoService.getLeaseListThreeFinish(Collections.singletonList(info));
leaseInfoListThree = Convert.toList(LeaseInfo.class, explistThree);
}else{
// 获取导出数据
explist = sltAgreementInfoService.getLeaseListOne(Collections.singletonList(info));
explistThree = sltAgreementInfoService.getLeaseListThree(Collections.singletonList(info));
explist = sltAgreementInfoService.getLeaseListOneFinish(Collections.singletonList(info));
explistThree = sltAgreementInfoService.getLeaseListThreeFinish(Collections.singletonList(info));
leaseInfoList = Convert.toList(LeaseInfo.class, explist);
leaseInfoListThree = Convert.toList(LeaseInfo.class, explistThree);
}
@ -774,7 +774,7 @@ public class SltAgreementInfoController extends BaseController {
projectNames.add(info.getProjectName());
unitNames.add(info.getUnitName());
}
List<SltAgreementInfo> explist = sltAgreementInfoService.getLeaseListThree(list);
List<SltAgreementInfo> explist = sltAgreementInfoService.getLeaseListThreeFinish(list);
String projectName = handleData(projectNames);
String unitName = handleData(unitNames);
BigDecimal totalCost = BigDecimal.valueOf(0.00);
@ -946,7 +946,7 @@ public class SltAgreementInfoController extends BaseController {
// calcMonthlyService.calcMonthInfo(1);
// } else {
// int calDay = Integer.parseInt(settlementJobDay);
calcMonthlyService.calcMonthInfo(30);
calcMonthlyService.calcMonthInfo(20);
// }
} catch (Exception e) {

View File

@ -43,11 +43,20 @@ public class BackRecord {
@Excel(name = "机具规格",sort=2)
private String typeModelName;
/** 资产属性id */
@ApiModelProperty(value = "资产属性id")
private Integer propId;
/** 资产属性名称 */
@ApiModelProperty(value = "资产属性名称")
@Excel(name = "资产属性",sort = 3)
private String propName;
/**
* 退料单号
*/
@ApiModelProperty(value = "退料单号")
@Excel(name = "退料单号",sort=3)
@Excel(name = "退料单号",sort=4)
private String code;
/**
@ -60,7 +69,7 @@ public class BackRecord {
* 设备编码
*/
@ApiModelProperty(value = "设备编码")
@Excel(name = "设备编码",sort=4)
@Excel(name = "设备编码",sort=5)
private String maCode;
/**
@ -73,14 +82,14 @@ public class BackRecord {
* 退料数量
*/
@ApiModelProperty(value = "退料数量")
@Excel(name = "退料数量",cellType = Excel.ColumnType.NUMERIC,sort=5)
@Excel(name = "退料数量",cellType = Excel.ColumnType.NUMERIC,sort=6)
private Integer backNum;
/**
* 备注
*/
@Excel(name = "损坏情况",sort=6)
@Excel(name = "损坏情况",sort=7)
@ApiModelProperty(value = "备注")
private String remark;
@ -88,7 +97,7 @@ public class BackRecord {
* 退料人
*/
@ApiModelProperty(value = "退料人")
@Excel(name = "退料人",sort=7)
@Excel(name = "退料人",sort=8)
private String backPerson;
@ -105,7 +114,7 @@ public class BackRecord {
@ApiModelProperty(value = "制单日期")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "制单日期", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss",sort=8)
@Excel(name = "制单日期", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss",sort=9)
private Date createTime;
/**
@ -114,7 +123,7 @@ public class BackRecord {
@ApiModelProperty(value = "回库日期")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "回库日期", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss",sort=9)
@Excel(name = "回库日期", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss",sort=10)
private Date backTime;
/**
@ -141,7 +150,7 @@ public class BackRecord {
* 退料单位
*/
@ApiModelProperty(value = "退料单位")
@Excel(name = "退料单位",sort=10)
@Excel(name = "退料单位",sort=11)
private String unitName;
/**
@ -154,7 +163,7 @@ public class BackRecord {
* 退料工程
*/
@ApiModelProperty(value = "退料工程")
@Excel(name = "退料工程",sort=11,width = 30)
@Excel(name = "退料工程",sort=12,width = 30)
private String proName;

View File

@ -64,6 +64,15 @@ public class InputRecord {
@Excel(name = "单位")
private String unit;
/** 资产属性id */
@ApiModelProperty(value = "资产属性id")
private Integer propId;
/** 资产属性名称 */
@ApiModelProperty(value = "资产属性名称")
@Excel(name = "资产属性")
private String propName;
/**
* 入库数量
*/

View File

@ -67,18 +67,27 @@ public class LeaseRecord{
@Excel(name = "单位",sort = 5)
private String unit;
/** 资产属性id */
@ApiModelProperty(value = "资产属性id")
private Integer propId;
/** 资产属性名称 */
@ApiModelProperty(value = "资产属性名称")
@Excel(name = "资产属性",sort = 6)
private String propName;
/**
* 预领料数
*/
@ApiModelProperty(value = "预领料数")
@Excel(name = "领料数量",cellType = Excel.ColumnType.NUMERIC,sort = 6)
@Excel(name = "领料数量",cellType = Excel.ColumnType.NUMERIC,sort = 7)
private Integer preNum;
/**
* 领料人
*/
@ApiModelProperty(value = "领料人")
@Excel(name = "领料人",sort = 7)
@Excel(name = "领料人",sort = 8)
private String leasePerson;
/**
@ -100,7 +109,7 @@ public class LeaseRecord{
@ApiModelProperty(value = "申请日期")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "申请日期", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss",sort = 8)
@Excel(name = "申请日期", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss",sort = 9)
private Date leaseTime;
/**
@ -109,7 +118,7 @@ public class LeaseRecord{
@ApiModelProperty(value = "出库日期")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "出库日期", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss",sort = 9)
@Excel(name = "出库日期", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss",sort = 10)
private Date createTime;
/**
@ -136,7 +145,7 @@ public class LeaseRecord{
* 领料单位
*/
@ApiModelProperty(value = "领料单位")
@Excel(name = "领料单位",sort = 10)
@Excel(name = "领料单位",sort = 11)
private String unitName;
/**
@ -149,7 +158,7 @@ public class LeaseRecord{
* 领料工程
*/
@ApiModelProperty(value = "领料工程")
@Excel(name = "领料工程",sort = 11,width = 30)
@Excel(name = "领料工程",sort = 12,width = 30)
private String proName;
/**

View File

@ -21,47 +21,56 @@ public class OutRecord {
private static final long serialVersionUID = 2227217051604273598L;
@ApiModelProperty(value = "领料单号")
@Excel(name = "领料单号")
@Excel(name = "领料单号",sort = 1)
private String code;
@ApiModelProperty(value = "工程名称")
@Excel(name = "工程名称")
@Excel(name = "工程名称",sort = 3)
private String lotName;
@ApiModelProperty(value = "单位id")
@Excel(name = "单位",sort = 6)
private String unitId;
@ApiModelProperty(value = "工程id")
private String lotId;
@ApiModelProperty(value = "领料单位")
@Excel(name = "领料单位")
@Excel(name = "领料单位",sort = 2)
private String unitName;
@ApiModelProperty(value = "规格型号")
@Excel(name = "规格型号")
@Excel(name = "规格型号",sort = 5)
private String typeModelName;
@ApiModelProperty(value = "机具名称")
@Excel(name = "机具名称")
@Excel(name = "机具名称",sort = 4)
private String typeName;
/** 资产属性id */
@ApiModelProperty(value = "资产属性id")
private Integer propId;
/** 资产属性名称 */
@ApiModelProperty(value = "资产属性名称")
@Excel(name = "资产属性",sort = 7)
private String propName;
@ApiModelProperty(value = "设备编码")
@Excel(name = "设备编码")
@Excel(name = "设备编码",sort = 8)
private String maCode;
@ApiModelProperty(value = "出库时间")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "出库时间")
@Excel(name = "出库时间",sort = 9)
private Date createTime;
@ApiModelProperty(value = "出库数量")
@Excel(name = "出库数量")
@Excel(name = "本次出库数量",sort = 10)
private Integer outNum;
@ApiModelProperty(value = "设备状态")
@Excel(name = "设备状态")
private String maStauts;
@ApiModelProperty(value = "开始时间")

View File

@ -103,6 +103,15 @@ public class ProjUsingRecord {
@Excel(name = "单位")
private String unit;
/** 资产属性id */
@ApiModelProperty(value = "资产属性id")
private Integer propId;
/** 资产属性名称 */
@ApiModelProperty(value = "资产属性名称")
@Excel(name = "资产属性")
private String propName;
/**
* 租赁数量
*/

View File

@ -0,0 +1,106 @@
package com.bonus.sgzb.material.domain;
import com.bonus.sgzb.common.core.annotation.Excel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* @author c liu
* @date 2023/12/11
*/
@Data
@ApiModel(value="维修任务详细")
public class RepairFixRecord implements Serializable {
private static final long serialVersionUID = 1L;
private Long id;
/**
* 机具ID
*/
@ApiModelProperty(value = "机具ID")
private String maId;
/**
* 机具编号
*/
@ApiModelProperty(value = "机具编号")
@Excel(name = "机具编号",sort = 4)
private String maCode;
/**
* 规格ID
*/
@ApiModelProperty(value = "规格ID")
private String typeId;
/**
* 维修数量
*/
@ApiModelProperty(value = "维修数量")
@Excel(name = "维修次数",sort = 5)
private int repairNum;
/**
* 退料数量
*/
@ApiModelProperty(value = "退料数量")
@Excel(name = "退料次数",sort = 6)
private int backNum;
/**
* 损坏比例
*/
@ApiModelProperty(value = "损坏比例")
@Excel(name = "损坏比例",sort = 8)
private String damageRate;
/**
* 维修费用
*/
@ApiModelProperty(value = "维修费用")
@Excel(name = "维修费用",sort = 7)
private BigDecimal cost;
/**
* 机具类型
*/
@Excel(name = "机具类型",sort=1)
private String typeName;
/**
* 规格型号
*/
@Excel(name = "规格型号",sort=2)
private String typeModelName;
/**
* 关键字
*/
@ApiModelProperty(value = "关键字")
private String keyWord;
/**
* 部门id
*/
@ApiModelProperty(value = "部门id")
private Integer deptId;
/**
* 是否显示
*/
@ApiModelProperty(value = "是否显示")
private String isView;
/** 资产属性id */
@ApiModelProperty(value = "资产属性id")
private Integer propId;
/** 资产属性名称 */
@ApiModelProperty(value = "资产属性名称")
@Excel(name = "资产属性",sort = 3)
private String propName;
}

View File

@ -201,4 +201,9 @@ public class RepairRecord implements Serializable {
*/
@ApiModelProperty(value = "是否显示")
private String isView;
/** 资产属性id */
@ApiModelProperty(value = "资产属性id")
private Integer propId;
}

View File

@ -87,6 +87,16 @@ public class ScrapRecord {
@Excel(name = "单位")
private String unit;
/** 资产属性id */
@ApiModelProperty(value = "资产属性id")
private Integer propId;
/** 资产属性名称 */
@ApiModelProperty(value = "资产属性名称")
@Excel(name = "资产属性")
private String propName;
/**
* 协议号
*/

View File

@ -58,6 +58,15 @@ public class StorageStatus {
@Excel(name = "单位")
private String unit;
/** 资产属性id */
@ApiModelProperty(value = "资产属性id")
private Integer propId;
/** 资产属性名称 */
@ApiModelProperty(value = "资产属性名称")
@Excel(name = "资产属性")
private String propName;
/**
* 在库数量
*/

View File

@ -1,5 +1,6 @@
package com.bonus.sgzb.material.mapper;
import com.bonus.sgzb.material.domain.RepairFixRecord;
import com.bonus.sgzb.material.domain.RepairRecord;
import com.bonus.sgzb.material.vo.RepairAuditDetailsNew;
import com.bonus.sgzb.material.vo.RepairAuditDetailsNewQuery;
@ -22,4 +23,5 @@ public interface RepairRecordMapper {
*/
List<RepairAuditDetailsNewQuery> getRepairRecordList(RepairRecord bean);
List<RepairFixRecord> getRepairFixRecordList(RepairFixRecord bean);
}

View File

@ -24,6 +24,10 @@ public interface SltAgreementInfoMapper {
List<SltAgreementInfo> getLeaseListOne(AgreementInfo bean);
List<SltAgreementInfo> getLeaseListThree(AgreementInfo bean);
List<SltAgreementInfo> getLeaseListOneFinish(AgreementInfo bean);
List<SltAgreementInfo> getLeaseListThreeFinish(AgreementInfo bean);
List<TmTask> getTaskList(@Param("bean") AgreementInfo bean, @Param("taskType")String taskType);
List<SltAgreementInfo> getRepairDetailsList(@Param("taskList") List<TmTask> taskList);

View File

@ -1,6 +1,7 @@
package com.bonus.sgzb.material.service;
import com.bonus.sgzb.material.domain.BackRecord;
import com.bonus.sgzb.material.domain.RepairFixRecord;
import com.bonus.sgzb.material.domain.RepairRecord;
import com.bonus.sgzb.material.vo.RepairAuditDetailsNew;
import com.bonus.sgzb.material.vo.RepairAuditDetailsNewQuery;
@ -20,4 +21,6 @@ public interface RepairRecordService {
* @return List<RepairRecord>
*/
List<RepairAuditDetailsNewQuery> getRepairRecordList(RepairRecord bean);
List<RepairFixRecord> getRepairFixRecordList(RepairFixRecord bean);
}

View File

@ -29,8 +29,13 @@ public interface SltAgreementInfoService {
int settlementReview(SltAgreementApply apply);
List<SltAgreementInfo> getLeaseList(List<AgreementInfo> list);
List<SltAgreementInfo> getLeaseListOne(List<AgreementInfo> list);
List<SltAgreementInfo> getLeaseListOneFinish(List<AgreementInfo> list);
List<SltAgreementInfo> getLeaseListThree(List<AgreementInfo> list);
List<SltAgreementInfo> getLeaseListThreeFinish(List<AgreementInfo> list);
List<SltAgreementInfo> getLoseList(List<AgreementInfo> list);
List<SltAgreementInfo> getRepairList(List<AgreementInfo> list);

View File

@ -50,7 +50,7 @@ public class EquipmentToRepairServiceImpl implements EquipmentToRepairService {
public List<EquipmentTask> getEquipmentList(EquipmentTask bean) {
Set<String> roles = SecurityUtils.getLoginUser().getRoles();
List<EquipmentTask> equipmentTaskList = new ArrayList<>();
if (roles.contains(STRING_ADMIN) || roles.contains("sysadmin")) {
if (roles.contains(STRING_ADMIN) || roles.contains("sysadmin") || roles.contains("jjfgs-jhdpzy") || roles.contains("jjfgs-sbbz") || roles.contains("jjfgs-sbfbz")) {
equipmentTaskList = mapper.getEquipmentList(bean);
}else{
Long companyId = SecurityUtils.getLoginUser().getSysUser().getCompanyId();

View File

@ -3,6 +3,7 @@ package com.bonus.sgzb.material.service.impl;
import com.bonus.sgzb.common.security.utils.SecurityUtils;
import com.bonus.sgzb.material.domain.BackRecord;
import com.bonus.sgzb.material.domain.DeptVo;
import com.bonus.sgzb.material.domain.RepairFixRecord;
import com.bonus.sgzb.material.domain.RepairRecord;
import com.bonus.sgzb.material.mapper.BackRecordMapper;
import com.bonus.sgzb.material.mapper.LeaseRecordMapper;
@ -43,4 +44,20 @@ public class RepairRecordServiceImpl implements RepairRecordService {
}
return repairRecordMapper.getRepairRecordList(bean);
}
@Override
public List<RepairFixRecord> getRepairFixRecordList(RepairFixRecord bean) {
Long userId = SecurityUtils.getUserId();
int deptId = leaseRecordMapper.getDeptId(userId);
if (deptId != 1000){
DeptVo deptVo = leaseRecordMapper.getAnsetors(deptId);
String isView = deptVo.getIsView();
bean.setDeptId(deptId);
bean.setIsView(isView);
}else{
bean.setIsView(null);
}
return repairRecordMapper.getRepairFixRecordList(bean);
}
}

View File

@ -66,9 +66,9 @@ public class SltAgreementInfoServiceImpl implements SltAgreementInfoService {
public SltInfoVo getSltInfo(List<AgreementInfo> list) {
SltInfoVo sltInfoVo = new SltInfoVo();
//租赁费用列表
List<SltAgreementInfo> leaseListOne = getLeaseListOne(list);
List<SltAgreementInfo> leaseListOne = getLeaseListOneFinish(list);
//预报废费用列表
List<SltAgreementInfo> leaseListThree = getLeaseListThree(list);
List<SltAgreementInfo> leaseListThree = getLeaseListThreeFinish(list);
//维修费用列表暂时不取
//List<SltAgreementInfo> repairList = getRepairList(list);
List<SltAgreementInfo> repairList = new ArrayList<>();
@ -269,6 +269,82 @@ public class SltAgreementInfoServiceImpl implements SltAgreementInfoService {
return leaseList;
}
/**
* 完工结算新需求2.未还的机具完工结算的终止日期计算规则按照同类型最后回库的时间进行计算
*
* @param list
* @return
*/
@Override
public List<SltAgreementInfo> getLeaseListThreeFinish(List<AgreementInfo> list) {
List<SltAgreementInfo> leaseList = new ArrayList<>();
for (AgreementInfo bean : list) {
List<SltAgreementInfo> oneOfList = sltAgreementInfoMapper.getLeaseListThreeFinish(bean);
leaseList.addAll(oneOfList);
}
for (SltAgreementInfo bean : leaseList) {
if (bean.getLeasePrice() == null) {
bean.setLeasePrice(new BigDecimal(0));
}
if (bean.getNum() == null) {
bean.setNum(0);
}
if (StringUtils.isEmpty(bean.getLeaseDays())) {
bean.setLeaseDays("0");
}
if (Objects.isNull(bean.getTrimDay())) {
bean.setTrimDay(0);
}
BigDecimal leasePrice = bean.getLeasePrice();
BigDecimal num = new BigDecimal(bean.getNum());
BigDecimal leaseDays = new BigDecimal(bean.getLeaseDays());
// 实际结算天数领料天数 + 调整天数(可以为负整数)
BigDecimal realDays = leaseDays.add(new BigDecimal(bean.getTrimDay()));
// 实际结算金额
BigDecimal realCosts = leasePrice.multiply(num).multiply(realDays);
// 应结算金额
BigDecimal costs = leasePrice.multiply(num).multiply(leaseDays);
bean.setCosts(costs);
//实际结算天数
bean.setRealDays(realDays);
// 实际结算金额
bean.setRealCosts(realCosts);
}
Map<String, SltAgreementInfo> mergedMap = new HashMap<>();
for (SltAgreementInfo info : leaseList) {
String key = info.getTypeId();
if (info.getStartTime() != null && info.getEndTime() != null) {
key += "_" + info.getStartTime() + "_" + info.getEndTime();
}
if (mergedMap.containsKey(key)) {
SltAgreementInfo mergedInfo = mergedMap.get(key);
// 数量相加
mergedInfo.setNum(mergedInfo.getNum() + info.getNum());
// 实际结算金额相加
mergedInfo.setRealCosts(mergedInfo.getRealCosts().add(info.getRealCosts()));
// 应结算金额相加
mergedInfo.setCosts(mergedInfo.getCosts().add(info.getCosts()));
// 合并remarkckRemarkoutRemark
if (info.getRemark() != null && !info.getRemark().isEmpty()) {
mergedInfo.setRemark(mergedInfo.getRemark() + "" + info.getRemark());
}
if (info.getCkRemark() != null && !info.getCkRemark().isEmpty()) {
mergedInfo.setCkRemark(mergedInfo.getCkRemark() + "" + info.getCkRemark());
}
if (info.getOutRemark() != null && !info.getOutRemark().isEmpty()) {
mergedInfo.setOutRemark(mergedInfo.getOutRemark() + "" + info.getOutRemark());
}
if(info.getIsMaxEndTime()!=null && info.getIsMaxEndTime()==1){
mergedInfo.setIsMaxEndTime(1);
}
} else {
mergedMap.put(key, info);
}
}
leaseList = new ArrayList<>(mergedMap.values());
return leaseList;
}
private List<SltAgreementRelation> getRelations(List<SltAgreementInfo> leaseListOne, List<SltAgreementInfo> leaseListThree, List<SltAgreementInfo> repairList, List<SltAgreementInfo> scrapList, List<SltAgreementInfo> preScrapList, List<SltAgreementInfo> loseList, List<ApplyRelation> addCostList, List<AgreementInfo> list) {
List<SltAgreementRelation> relations = new ArrayList<>();
for (AgreementInfo info : list) {
@ -395,6 +471,32 @@ public class SltAgreementInfoServiceImpl implements SltAgreementInfoService {
@Override
public AjaxResult submitFeeOne(SltAgreementInfo apply) {
//查找出 未还的机具完工结算的终止日期计算规则按照同类型最后回库的时间进行计算 的数据
List<AgreementInfo> list = new ArrayList<>() ;
if (apply.getAgreementIds() != null && !apply.getAgreementIds().isEmpty()) {
for (String agreementId : apply.getAgreementIds()) {
AgreementInfo info = new AgreementInfo();
info.setAgreementId(Long.valueOf(agreementId)); // 假设agreementId为字符串类型需转换为Long
info.setCostBearingParty(apply.getCostBearingParty());
list.add(info);
}
}
for (AgreementInfo info : list){
List<SltAgreementInfo> oneOfList = new ArrayList<>();
if(info.getCostBearingParty().equals("01")){
oneOfList = sltAgreementInfoMapper.getLeaseListOneFinish(info);
}else{
oneOfList = sltAgreementInfoMapper.getLeaseListThreeFinish(info);
}
oneOfList = oneOfList.stream()
.filter(slt -> slt.getIsMaxEndTime() != null && slt.getIsMaxEndTime() == 1)
.collect(Collectors.toList());
if(oneOfList.size()>0){
for (SltAgreementInfo slt : oneOfList){
sltAgreementInfoMapper.updateTrimDay(slt);
}
}
}
int i = sltAgreementInfoMapper.updateInfoOneStatus(apply.getAgreementIds(),apply.getCostBearingParty());
if (i > 0) {
@ -732,6 +834,85 @@ public class SltAgreementInfoServiceImpl implements SltAgreementInfoService {
return leaseList;
}
/**
* 完工结算新需求2.未还的机具完工结算的终止日期计算规则按照同类型最后回库的时间进行计算
*
* @param list
* @return
*/
@Override
public List<SltAgreementInfo> getLeaseListOneFinish(List<AgreementInfo> list) {
List<SltAgreementInfo> leaseList = new ArrayList<>();
for (AgreementInfo bean : list) {
List<SltAgreementInfo> oneOfList = sltAgreementInfoMapper.getLeaseListOneFinish(bean);
leaseList.addAll(oneOfList);
}
for (SltAgreementInfo bean : leaseList) {
if (bean.getLeasePrice() == null) {
bean.setLeasePrice(new BigDecimal(0));
}
if (bean.getNum() == null) {
bean.setNum(0);
}
if (StringUtils.isEmpty(bean.getLeaseDays())) {
bean.setLeaseDays("0");
}
if (Objects.isNull(bean.getTrimDay())) {
bean.setTrimDay(0);
}
BigDecimal leasePrice = bean.getLeasePrice();
BigDecimal num = new BigDecimal(bean.getNum());
BigDecimal leaseDays = new BigDecimal(bean.getLeaseDays());
// 实际结算天数领料天数 + 调整天数(可以为负整数)
BigDecimal realDays = leaseDays.add(new BigDecimal(bean.getTrimDay()));
// 实际结算金额
BigDecimal realCosts = leasePrice.multiply(num).multiply(realDays);
// 应结算金额
BigDecimal costs = leasePrice.multiply(num).multiply(leaseDays);
bean.setCosts(costs);
//实际结算天数
bean.setRealDays(realDays);
// 实际结算金额
bean.setRealCosts(realCosts);
}
// // 如果isSlt不为0则进行合并
// if (list.get(0).getIsSlt() != null && list.get(0).getIsSlt() != 0) {
Map<String, SltAgreementInfo> mergedMap = new HashMap<>();
for (SltAgreementInfo info : leaseList) {
String key = info.getTypeId();
if (info.getStartTime() != null || info.getEndTime() != null) {
key += "_" + info.getStartTime() + "_" + info.getEndTime();
}
if (mergedMap.containsKey(key)) {
SltAgreementInfo mergedInfo = mergedMap.get(key);
// 数量相加
mergedInfo.setNum(mergedInfo.getNum() + info.getNum());
// 实际结算金额相加
mergedInfo.setRealCosts(mergedInfo.getRealCosts().add(info.getRealCosts()));
// 应结算金额相加
mergedInfo.setCosts(mergedInfo.getCosts().add(info.getCosts()));
// 合并remarkckRemarkoutRemark
if (info.getRemark() != null && !info.getRemark().isEmpty()) {
mergedInfo.setRemark(mergedInfo.getRemark() + "" + info.getRemark());
}
if (info.getCkRemark() != null && !info.getCkRemark().isEmpty()) {
mergedInfo.setCkRemark(mergedInfo.getCkRemark() + "" + info.getCkRemark());
}
if (info.getOutRemark() != null && !info.getOutRemark().isEmpty()) {
mergedInfo.setOutRemark(mergedInfo.getOutRemark() + "" + info.getOutRemark());
}
if(info.getIsMaxEndTime()!=null && info.getIsMaxEndTime()==1){
mergedInfo.setIsMaxEndTime(1);
}
} else {
mergedMap.put(key, info);
}
}
leaseList = new ArrayList<>(mergedMap.values());
// }
return leaseList;
}
/**
* 结算单号编码生成规则
*/

View File

@ -24,10 +24,19 @@ public class RepairAuditDetailsNewQuery {
*/
@Excel(name = "规格型号",sort = 2)
private String type;
/** 资产属性id */
@ApiModelProperty(value = "资产属性id")
private Integer propId;
/** 资产属性名称 */
@ApiModelProperty(value = "资产属性名称")
@Excel(name = "资产属性",sort = 3)
private String propName;
/**
* 维修时间
*/
@Excel(name = "维修时间",sort = 8)
@Excel(name = "维修时间",sort = 9)
private String createTime;
/**
@ -48,20 +57,20 @@ public class RepairAuditDetailsNewQuery {
@ApiModelProperty(value = "机具编号")
@Excel(name = "机具编号",sort = 3)
@Excel(name = "机具编号",sort = 4)
private String maCode;
/** 维修总量 */
@Excel(name = "维修总量",sort = 4)
@Excel(name = "维修总量",sort = 5)
private Integer repairNum;
/** 维修数量 */
@Excel(name = "维修合格数量",sort = 5)
@Excel(name = "维修合格数量",sort = 6)
private Integer repairedNum;
/** 报废数量 */
private Integer scrapNum;
@Excel(name = "维修人",sort = 7)
@Excel(name = "维修人",sort = 8)
private String repairer;
@Excel(name = "维修类型",sort = 7)
private int repairType;

View File

@ -426,6 +426,10 @@
insert into slt_agreement_info (agreement_id,type_id,ma_id,num,start_time,status,lease_id,lease_price,buy_price,type_name,model_name,replace_type_id,is_slt,company_id,lease_type,create_time,ck_remark)
values (#{agreementId},#{record.typeId},#{record.maId},#{record.outNum},#{record.createTime},0,#{record.parentId},#{ma.finalPrice},#{ma.buyPrice},#{ma.typeName},#{ma.modelName},#{ma.replaceTypeId},'0',#{record.companyId},#{record.leaseType},now(),#{record.remark});
</insert>
<insert id="insertMonthTempInfo">
insert into project_temp_cost (agreement_id,type_id,ma_id,lease_id,lease_num,start_time,end_time,day,price,lease_money,cost_type,mark_time)
values (#{agreementId},#{record.typeId},#{record.maId},#{record.parentId},#{record.outNum},#{record.createTime},now(),#{record.day},#{ma.finalPrice},#{record.leaseMoney},0,now());
</insert>
<select id="leaseOutRecordList" resultType="com.bonus.sgzb.base.api.domain.LeaseOutDetails">
SELECT

View File

@ -451,4 +451,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
WHERE
mm.ma_status = '15' and mt.type_id = #{typeId}
</select>
<select id="selectMaMachineByMaCode" resultType="com.bonus.sgzb.base.api.domain.MaMachine">
select * from ma_machine
where assets_code = #{assetsCode}
and ma_id != #{maId}
</select>
</mapper>

View File

@ -17,13 +17,13 @@
</insert>
<insert id="addPartNew" keyColumn="id" keyProperty="id" useGeneratedKeys="true" >
insert into repair_apply_part (parent_id,type_id,create_by,create_time,repair_content,part_id,part_num,part_price,part_name,remark,repair_remark,part_change,part_change_num,scrap_reason,scrap_type,scrap_num)
values (#{parentId},#{typeId},#{createBy},now(),#{repairContent},#{partId},#{partNum},#{partPrice},#{partName},#{remark},#{repairRemark},#{partChange},#{partChangeNum},#{scrapReason},#{scrapType},#{scrapNum});
insert into repair_apply_part (parent_id,type_id,ma_id,create_by,create_time,repair_content,part_id,part_num,part_price,part_name,remark,repair_remark,part_change,part_change_num,scrap_reason,scrap_type,scrap_num)
values (#{parentId},#{typeId},#{maId},#{createBy},now(),#{repairContent},#{partId},#{partNum},#{partPrice},#{partName},#{remark},#{repairRemark},#{partChange},#{partChangeNum},#{scrapReason},#{scrapType},#{scrapNum});
</insert>
<insert id="addPartSaveNew" keyColumn="id" keyProperty="id" useGeneratedKeys="true" >
insert into repair_apply_part_save (parent_id,type_id,create_by,create_time,repair_content,part_id,part_num,part_price,part_name,remark,repair_remark,part_change,part_change_num,scrap_reason,scrap_type,scrap_num)
values (#{parentId},#{typeId},#{createBy},now(),#{repairContent},#{partId},#{partNum},#{partPrice},#{partName},#{remark},#{repairRemark},#{partChange},#{partChangeNum},#{scrapReason},#{scrapType},#{scrapNum});
insert into repair_apply_part_save (parent_id,type_id,ma_id,create_by,create_time,repair_content,part_id,part_num,part_price,part_name,remark,repair_remark,part_change,part_change_num,scrap_reason,scrap_type,scrap_num)
values (#{parentId},#{typeId},#{maId},#{createBy},now(),#{repairContent},#{partId},#{partNum},#{partPrice},#{partName},#{remark},#{repairRemark},#{partChange},#{partChangeNum},#{scrapReason},#{scrapType},#{scrapNum});
</insert>
<insert id="addPart">
@ -521,6 +521,7 @@
<select id="getRepairPartListNew" resultType="com.bonus.sgzb.base.domain.RepairPartDetails">
select
rap.id as id,
rap.ma_id as maId,
rap.part_id as partId,
case when rap.part_id is not null then mpt.pa_name else rap.part_name end as partName,
part_num as partNum,

View File

@ -100,6 +100,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
SELECT
mt2.type_name AS typeName,
mt.type_name AS typeModelName,
mpi.prop_name as propName,
baif.`code`,
mm.ma_code AS maCode,
bcd.back_num AS backNum,
@ -118,6 +119,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
LEFT JOIN bm_unit_info bui ON bui.unit_id = bai.unit_id
LEFT JOIN ma_type mt ON mt.type_id = bcd.type_id
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
left join ma_prop_set mps on mt.type_id = mps.type_id
left join ma_prop_info mpi on mps.prop_id = mpi.prop_id
LEFT JOIN ma_machine mm ON mm.ma_id = bcd.ma_id
where 1 = 1
<if test="keyWord != null and keyWord != ''">
@ -139,6 +142,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="proId != null">
and bpl.lot_id = #{proId}
</if>
<if test="propId != null">
and mpi.prop_id = #{propId}
</if>
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
AND baif.back_time BETWEEN CONCAT(#{startTime}, ' 00:00:00') AND CONCAT(#{endTime}, ' 23:59:59')
</if>

View File

@ -7,6 +7,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="getInputRecordList" resultType="com.bonus.sgzb.material.domain.InputRecord">
SELECT mt2.type_name as typeName,
mt.type_name as typeModelName,
mpi.prop_name as propName,
mm.qr_code as qrCode,
mm.ma_code as maCode,
mt.unit_name as unit,
@ -29,6 +30,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
FROM input_apply_details iad
LEFT JOIN ma_type mt on mt.type_id = iad.type_id
LEFT JOIN ma_type mt2 on mt2.type_id = mt.parent_id
left join ma_prop_set mps on mt.type_id = mps.type_id
left join ma_prop_info mpi on mps.prop_id = mpi.prop_id
LEFT JOIN ma_machine mm on mm.ma_id = iad.ma_id
LEFT JOIN sys_user su on su.user_id = iad.create_by
where 1 = 1
@ -46,6 +49,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="typeModelName != null and typeModelName != ''">
and mt.type_name like concat('%',#{typeModelName},'%')
</if>
<if test="propId != null">
and mpi.prop_id = #{propId}
</if>
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
AND iad.create_time BETWEEN CONCAT(#{startTime}, ' 00:00:00') AND CONCAT(#{endTime}, ' 23:59:59')
</if>
@ -57,6 +63,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
bui.unit_name,
mt.type_name as typeModelName,
mt2.type_name as typeName,
mpi.prop_name as propName,
mt.unit_name as unitId,
mm.ma_code,
lod.create_time,
lod.out_num,
@ -71,6 +79,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
LEFT JOIN bm_unit_info bui ON bui.unit_id = bagi.unit_id
LEFT JOIN ma_type mt ON mt.type_id = lod.type_id
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
left join ma_prop_set mps on mt.type_id = mps.type_id
left join ma_prop_info mpi on mps.prop_id = mpi.prop_id
LEFT JOIN ma_machine mm ON mm.ma_id = lod.ma_id
LEFT JOIN sys_dic sd on mm.ma_status = sd.id
WHERE
@ -84,6 +94,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="lotId != null">
and bpl.lot_id = #{lotId}
</if>
<if test="propId != null">
and mpi.prop_id = #{propId}
</if>
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
AND lod.create_time BETWEEN CONCAT(#{startTime}, ' 00:00:00') AND CONCAT(#{endTime}, ' 23:59:59')
</if>

View File

@ -27,6 +27,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
mm.ma_code as maCode,
mt.unit_name as unit,
mt.manage_type as manageType,
mpi.prop_name as propName,
lod.out_num as preNum,
lai.lease_person as leasePerson,
lai.create_time as leaseTime,
@ -43,6 +44,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
LEFT JOIN ma_type mt on mt.type_id = lod.type_id
LEFT JOIN ma_type mt2 on mt2.type_id = mt.parent_id
LEFT JOIN ma_machine mm on mm.ma_id = lod.ma_id
left join ma_prop_set mps on mt.type_id = mps.type_id
left join ma_prop_info mpi on mps.prop_id = mpi.prop_id
-- LEFT JOIN sys_user su on su.user_id = lai.lease_person
where 1 = 1
<if test="keyWord != null and keyWord != ''">
@ -64,6 +67,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="proId != null">
and bpl.lot_id = #{proId}
</if>
<if test="propId != null">
and mpi.prop_id = #{propId}
</if>
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
AND lod.create_time BETWEEN CONCAT(#{startTime}, ' 00:00:00') AND CONCAT(#{endTime}, ' 23:59:59')
</if>

View File

@ -8,6 +8,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
SELECT subquery1.agreementCode,
subquery1.agreement_id AS agreementId,
subquery1.type_id AS typeId,
subquery1.propName,
subquery1.unitId,
subquery1.proId,
subquery1.unitName,
@ -34,6 +35,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
IFNULL(subquery1.outNum, 0) * IFNULL(subquery1.rent_price, 0) as totalPrice
FROM (SELECT bai.agreement_id,
mt.type_id as type_id,
mpi.prop_name as propName,
mt.rent_price,
bui.unit_id as unitId,
bpl.lot_id as proId,
@ -53,6 +55,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
LEFT JOIN bm_unit_info bui ON bui.unit_id = bai.unit_id
LEFT JOIN ma_type mt ON mt.type_id = lod.type_id
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
left join ma_prop_set mps on mt.type_id = mps.type_id
left join ma_prop_info mpi on mps.prop_id = mpi.prop_id
LEFT JOIN ma_machine mm ON mm.ma_id = lod.ma_id
LEFT JOIN sys_user su ON su.user_id = lai.lease_person
where 1=1
@ -71,6 +75,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="proId != null">
and bpl.lot_id = #{proId}
</if>
<if test="propId != null">
and mpi.prop_id = #{propId}
</if>
<if test="typeName != null and typeName != ''">
and mt2.type_name like concat('%',#{typeName},'%')
</if>
@ -87,6 +94,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
mt.type_id) AS subquery1
LEFT JOIN (SELECT bai.agreement_id,
mt.type_id,
mpi.prop_name as propName,
mt.rent_price,
bai.agreement_code AS agreementCode,
bui.unit_name AS unitName,
@ -103,6 +111,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
LEFT JOIN bm_unit_info bui ON bui.unit_id = bai.unit_id
LEFT JOIN ma_type mt ON mt.type_id = bcd.type_id
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
left join ma_prop_set mps on mt.type_id = mps.type_id
left join ma_prop_info mpi on mps.prop_id = mpi.prop_id
LEFT JOIN ma_machine mm ON mm.ma_id = bcd.ma_id
LEFT JOIN sys_user su ON su.user_id = baif.back_person
where 1=1
@ -121,6 +131,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="proId != null">
and bpl.lot_id = #{proId}
</if>
<if test="propId != null">
and mpi.prop_id = #{propId}
</if>
<if test="typeName != null and typeName != ''">
and mt2.type_name like concat('%',#{typeName},'%')
</if>

View File

@ -19,6 +19,7 @@
rad.audit_remark as remark,
mt2.type_name as typeName,
mt.type_name as type,
mpi.prop_name as propName,
su.nick_name as repairer,
rar.repair_type as repairType
from
@ -28,6 +29,8 @@
left join ma_type mt on rar.type_id = mt.type_id
left join sys_user su on rar.create_by = su.user_id
LEFT JOIN ma_type mt2 on mt.parent_id = mt2.type_id
left join ma_prop_set mps on mt.type_id = mps.type_id
left join ma_prop_info mpi on mps.prop_id = mpi.prop_id
where
rad.status = 1 and rar.repair_type in (1,2)
@ -36,8 +39,64 @@
mt2.type_name like concat('%',#{keyWord},'%') or
mt.type_name like concat('%',#{keyWord},'%'))
</if>
<if test="propId != null">
and mpi.prop_id = #{propId}
</if>
group by rad.parent_id,rad.create_time,rad.type_id,rad.status,rad.audit_remark,mm.ma_code
order by rar.create_time desc
</select>
<select id="getRepairFixRecordList" resultType="com.bonus.sgzb.material.domain.RepairFixRecord">
<![CDATA[
SELECT rar.type_id,
mt2.type_name as typeName,
mt.type_name as typeModelName,
mpi.prop_name as propName,
rar.ma_id as maId,
mm.ma_code as maCode,
SUM(rar.repair_num) as repairNum,
bad.backNum,
COALESCE(rap2.cost, 0) as cost,
CASE
WHEN COALESCE(bad.backNum, 0) = 0 THEN '0%'
ELSE CONCAT(ROUND(SUM(rar.repair_num) / bad.backNum * 100, 2), '%')
END as damageRate
FROM repair_apply_record rar
left join ma_type mt on mt.type_id = rar.type_id
left join ma_type mt2 on mt2.type_id = mt.parent_id
left join ma_prop_set mps on mt.type_id = mps.type_id
left join ma_prop_info mpi on mps.prop_id = mpi.prop_id
left join ma_machine mm on mm.ma_id = rar.ma_id
left join (
SELECT bcd.type_id, SUM(back_num) as backNum,bcd.ma_id
FROM back_check_details bcd
left join ma_type mt on mt.type_id = bcd.type_id
WHERE is_finished = 1
GROUP BY bcd.ma_id,bcd.type_id
) bad on bad.type_id = rar.type_id and bad.ma_id <=> rar.ma_id
left join(
SELECT
rap.type_id,rap.ma_id,
SUM(rap.part_num * rap.part_price) as cost
FROM repair_apply_part rap
LEFT JOIN ma_type mt on mt.type_id = rap.type_id
GROUP BY rap.ma_id,rap.type_id
) rap2 on rap2.type_id = rar.type_id and rap2.ma_id <=> rar.ma_id
]]>
<where>
<if test="typeModelName != null and typeModelName != ''">
mt.type_name like concat('%',#{typeModelName},'%')
</if>
<if test="typeName != null and typeName != ''">
mt2.type_name like concat('%',#{typeName},'%')
</if>
<if test="maCode != null and maCode != ''">
mm.ma_code like concat('%',#{maCode},'%')
</if>
<if test="propId != null">
and mpi.prop_id = #{propId}
</if>
</where>
GROUP BY rar.ma_id,rar.type_id
</select>
</mapper>

View File

@ -10,6 +10,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
mt2.type_name as typeName,
mt.type_name as typeModelName,
mt.unit_name as unit,
mpi.prop_name as propName,
mm.ma_code as maCode,
sad.audit_time as scrapTime,
sad.scrap_num as scrapNum,
@ -19,6 +20,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
LEFT JOIN tm_task tt on tt.task_id = sad.task_id
LEFT JOIN ma_type mt on mt.type_id = sad.type_id
LEFT JOIN ma_type mt2 on mt2.type_id = mt.parent_id
left join ma_prop_set mps on mt.type_id = mps.type_id
left join ma_prop_info mpi on mps.prop_id = mpi.prop_id
LEFT JOIN ma_machine mm on mm.ma_id = sad.ma_id
WHERE sad.scrap_source = 3 and tt.task_status = 1
@ -37,7 +40,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="typeModelName != null and typeModelName != ''">
and mt.type_name like concat('%',#{typeModelName},'%')
</if>
<if test="propId != null">
and mpi.prop_id = #{propId}
</if>
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
AND sad.audit_time BETWEEN CONCAT(#{startTime}, ' 00:00:00') AND CONCAT(#{endTime}, ' 23:59:59')
</if>
@ -51,6 +56,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
mt2.type_name as typeName,
mt.type_name as typeModelName,
mt.unit_name as unit,
mpi.prop_name as propName,
mm.ma_code as maCode,
sad.audit_time as scrapTime,
sad.scrap_num as scrapNum,
@ -61,6 +67,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
LEFT JOIN repair_apply_part rap on sad.parent_id = rap.parent_id
LEFT JOIN ma_type mt on mt.type_id = sad.type_id
LEFT JOIN ma_type mt2 on mt2.type_id = mt.parent_id
left join ma_prop_set mps on mt.type_id = mps.type_id
left join ma_prop_info mpi on mps.prop_id = mpi.prop_id
LEFT JOIN ma_machine mm on mm.ma_id = sad.ma_id
WHERE sad.scrap_source = 2 and tt.task_status = 1
<if test="keyWord != null and keyWord != ''">
@ -78,7 +86,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="typeModelName != null and typeModelName != ''">
and mt.type_name like concat('%',#{typeModelName},'%')
</if>
<if test="propId != null">
and mpi.prop_id = #{propId}
</if>
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
AND sad.audit_time BETWEEN CONCAT(#{startTime}, ' 00:00:00') AND CONCAT(#{endTime}, ' 23:59:59')
</if>

View File

@ -428,6 +428,152 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where sai.agreement_id = #{agreementId} and sai.lease_type = 0 and lai.cost_bearing_party = '03'
</select>
<select id="getLeaseListOneFinish" 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.company_id as companyId,
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,
lai.remark,
bb.remark as outRemark,
sai.is_slt as isSlt,
sai.ck_remark as ckRemark,
sai.trim_day as trimDay,
DATE(sai.start_time) as startTime,
DATE(
IF(
sai.end_time IS NULL,
(SELECT MAX(end_time)
FROM slt_agreement_info
WHERE agreement_id = sai.agreement_id
AND type_id = sai.type_id),
sai.end_time
)
) as endTime,
-- 修改endTimeTemp与endTime逻辑一致
DATE(
IF(
sai.end_time IS NULL,
(SELECT MAX(end_time)
FROM slt_agreement_info
WHERE agreement_id = sai.agreement_id
AND type_id = sai.type_id),
sai.end_time
)
) as endTimeTemp,
-- leaseDays逻辑保持不变已按之前要求调整
DATEDIFF(
IF(
sai.end_time IS NULL,
(SELECT MAX(end_time)
FROM slt_agreement_info
WHERE agreement_id = sai.agreement_id
AND type_id = sai.type_id),
sai.end_time
),
sai.start_time
) + 1 as leaseDays,
CASE
WHEN sai.end_time IS NULL
AND (SELECT MAX(end_time)
FROM slt_agreement_info
WHERE agreement_id = sai.agreement_id
AND type_id = sai.type_id) IS NOT NULL
THEN 1
ELSE 0
END as isMaxEndTime
from slt_agreement_info sai
LEFT JOIN lease_apply_info lai ON lai.id = sai.lease_id
LEFT JOIN back_apply_info bb on sai.back_id = bb.id
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.lease_type = 0 and lai.cost_bearing_party = '01'
</select>
<select id="getLeaseListThreeFinish" 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.company_id as companyId,
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.trim_day as trimDay,
sai.lease_price as leasePrice,
sai.num as num,
lai.remark,
bb.remark as outRemark,
sai.is_slt as isSlt,
sai.ck_remark as ckRemark,
DATE(sai.start_time) as startTime,
DATE(
IF(
sai.end_time IS NULL,
(SELECT MAX(end_time)
FROM slt_agreement_info
WHERE agreement_id = sai.agreement_id
AND type_id = sai.type_id),
sai.end_time
)
) as endTime,
-- 修改endTimeTemp与endTime逻辑一致
DATE(
IF(
sai.end_time IS NULL,
(SELECT MAX(end_time)
FROM slt_agreement_info
WHERE agreement_id = sai.agreement_id
AND type_id = sai.type_id),
sai.end_time
)
) as endTimeTemp,
-- leaseDays逻辑保持不变已按之前要求调整
DATEDIFF(
IF(
sai.end_time IS NULL,
(SELECT MAX(end_time)
FROM slt_agreement_info
WHERE agreement_id = sai.agreement_id
AND type_id = sai.type_id),
sai.end_time
),
sai.start_time
) + 1 as leaseDays,
CASE
WHEN sai.end_time IS NULL
AND (SELECT MAX(end_time)
FROM slt_agreement_info
WHERE agreement_id = sai.agreement_id
AND type_id = sai.type_id) IS NOT NULL
THEN 1
ELSE 0
END as isMaxEndTime
from slt_agreement_info sai
LEFT JOIN lease_apply_info lai ON lai.id = sai.lease_id
LEFT JOIN back_apply_info bb on sai.back_id = bb.id
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.lease_type = 0 and lai.cost_bearing_party = '03'
</select>
<select id="getLeaseListOneMonth" resultType="com.bonus.sgzb.base.api.domain.SltAgreementInfo">
SELECT
sai.id,

View File

@ -9,6 +9,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
mt2.type_name AS typeName,
mt.type_name AS typeModelName,
mt.unit_name AS unit,
mpi.prop_name as propName,
CASE
mt.manage_type
WHEN 0 THEN
@ -187,6 +188,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
lad.type_id
) AS subquery7 ON subquery7.type_id = mt.type_id
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
left join ma_prop_set mps on mt.type_id = mps.type_id
left join ma_prop_info mpi on mps.prop_id = mpi.prop_id
WHERE
mt.`level` = 4
AND mt.del_flag = '0'
@ -196,5 +199,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="typeModelName != null and typeModelName != ''">
and mt.type_name like concat('%',#{typeModelName},'%')
</if>
<if test="propId != null">
and mpi.prop_id = #{propId}
</if>
</select>
</mapper>