Merge remote-tracking branch 'origin/master'

This commit is contained in:
jjLv 2024-11-20 13:04:19 +08:00
commit 98792aa5af
74 changed files with 1781 additions and 810 deletions

View File

@ -44,11 +44,6 @@ public class MaterialConstants {
*/
public static final String LATITUDE_PATTERN = "^(-?(90(\\.0+)?|[1-8]?\\d(\\.\\d{1,6})?))$";
/**
* 未完成
*/
public static final Integer TEN_CONSTANT = 10;
public final static String STRING_ADMIN = "admin";
/** 协议号的开头字母 */

View File

@ -0,0 +1,53 @@
package com.bonus.common.biz.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import java.util.Date;
/**
* @author : 阮世耀
* @version : 1.0
* @Description: 基础Base VO
*/
@Getter
@Setter
@ToString
public class BaseVO {
@ApiModelProperty(value = "关键字")
private String keyword;
@ApiModelProperty(value = "状态")
private String status;
@ApiModelProperty(value = "组织id")
private Long companyId;
@ApiModelProperty(value = "备注")
private String remark;
@ApiModelProperty(value = "开始时间")
private String startTime;
@ApiModelProperty(value = "结束时间")
private String endTime;
@ApiModelProperty(value = "创建人")
private String createBy;
@ApiModelProperty(value = "创建时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
@ApiModelProperty(value = "更新人")
private String updateBy;
@ApiModelProperty(value = "更新时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateTime;
}

View File

@ -0,0 +1,9 @@
package com.bonus.common.biz.domain.vo;
import lombok.Data;
@Data
public class KeyValueVO {
private String mapKey;
private String mapValue;
}

View File

@ -0,0 +1,24 @@
package com.bonus.common.biz.enums;
import lombok.Getter;
/**
* @author : mashuai
* @version : 1.0
* 退料任务状态枚举
*/
@Getter
public enum BackTaskStatusEnum {
BACK_TASK_NO_FINISHED(0, "退料未完成"),
BACK_TASK_TO_REJECT(1, "维修驳回"),
BACK_TASK_IN_FINISHED(3, "退料已完成");
private final Integer status;
private final String statusName;
BackTaskStatusEnum(Integer status, String statusName) {
this.status = status;
this.statusName = statusName;
}
}

View File

@ -16,7 +16,6 @@ public enum PurchaseTaskStatusEnum {
TO_BIND_AFTER_REJECT(13, "待绑定(驳回后)"),
TO_STORE_AFTER_REJECT(14, "待入库(驳回后)"),
IN_STORE(19, "已入库"),
TASK_TO_START(20, "入库待开始"),
TASK_IN_PROGRESS(21, "入库进行中"),
TASK_FINISHED(22, "入库已完成");

View File

@ -13,7 +13,7 @@ public enum RepairTaskStatusEnum {
TASK_STATUS_PROCESSING(0, "维修管理--进行中"),
TASK_STATUS_COMPLETE(1, "维修管理--已完成"),
TASK_STATUS_REJECT(2, "维修管理--驳回"),
TASK_STATUS_REJECT(2, "维修管理--驳回退料"),
TASK_STATUS_TO_EXAM(3, "修饰审核--待审核"),
TASK_STATUS_REVIEW(4, "修饰审核--审核通过"),
TASK_STATUS_NO_REVIEW(5, "修饰审核--审核不通过"),

View File

@ -2,6 +2,8 @@ package com.bonus.material.back.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import com.bonus.common.log.enums.OperaType;
import com.bonus.material.back.domain.vo.BackApplyRequestVo;
import com.bonus.material.common.annotation.PreventRepeatSubmit;
@ -90,7 +92,7 @@ public class BackApplyInfoController extends BaseController {
@RequiresPermissions("back:info:add")
@SysLog(title = "退料任务", businessType = OperaType.INSERT, logType = 1,module = "仓储管理->新增退料任务")
@PostMapping
public AjaxResult add(@RequestBody BackApplyRequestVo dto) {
public AjaxResult add(@Valid @RequestBody BackApplyRequestVo dto) {
try {
return backApplyInfoService.insertBackApplyInfo(dto);
} catch (Exception e) {
@ -98,6 +100,24 @@ public class BackApplyInfoController extends BaseController {
}
}
/**
* 新增退料任务app
* @param dto
* @return
*/
@ApiOperation(value = "新增退料任务app")
@PreventRepeatSubmit
@RequiresPermissions("back:info:add")
@SysLog(title = "退料任务", businessType = OperaType.INSERT, logType = 1,module = "仓储管理->新增退料任务app")
@PostMapping("/insertApp")
public AjaxResult insertApp(@RequestBody BackApplyRequestVo dto) {
try {
return backApplyInfoService.insertApp(dto);
} catch (Exception e) {
return error("系统错误, " + e.getMessage());
}
}
/**
* 修改退料任务
*/
@ -106,7 +126,7 @@ public class BackApplyInfoController extends BaseController {
@RequiresPermissions("back:info:edit")
@SysLog(title = "退料任务", businessType = OperaType.UPDATE, logType = 1,module = "仓储管理->修改退料任务")
@PostMapping("/edit")
public AjaxResult edit(@RequestBody BackApplyRequestVo dto) {
public AjaxResult edit(@Valid @RequestBody BackApplyRequestVo dto) {
try {
return backApplyInfoService.updateBackApplyInfo(dto);
} catch (Exception e) {

View File

@ -6,7 +6,8 @@ import com.bonus.common.core.annotation.Excel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.ToString;
import com.bonus.common.core.web.domain.BaseEntity;
import javax.validation.constraints.Size;
/**
* 退料任务对象 back_apply_info
@ -65,6 +66,7 @@ public class BackApplyInfo {
/** 退料人 */
@Excel(name = "退料人")
@ApiModelProperty(value = "退料人")
@Size(max = 20, message = "退料人长度不能超过20个字符")
private String backPerson;
/**
@ -124,6 +126,7 @@ public class BackApplyInfo {
private String printStatus;
@Excel(name = "备注")
@Size(max = 500, message = "备注长度不能超过500个字符")
private String remark;
@ApiModelProperty(value = "机具id")

View File

@ -4,6 +4,7 @@ import com.bonus.material.back.domain.BackApplyDetails;
import com.bonus.material.back.domain.BackApplyInfo;
import lombok.Data;
import javax.validation.Valid;
import java.util.List;
/**
@ -19,6 +20,7 @@ public class BackApplyRequestVo {
/**
* 退料申请信息
*/
@Valid
private BackApplyInfo backApplyInfo;
/**

View File

@ -56,14 +56,6 @@ public interface BackApplyInfoMapper {
*/
public int deleteBackApplyInfoById(Long id);
/**
* 批量删除退料任务
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteBackApplyInfoByIds(Long[] ids);
/**
* 查询任务编号
* @param date
@ -72,20 +64,6 @@ public interface BackApplyInfoMapper {
*/
String selectTaskNumByMonth(@Param("date") Date date, @Param("taskType") Integer taskType);
/**
* 新增任务
* @param backApplyInfo
* @return
*/
int insertTmTask(BackApplyInfo backApplyInfo);
/**
* 新增任务关联协议
* @param backApplyInfo
* @return
*/
int insertTaskAgreement(BackApplyInfo backApplyInfo);
/**
* 新增任务详情
* @param details
@ -121,20 +99,6 @@ public interface BackApplyInfoMapper {
*/
int insertCheckDetails(BackApplyDetails details);
/**
* 删除任务
* @param taskId
* @return
*/
int deleteTask(Long taskId);
/**
* 删除任务关联协议
* @param taskId
* @return
*/
int deleteTaskAgreement(Long taskId);
/**
* 删除退料主表
* @param id

View File

@ -45,14 +45,6 @@ public interface IBackApplyInfoService {
*/
public AjaxResult updateBackApplyInfo(BackApplyRequestVo dto);
/**
* 批量删除退料任务
*
* @param ids 需要删除的退料任务主键集合
* @return 结果
*/
public int deleteBackApplyInfoByIds(Long[] ids);
/**
* 删除退料任务信息
*
@ -81,4 +73,11 @@ public interface IBackApplyInfoService {
* @return
*/
AjaxResult editPrintStatus(BackApplyInfo dto);
/**
* 新增退料任务app
* @param dto
* @return
*/
AjaxResult insertApp(BackApplyRequestVo dto);
}

View File

@ -6,7 +6,9 @@ import java.util.stream.Collectors;
import cn.hutool.core.util.PhoneUtil;
import com.alibaba.nacos.common.utils.CollectionUtils;
import com.bonus.common.biz.enums.BackTaskStatusEnum;
import com.bonus.common.biz.enums.HttpCodeEnum;
import com.bonus.common.biz.enums.TmTaskTypeEnum;
import com.bonus.common.core.exception.ServiceException;
import com.bonus.common.core.utils.DateUtils;
import com.bonus.common.core.utils.StringUtils;
@ -19,6 +21,10 @@ import com.bonus.material.back.domain.vo.MaCodeVo;
import com.bonus.material.basic.domain.BmFileInfo;
import com.bonus.material.basic.mapper.BmFileInfoMapper;
import com.bonus.material.settlement.domain.SltAgreementInfo;
import com.bonus.material.task.domain.TmTask;
import com.bonus.material.task.domain.TmTaskAgreement;
import com.bonus.material.task.mapper.TmTaskAgreementMapper;
import com.bonus.material.task.mapper.TmTaskMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import com.bonus.material.back.mapper.BackApplyInfoMapper;
@ -44,6 +50,12 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService {
@Resource
private BmFileInfoMapper bmFileInfoMapper;
@Resource
private TmTaskMapper taskMapper;
@Resource
private TmTaskAgreementMapper taskAgreementMapper;
/**
* 查询退料任务
*
@ -212,7 +224,7 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService {
if (StringUtils.isNotBlank(dto.getBackApplyInfo().getPhone()) && !PhoneUtil.isMobile(dto.getBackApplyInfo().getPhone())) {
return AjaxResult.error("手机号格式不正确,请重新填写!");
}
//对提交的退料详情树木进行校验
//对提交的退料详情数目进行校验
for (BackApplyDetails backApplyDetails : dto.getBackApplyDetailsList()) {
if (backApplyDetails.getNum() != null && backApplyDetails.getPreNum() != null) {
if (backApplyDetails.getNum() < backApplyDetails.getPreNum()) {
@ -225,26 +237,30 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService {
if (StringUtils.isBlank(code)) {
return AjaxResult.error("后台退料编号生成异常,请重试!");
}
BackApplyInfo backApplyInfo = dto.getBackApplyInfo();
backApplyInfo.setCode(code);
backApplyInfo.setCreateBy(SecurityUtils.getUsername());
backApplyInfo.setCreateTime(DateUtils.getNowDate());
backApplyInfo.setTaskType(3);
backApplyInfo.setTaskStatus(0);
backApplyInfo.setStatus("0");
int result = 0;
try {
// 保存退料信息到 tm_task 表中
result += backApplyInfoMapper.insertTmTask(backApplyInfo);
if (result > 0) {
Long taskId = backApplyInfo.getTaskId();
result += backApplyInfoMapper.insertTaskAgreement(backApplyInfo);
backApplyInfo.setTaskId(taskId);
int thisMonthMaxOrder = taskMapper.getMonthMaxOrderByDate(DateUtils.getCurrentYear(), DateUtils.getCurrentMonth(), TmTaskTypeEnum.TM_TASK_BACK.getTaskTypeId());
TmTask tmTask = new TmTask(null, TmTaskTypeEnum.TM_TASK_BACK.getTaskTypeId(),
BackTaskStatusEnum.BACK_TASK_NO_FINISHED.getStatus(),
null,thisMonthMaxOrder + 1, code);
tmTask.setCreateTime(DateUtils.getNowDate());
tmTask.setCreateBy(SecurityUtils.getUsername());
BackApplyInfo backApplyInfo = dto.getBackApplyInfo();
backApplyInfo.setTaskId(tmTask.getTaskId());
backApplyInfo.setCode(code);
backApplyInfo.setCreateBy(SecurityUtils.getUsername());
backApplyInfo.setCreateTime(DateUtils.getNowDate());
// 保存退料信息到 tm_task 表中
result += taskMapper.insertTmTask(tmTask);
if (result > 0) {
TmTaskAgreement tmTaskAgreement = new TmTaskAgreement(tmTask.getTaskId(), dto.getBackApplyInfo().getAgreementId());
tmTaskAgreement.setCreateTime(DateUtils.getNowDate());
tmTaskAgreement.setCreateBy(SecurityUtils.getUsername());
taskAgreementMapper.insertTmTaskAgreement(tmTaskAgreement);
result += backApplyInfoMapper.insertBackApplyInfo(backApplyInfo);
}
// 保存退料详情
result = saveBackApplyDetails(dto, backApplyInfo, result);
}
// 保存退料详情
result = saveBackApplyDetails(dto, backApplyInfo, result);
} catch (Exception e) {
log.error("保存退料信息时发生异常: ", e);
}
@ -263,7 +279,7 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService {
details.setCode(backApplyInfo.getCode());
details.setParentId(backApplyInfo.getId());
details.setAuditNum(details.getPreNum());
details.setStatus("0");
details.setStatus(String.valueOf(BackTaskStatusEnum.BACK_TASK_NO_FINISHED.getStatus()));
details.setCreateBy(SecurityUtils.getUsername());
details.setCreateTime(DateUtils.getNowDate());
// 保存退料详情
@ -403,31 +419,38 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService {
List<MaCodeVo> maCodeList = backApplyInfoMapper.selectByCode(id);
// 删除相关任务信息
int result = 0;
result += backApplyInfoMapper.deleteTask(backApplyInfo.getTaskId());
result += backApplyInfoMapper.deleteTaskAgreement(backApplyInfo.getTaskId());
result += taskMapper.deleteTmTaskByTaskId(backApplyInfo.getTaskId());
result += taskAgreementMapper.deleteTmTaskAgreementByTaskId(backApplyInfo.getTaskId());
result += backApplyInfoMapper.deleteBackApplyDetails(backApplyInfo.getId());
result += backApplyInfoMapper.deleteCheckDetails(backApplyInfo.getId());
// 删除退料详情附件
result += deleteFileInfoForDetails(backApplyDetailsList, id);
// 删除编码设备附件
result += deleteFileInfoForMaCodes(maCodeList, id);
if (result > 0) {
//执行新增操作
backApplyInfo.setTaskType(3);
backApplyInfo.setTaskStatus(0);
backApplyInfo.setStatus("0");
backApplyInfo.setTaskType(TmTaskTypeEnum.TM_TASK_BACK.getTaskTypeId());
backApplyInfo.setTaskStatus(BackTaskStatusEnum.BACK_TASK_NO_FINISHED.getStatus());
backApplyInfo.setId(id);
backApplyInfo.setUpdateTime(DateUtils.getNowDate());
backApplyInfo.setUpdateBy(SecurityUtils.getUsername());
backApplyInfo.setBackPerson(dto.getBackApplyInfo().getBackPerson());
backApplyInfo.setPhone(dto.getBackApplyInfo().getPhone());
backApplyInfo.setRemark(dto.getBackApplyInfo().getRemark() == null ? backApplyInfo.getRemark() : dto.getBackApplyInfo().getRemark());
int thisMonthMaxOrder = taskMapper.getMonthMaxOrderByDate(DateUtils.getCurrentYear(), DateUtils.getCurrentMonth(), TmTaskTypeEnum.TM_TASK_BACK.getTaskTypeId());
TmTask tmTask = new TmTask(null, TmTaskTypeEnum.TM_TASK_BACK.getTaskTypeId(), BackTaskStatusEnum.BACK_TASK_NO_FINISHED.getStatus(),
null,thisMonthMaxOrder + 1, backApplyInfo.getCode());
tmTask.setCreateTime(DateUtils.getNowDate());
tmTask.setCreateBy(SecurityUtils.getUsername());
// 保存退料信息到 tm_task 表中
result += backApplyInfoMapper.insertTmTask(backApplyInfo);
result += taskMapper.insertTmTask(tmTask);
backApplyInfo.setTaskId(tmTask.getTaskId());
if (result > 0) {
Long taskId = backApplyInfo.getTaskId();
result += backApplyInfoMapper.insertTaskAgreement(backApplyInfo);
backApplyInfo.setTaskId(taskId);
TmTaskAgreement tmTaskAgreement = new TmTaskAgreement(tmTask.getTaskId(), dto.getBackApplyInfo().getAgreementId());
tmTaskAgreement.setCreateTime(DateUtils.getNowDate());
tmTaskAgreement.setCreateBy(SecurityUtils.getUsername());
taskAgreementMapper.insertTmTaskAgreement(tmTaskAgreement);
result += backApplyInfoMapper.updateBackApplyInfo(backApplyInfo);
}
// 保存退料详情
@ -440,17 +463,6 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService {
return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), HttpCodeEnum.FAIL.getMsg());
}
/**
* 批量删除退料任务
*
* @param ids 需要删除的退料任务主键
* @return 结果
*/
@Override
public int deleteBackApplyInfoByIds(Long[] ids) {
return backApplyInfoMapper.deleteBackApplyInfoByIds(ids);
}
/**
* 删除退料任务信息
*
@ -488,8 +500,8 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService {
private int deleteTaskInfo(BackApplyInfo backApplyInfo) {
// 删除任务任务协议及相关信息
int result = 0;
result += backApplyInfoMapper.deleteTask(backApplyInfo.getTaskId());
result += backApplyInfoMapper.deleteTaskAgreement(backApplyInfo.getTaskId());
result += taskMapper.deleteTmTaskByTaskId(backApplyInfo.getTaskId());
result += taskAgreementMapper.deleteTmTaskAgreementByTaskId(backApplyInfo.getTaskId());
result += backApplyInfoMapper.deleteBackApply(backApplyInfo.getId());
result += backApplyInfoMapper.deleteBackApplyDetails(backApplyInfo.getId());
result += backApplyInfoMapper.deleteCheckDetails(backApplyInfo.getId());
@ -627,6 +639,16 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService {
return result > 0 ? AjaxResult.success() : AjaxResult.error(HttpCodeEnum.FAIL.getCode(), HttpCodeEnum.FAIL.getMsg());
}
/**
* 新增退料申请app
* @param dto
* @return
*/
@Override
public AjaxResult insertApp(BackApplyRequestVo dto) {
return null;
}
/**
* 更新任务表及退料申请表状态
* @param backApplyInfo
@ -707,11 +729,10 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService {
private int insertTta(Long taskId, List<BackApplyInfo> list) {
int res;
String agreementId = String.valueOf(list.get(0).getAgreementId());
BackApplyInfo backApplyInfo = new BackApplyInfo();
backApplyInfo.setAgreementId(Long.parseLong(agreementId));
backApplyInfo.setTaskId(taskId);
backApplyInfo.setCreateBy(SecurityUtils.getUsername());
res = backApplyInfoMapper.insertTaskAgreement(backApplyInfo);
TmTaskAgreement tmTaskAgreement = new TmTaskAgreement(taskId, Long.parseLong(agreementId));
tmTaskAgreement.setCreateTime(DateUtils.getNowDate());
tmTaskAgreement.setCreateBy(SecurityUtils.getUsername());
res = taskAgreementMapper.insertTmTaskAgreement(tmTaskAgreement);
return res;
}
@ -724,16 +745,16 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService {
Long newTask = null;
// 生成维修单号
String code = genCodeRule();
BackApplyInfo applyInfo = new BackApplyInfo();
applyInfo.setTaskType(4); // 设置任务类型
applyInfo.setCode(code); // 设置单号
applyInfo.setCreateBy(createBy); // 设置创建者
applyInfo.setTaskStatus(0);
int thisMonthMaxOrder = taskMapper.getMonthMaxOrderByDate(DateUtils.getCurrentYear(), DateUtils.getCurrentMonth(), TmTaskTypeEnum.TM_TASK_BACK.getTaskTypeId());
TmTask tmTask = new TmTask(null, TmTaskTypeEnum.TM_TASK_BACK.getTaskTypeId(), BackTaskStatusEnum.BACK_TASK_NO_FINISHED.getStatus(),
null,thisMonthMaxOrder + 1, code);
tmTask.setCreateTime(DateUtils.getNowDate());
tmTask.setCreateBy(createBy);
// 插入任务
int taskId = backApplyInfoMapper.insertTmTask(applyInfo);
int taskId = taskMapper.insertTmTask(tmTask);
// 如果插入成功且返回的 taskId 大于 0
if (taskId > 0 && applyInfo.getTaskId() > 0) {
newTask = applyInfo.getTaskId();
if (taskId > 0 && tmTask.getTaskId() > 0) {
newTask = tmTask.getTaskId();
}
return newTask;
}

View File

@ -128,6 +128,9 @@ public class BmAgreementInfo extends BaseEntity
@ApiModelProperty(value = "结束时间")
private String endTime;
@ApiModelProperty(value = "关联任务ID")
private Long taskId;
@ApiModelProperty(value = "附件列表")
private List<BmFileInfo> bmFileInfos;
}

View File

@ -5,6 +5,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.ToString;
import com.bonus.common.core.web.domain.BaseEntity;
import lombok.experimental.Accessors;
/**
* 附件
@ -13,12 +14,11 @@ import com.bonus.common.core.web.domain.BaseEntity;
* @author xsheng
* @date 2024-09-26
*/
@Data
@ToString
public class BmFileInfo extends BaseEntity
{
@Accessors(chain = true)
public class BmFileInfo extends BaseEntity {
private static final long serialVersionUID = 1L;
/** 主键id */

View File

@ -25,6 +25,11 @@ public class BmProject extends BaseEntity
{
private static final long serialVersionUID = 1L;
/**
* 是否app (app采有非下拉树)
*/
private Boolean isApp;
/** 主键ID */
private Long proId;

View File

@ -23,6 +23,10 @@ import javax.validation.constraints.Size;
public class BmUnit extends BaseEntity
{
private static final long serialVersionUID = 1L;
/**
* 是否app (app采有非下拉树)
*/
private Boolean isApp;
/** 类型ID */
private Long unitId;

View File

@ -61,4 +61,6 @@ public interface BmAgreementInfoMapper
public int deleteBmAgreementInfoByAgreementIds(Long[] agreementIds);
public int selectNumByMonth(Date nowDate);
String getProtocol(String agreementId);
}

View File

@ -137,4 +137,18 @@ public interface SelectMapper {
* @return
*/
List<TypeTreeNode> getUseTypeTreeL21(List<Long> list);
/**
* 获取单位下拉选app
* @param bmUnit
* @return
*/
List<BmUnit> getUnitListApp(BmUnit bmUnit);
/**
* 获取工程下拉选app
* @param bmProject
* @return
*/
List<BmProject> getProjectListApp(BmProject bmProject);
}

View File

@ -16,6 +16,7 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
/**
@ -36,6 +37,10 @@ public class SelectServiceImpl implements SelectService {
*/
@Override
public AjaxResult getUnitList(BmUnit bmUnit) {
if (bmUnit.getIsApp() != null && bmUnit.getIsApp()) {
List<BmUnit> list = mapper.getUnitListApp(bmUnit);
return AjaxResult.success(list);
}
List<ProjectTreeNode> groupList = new ArrayList<>();
List<ProjectTreeNode> list = new ArrayList<>();
try {
@ -59,6 +64,11 @@ public class SelectServiceImpl implements SelectService {
*/
@Override
public AjaxResult getProjectList(BmProject bmProject) {
if (bmProject.getIsApp() != null && bmProject.getIsApp()) {
List<BmProject> list = mapper.getProjectListApp(bmProject);
list.removeIf(Objects::isNull);
return AjaxResult.success(list);
}
List<ProjectTreeNode> groupList = new ArrayList<>();
List<ProjectTreeNode> list = new ArrayList<>();
try {

View File

@ -186,6 +186,12 @@ public class LeaseApplyInfo extends BaseEntity {
@Excel(name = "领料工程", sort = 3)
private String projectName;
/**
* 领料物资名称汇总
*/
@ApiModelProperty(value = "领料物资名称汇总")
private String maTypeNames;
/**
* 预领料合计数
*/

View File

@ -74,4 +74,8 @@ public interface LeaseApplyDetailsMapper {
LeaseApplyDetails getLeaseApplyDetails(@Param("record") LeaseOutDetails record);
int updateLeaseApplyDetailsByLeaseOutRecord(@Param("record") LeaseOutDetails record);
LeaseApplyDetails getOutboundNum(LeaseOutDetails record);
String selectMaTypeNameByParentId(Long parentId);
}

View File

@ -57,4 +57,6 @@ public interface LeaseApplyInfoMapper {
* @return 结果
*/
int deleteLeaseApplyInfoByIds(Long[] ids);
String getTaskId(Long parentId);
}

View File

@ -72,25 +72,4 @@ public interface LeaseOutDetailsMapper {
*/
public int deleteLeaseOutDetailsByIds(Long[] ids);
LeaseApplyDetails getOutboundNum(LeaseOutDetails record);
String getTaskId(Long parentId);
int updateTaskStatus(@Param("taskId") String taskId, @Param("status")int status);
/** 插入领料出库详情表 -- 根据字段选择注入 */
int insertSelective(LeaseOutDetails record);
SltAgreementInfo getSltAgreementInfo(LeaseOutDetails record);
int updSltInfo(SltAgreementInfo sltAgreementInfo);
String getAgreementId(String taskId);
String getProtocol(String agreementId);
int insSltInfo(@Param("record") LeaseOutDetails record, @Param("agreementId")String agreementId,@Param("ma") Type ma);
}

View File

@ -92,7 +92,11 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
*/
@Override
public List<LeaseApplyInfo> selectLeaseApplyInfoList(LeaseApplyInfo leaseApplyInfo) {
return leaseApplyInfoMapper.selectLeaseApplyInfoList(leaseApplyInfo);
List<LeaseApplyInfo> list = leaseApplyInfoMapper.selectLeaseApplyInfoList(leaseApplyInfo);
for (LeaseApplyInfo applyInfo : list) {
applyInfo.setMaTypeNames(leaseApplyDetailsMapper.selectMaTypeNameByParentId(applyInfo.getId()));
}
return list;
}
/**
@ -116,7 +120,7 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
String taskCode = genderTaskCode(thisMonthMaxOrder);
TmTask tmTask = new TmTask(null, TmTaskTypeEnum.TM_TASK_LEASE.getTaskTypeId(),
LeaseTaskStatusEnum.LEASE_TASK_TO_PUBLISHED.getStatus(),
leaseApplyRequestVo.getLeaseApplyInfo().getCompanyId(), "1", thisMonthMaxOrder + 1, taskCode);
leaseApplyRequestVo.getLeaseApplyInfo().getCompanyId(),thisMonthMaxOrder + 1, taskCode);
tmTask.setCreateTime(DateUtils.getNowDate());
tmTask.setCreateBy(SecurityUtils.getUsername());
tmTaskMapper.insertTmTask(tmTask);

View File

@ -3,7 +3,6 @@ package com.bonus.material.lease.service.impl;
import java.math.BigDecimal;
import java.util.List;
import java.util.Objects;
import com.bonus.common.biz.constant.MaterialConstants;
import com.bonus.common.biz.enums.LeaseTaskStatusEnum;
import com.bonus.common.biz.enums.MaMachineStatusEnum;
@ -12,13 +11,17 @@ import com.bonus.common.core.exception.ServiceException;
import com.bonus.common.core.utils.DateUtils;
import com.bonus.common.core.utils.StringUtils;
import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.material.basic.mapper.BmAgreementInfoMapper;
import com.bonus.material.lease.domain.LeaseApplyDetails;
import com.bonus.material.lease.mapper.LeaseApplyDetailsMapper;
import com.bonus.material.lease.mapper.LeaseApplyInfoMapper;
import com.bonus.material.ma.domain.Type;
import com.bonus.material.ma.mapper.MachineMapper;
import com.bonus.material.ma.mapper.TypeMapper;
import com.bonus.material.settlement.domain.SltAgreementInfo;
import com.bonus.material.task.domain.TmTask;
import com.bonus.material.settlement.mapper.SltAgreementInfoMapper;
import com.bonus.material.task.mapper.TmTaskAgreementMapper;
import com.bonus.material.task.mapper.TmTaskMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -36,6 +39,9 @@ import org.springframework.transaction.annotation.Transactional;
@Service
@Slf4j
public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService {
@Autowired
LeaseApplyInfoMapper leaseApplyInfoMapper;
@Autowired
private LeaseOutDetailsMapper leaseOutDetailsMapper;
@ -47,6 +53,18 @@ public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService {
@Autowired
TypeMapper typeMapper;
@Autowired
private TmTaskMapper tmTaskMapper;
@Autowired
private SltAgreementInfoMapper sltAgreementInfoMapper;
@Autowired
BmAgreementInfoMapper bmAgreementInfoMapper;
@Autowired
TmTaskAgreementMapper tmTaskAgreementMapper;
/**
* 查询领料出库详细
*
@ -157,7 +175,7 @@ public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService {
throw new RuntimeException("出库失败,修改任务状态失败");
}
// 5插入结算记录
String taskId = leaseOutDetailsMapper.getTaskId(record.getParentId());
String taskId = leaseApplyInfoMapper.getTaskId(record.getParentId());
res = insSltInfo(taskId, record);
if (res == 0) {
throw new RuntimeException("出库失败,插入结算记录失败");
@ -179,7 +197,7 @@ public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService {
// 判断库存是否足够
private boolean checkStorageIsEnough(LeaseOutDetails record) {
if (record.getManageType().equals(MaTypeManageTypeEnum.NUMBER_DEVICE.getTypeId())) {
LeaseApplyDetails details = leaseOutDetailsMapper.getOutboundNum(record);
LeaseApplyDetails details = leaseApplyDetailsMapper.getOutboundNum(record);
if (details == null) {
return false;
}
@ -204,12 +222,12 @@ public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService {
i++;
}
}
String taskId = leaseOutDetailsMapper.getTaskId(record.getParentId());
String taskId = leaseApplyInfoMapper.getTaskId(record.getParentId());
if (i == leaseApplyDetailsList.size()) {
leaseOutDetailsMapper.updateTaskStatus(taskId, LeaseTaskStatusEnum.LEASE_TASK_FINISHED.getStatus());
tmTaskMapper.updateTaskStatus(taskId, LeaseTaskStatusEnum.LEASE_TASK_FINISHED.getStatus());
res = 1;
} else {
leaseOutDetailsMapper.updateTaskStatus(taskId, LeaseTaskStatusEnum.LEASE_TASK_IN_PROGRESS.getStatus());
tmTaskMapper.updateTaskStatus(taskId, LeaseTaskStatusEnum.LEASE_TASK_IN_PROGRESS.getStatus());
res = 1;
}
return res;
@ -251,7 +269,7 @@ public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService {
}
if (res > 0) {
// 插入领料出库明细表lease_out_details
res = leaseOutDetailsMapper.insertSelective(record);
res = leaseOutDetailsMapper.insertLeaseOutDetails(record);
if (res > 0) {
// 普通机具减少 (ma_type 设备规格表)的库存数量
res = typeMapper.updateMaTypeStockNum(record);
@ -264,15 +282,15 @@ public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService {
public int insSltInfo(String taskId, LeaseOutDetails record) {
int res = 0;
SltAgreementInfo sltAgreementInfo = leaseOutDetailsMapper.getSltAgreementInfo(record);
SltAgreementInfo sltAgreementInfo = sltAgreementInfoMapper.getSltAgreementInfo(record);
if (sltAgreementInfo != null) {
Long num = sltAgreementInfo.getNum();
Long outNum = record.getOutNum();
sltAgreementInfo.setNum(num + outNum);
res = leaseOutDetailsMapper.updSltInfo(sltAgreementInfo);
res = sltAgreementInfoMapper.updSltInfo(sltAgreementInfo);
} else {
String agreementId = leaseOutDetailsMapper.getAgreementId(taskId);
String protocol = leaseOutDetailsMapper.getProtocol(agreementId);
String agreementId = tmTaskAgreementMapper.getAgreementId(taskId);
String protocol = bmAgreementInfoMapper.getProtocol(agreementId);
Type maType = typeMapper.getMaType(record.getTypeId());
if (StringUtils.isEmpty(protocol)) {
maType.setFinalPrice(maType.getLeasePrice());
@ -285,7 +303,7 @@ public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService {
maType.setFinalPrice(maType.getLeasePrice());
}
}
res = leaseOutDetailsMapper.insSltInfo(record, agreementId, maType);
res = sltAgreementInfoMapper.insSltInfo(record, agreementId, maType);
}
return res;
}

View File

@ -44,7 +44,7 @@ public class MachineController extends BaseController {
* 查询机具设备管理列表
*/
@ApiOperation(value = "查询机具设备管理列表1")
@RequiresPermissions("ma:machine:list")
//@RequiresPermissions("ma:machine:list")
@GetMapping("/list")
public TableDataInfo list(Machine machine)
{

View File

@ -5,6 +5,9 @@ import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import cn.hutool.core.convert.Convert;
import com.bonus.common.biz.config.ListPagingUtil;
import com.bonus.common.core.utils.ServletUtils;
import com.bonus.common.log.enums.OperaType;
import com.bonus.material.common.annotation.PreventRepeatSubmit;
import com.bonus.material.purchase.domain.PurchaseCheckDetails;
@ -21,7 +24,8 @@ import com.bonus.material.purchase.service.IPurchaseCheckInfoService;
import com.bonus.common.core.web.controller.BaseController;
import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.common.core.utils.poi.ExcelUtil;
import com.bonus.common.core.web.page.TableDataInfo;
import static com.bonus.common.core.web.page.TableSupport.PAGE_NUM;
import static com.bonus.common.core.web.page.TableSupport.PAGE_SIZE;
/**
* 新购验收任务Controller
@ -42,10 +46,11 @@ public class PurchaseCheckInfoController extends BaseController {
@ApiOperation(value = "查询新购验收任务列表")
//@RequiresPermissions("purchase:info:list")
@GetMapping("/list")
public TableDataInfo list(PurchaseQueryDto purchaseQueryDto) {
startPage();
public AjaxResult list(PurchaseQueryDto purchaseQueryDto) {
List<PurchaseCheckInfo> list = purchaseCheckInfoService.selectPurchaseCheckInfoList(purchaseQueryDto);
return getDataTable(list);
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));
}

View File

@ -70,6 +70,15 @@ public class PurchaseStorageController extends BaseController {
return purchaseStorageService.warehouse(dto);
}
@ApiOperation(value = "查询待绑定编号机具详情")
@PreventRepeatSubmit
@RequiresPermissions("purchase:storage:list")
@PostMapping("/getMachineById")
public AjaxResult getMachineById(@RequestBody PurchaseDto dto) {
return purchaseStorageService.getMachineById(dto);
}
/**
* 驳回或批量驳回
* @param dto

View File

@ -40,6 +40,9 @@ public class PurchaseCheckDetails extends BaseEntity {
@ApiModelProperty(value = "规格名称")
private String typeName;
@ApiModelProperty(value = "机具编号")
private String maCode;
@ApiModelProperty(value = "物资单位名称")
private String unitName;
@ -76,6 +79,14 @@ public class PurchaseCheckDetails extends BaseEntity {
@ApiModelProperty(value = "验收结论")
private String checkResult;
/** 质保材料 */
@ApiModelProperty(value = "质保材料")
private String warnDocuments;
/** 原因 */
@ApiModelProperty(value = "原因")
private String reason;
/** 物资厂家id */
//@Excel(name = "物资厂家id")
@ApiModelProperty(value = "物资厂家id")

View File

@ -20,6 +20,8 @@ import java.util.List;
@NoArgsConstructor
public class PurchaseDto {
private Long id;
@ApiModelProperty(value = "id")
private String taskId;
@ -45,7 +47,7 @@ public class PurchaseDto {
private Integer status;
@ApiModelProperty(value = "出厂日期")
private String productDate;
private Date productDate;
@ApiModelProperty(value = "二级明细id")
private String purchaseId;
@ -74,6 +76,9 @@ public class PurchaseDto {
@ApiModelProperty(value = "提交绑定数据集合")
private List<PurchaseDto> dtoList;
@ApiModelProperty(value = "提交入库数据集合")
private List<PurchaseDto> inPutList;
/** 是否是固定资产编号(0 否1 是) */
@ApiModelProperty(value = "是否是固定资产编号(0 否1 是)")
private String fixCode;

View File

@ -37,8 +37,8 @@ public class PurchaseQueryDto {
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date endTime;
// @ApiModelProperty(value = "外层任务状态")
// private Integer taskStatus;
@ApiModelProperty(value = "外层任务状态")
private Integer taskStatus;
@ApiModelProperty(value = "关键字")
private String keyWord;

View File

@ -1,5 +1,6 @@
package com.bonus.material.purchase.mapper;
import com.bonus.material.purchase.domain.PurchaseCheckDetails;
import com.bonus.material.purchase.domain.dto.PurchaseDto;
import com.bonus.material.purchase.domain.vo.PurchaseVo;
import org.apache.ibatis.annotations.Param;
@ -79,7 +80,7 @@ public interface PurchaseBindMapper {
* @param updatedStatus
* @param purchaseId
*/
void updateStatusById(@Param("updatedStatus") Integer updatedStatus, @Param("id") String purchaseId);
int updateStatusById(@Param("updatedStatus") Integer updatedStatus, @Param("id") String purchaseId);
/**
* 更新数量
@ -95,4 +96,6 @@ public interface PurchaseBindMapper {
* @return
*/
List<PurchaseVo> getDetailById(PurchaseDto purchaseDto);
List<PurchaseCheckDetails> getMachineById(PurchaseDto dto);
}

View File

@ -2,6 +2,7 @@ package com.bonus.material.purchase.mapper;
import java.util.List;
import com.bonus.material.purchase.domain.PurchaseMacodeInfo;
import org.apache.ibatis.annotations.Param;
/**
* 新购验收编号管理Mapper接口
@ -57,4 +58,6 @@ public interface PurchaseMacodeInfoMapper {
* @return 结果
*/
public int deletePurchaseMacodeInfoByIds(Long[] ids);
public int getPurchaseMaCodeCount(@Param("taskId") Long taskId, @Param("typeId") Long typeId);
}

View File

@ -45,10 +45,10 @@ public interface PurchaseStorageMapper {
/**
* 新增机具入库记录
* @param detail
* @param dto
* @return
*/
int insertMachine(PurchaseVo detail);
int insertMachine(PurchaseDto dto);
/**
* 更新库存数量

View File

@ -40,4 +40,11 @@ public interface IPurchaseStorageService {
* @return
*/
AjaxResult reject(PurchaseDto dto);
/**
* 查询机具信息
* @param dto
* @return
*/
AjaxResult getMachineById(PurchaseDto dto);
}

View File

@ -158,17 +158,17 @@ public class PurchaseBindServiceImpl implements IPurchaseBindService {
}
}
}
PurchaseDto purchaseDto = new PurchaseDto();
purchaseDto.setTaskId(dto.getTaskId());
List<PurchaseVo> list = purchaseBindMapper.getDetails(purchaseDto);
Map<Integer, List<Integer>> groupedByIdStatus = list.stream()
.collect(Collectors.groupingBy(
PurchaseVo::getTaskId,
Collectors.mapping(PurchaseVo::getStatus, Collectors.toList())
));
result += groupedByIdStatus.entrySet().stream()
.mapToInt(entry -> updateTaskStatus(entry.getKey(), entry.getValue()))
.sum();
// PurchaseDto purchaseDto = new PurchaseDto();
// purchaseDto.setTaskId(dto.getTaskId());
// List<PurchaseVo> list = purchaseBindMapper.getDetails(purchaseDto);
// Map<Integer, List<Integer>> groupedByIdStatus = list.stream()
// .collect(Collectors.groupingBy(
// PurchaseVo::getTaskId,
// Collectors.mapping(PurchaseVo::getStatus, Collectors.toList())
// ));
// result += groupedByIdStatus.entrySet().stream()
// .mapToInt(entry -> updateTaskStatus(entry.getKey(), entry.getValue()))
// .sum();
if (result > 0) {
return AjaxResult.success("绑定成功");
}
@ -181,17 +181,17 @@ public class PurchaseBindServiceImpl implements IPurchaseBindService {
* @param statusList
* @return
*/
private int updateTaskStatus(Integer taskId, List<Integer> statusList) {
if (statusList.contains(PurchaseTaskStatusEnum.TO_STORE_AFTER_REJECT.getStatus()) ||
statusList.contains(PurchaseTaskStatusEnum.TO_BIND.getStatus())) {
return tmTaskMapper.updateStatusById(MaterialConstants.TEN_CONSTANT, taskId.toString());
} else if (!statusList.contains(PurchaseTaskStatusEnum.TO_STORE_AFTER_REJECT.getStatus()) &&
!statusList.contains(PurchaseTaskStatusEnum.TO_BIND.getStatus()) &&
statusList.contains(PurchaseTaskStatusEnum.TO_STORE.getStatus())) {
return tmTaskMapper.updateStatusById(PurchaseTaskStatusEnum.IN_STORE.getStatus(), taskId.toString());
}
return 0;
}
// private int updateTaskStatus(Integer taskId, List<Integer> statusList) {
// if (statusList.contains(PurchaseTaskStatusEnum.TO_STORE_AFTER_REJECT.getStatus()) ||
// statusList.contains(PurchaseTaskStatusEnum.TO_BIND.getStatus())) {
// return tmTaskMapper.updateStatusById(MaterialConstants.TEN_CONSTANT, taskId.toString());
// } else if (!statusList.contains(PurchaseTaskStatusEnum.TO_STORE_AFTER_REJECT.getStatus()) &&
// !statusList.contains(PurchaseTaskStatusEnum.TO_BIND.getStatus()) &&
// statusList.contains(PurchaseTaskStatusEnum.TO_STORE.getStatus())) {
// return tmTaskMapper.updateStatusById(PurchaseTaskStatusEnum.IN_STORE.getStatus(), taskId.toString());
// }
// return 0;
// }
/**
* 下载二维码
@ -243,27 +243,27 @@ public class PurchaseBindServiceImpl implements IPurchaseBindService {
}
}
}
result += tmTaskMapper.updateStatusById(MaterialConstants.TEN_CONSTANT, dto.getTaskId());
//result += tmTaskMapper.updateStatusById(MaterialConstants.TEN_CONSTANT, dto.getTaskId());
}
//二级页面驳回
if (dto.getPurchaseId() != null) {
List<String> idList = Arrays.asList(dto.getPurchaseId().split(","));
for (String purchaseId : idList) {
purchaseBindMapper.updateStatusById(PurchaseTaskStatusEnum.TO_BIND_AFTER_REJECT.getStatus(), purchaseId);
}
for (String id : idList) {
//根据二级页面驳回状态更新任务状态
dto.setPurchaseId(id);
List<PurchaseVo> list = purchaseBindMapper.getDetails(dto);
if (CollectionUtils.isNotEmpty(list)) {
for (PurchaseVo purchaseVo : list) {
PurchaseDto purchaseDto = new PurchaseDto();
purchaseDto.setTaskId(purchaseVo.getTaskId().toString());
List<PurchaseVo> voList = purchaseBindMapper.getDetails(purchaseDto);
result = getResult(result, voList);
}
}
result += purchaseBindMapper.updateStatusById(PurchaseTaskStatusEnum.TO_BIND_AFTER_REJECT.getStatus(), purchaseId);
}
// for (String id : idList) {
// //根据二级页面驳回状态更新任务状态
// dto.setPurchaseId(id);
// List<PurchaseVo> list = purchaseBindMapper.getDetails(dto);
// if (CollectionUtils.isNotEmpty(list)) {
// for (PurchaseVo purchaseVo : list) {
// PurchaseDto purchaseDto = new PurchaseDto();
// purchaseDto.setTaskId(purchaseVo.getTaskId().toString());
// List<PurchaseVo> voList = purchaseBindMapper.getDetails(purchaseDto);
// result = getResult(result, voList);
// }
// }
// }
}
if (result > 0) {
return AjaxResult.success("操作成功");
@ -277,27 +277,27 @@ public class PurchaseBindServiceImpl implements IPurchaseBindService {
* @param voList
* @return
*/
private int getResult(int result, List<PurchaseVo> voList) {
Map<Integer, List<Integer>> groupedByIdStatus = voList.stream()
.collect(Collectors.groupingBy(
PurchaseVo::getTaskId,
Collectors.mapping(PurchaseVo::getStatus, Collectors.toList())
));
result += groupedByIdStatus.entrySet().stream()
.mapToInt(entry -> {
Integer taskId = entry.getKey();
List<Integer> statusList = entry.getValue();
if (statusList.contains(PurchaseTaskStatusEnum.TO_BIND_AFTER_REJECT.getStatus()) ||
statusList.contains(PurchaseTaskStatusEnum.TO_BIND.getStatus())) {
return tmTaskMapper.updateStatusById(MaterialConstants.TEN_CONSTANT, taskId.toString());
} else if (!statusList.contains(PurchaseTaskStatusEnum.TO_BIND_AFTER_REJECT.getStatus()) && !statusList.contains(PurchaseTaskStatusEnum.TO_BIND.getStatus())
&& statusList.contains(PurchaseTaskStatusEnum.TO_STORE.getStatus())) {
return tmTaskMapper.updateStatusById(PurchaseTaskStatusEnum.IN_STORE.getStatus(), taskId.toString());
}
return 0;
}).sum();
return result;
}
// private int getResult(int result, List<PurchaseVo> voList) {
// Map<Integer, List<Integer>> groupedByIdStatus = voList.stream()
// .collect(Collectors.groupingBy(
// PurchaseVo::getTaskId,
// Collectors.mapping(PurchaseVo::getStatus, Collectors.toList())
// ));
// result += groupedByIdStatus.entrySet().stream()
// .mapToInt(entry -> {
// Integer taskId = entry.getKey();
// List<Integer> statusList = entry.getValue();
// if (statusList.contains(PurchaseTaskStatusEnum.TO_BIND_AFTER_REJECT.getStatus()) ||
// statusList.contains(PurchaseTaskStatusEnum.TO_BIND.getStatus())) {
// return tmTaskMapper.updateStatusById(MaterialConstants.TEN_CONSTANT, taskId.toString());
// } else if (!statusList.contains(PurchaseTaskStatusEnum.TO_BIND_AFTER_REJECT.getStatus()) && !statusList.contains(PurchaseTaskStatusEnum.TO_BIND.getStatus())
// && statusList.contains(PurchaseTaskStatusEnum.TO_STORE.getStatus())) {
// return tmTaskMapper.updateStatusById(PurchaseTaskStatusEnum.IN_STORE.getStatus(), taskId.toString());
// }
// return 0;
// }).sum();
// return result;
// }
/**
* 内层二维码下载

View File

@ -23,6 +23,7 @@ import com.bonus.material.purchase.domain.dto.PurchaseQueryDto;
import com.bonus.material.purchase.domain.vo.PurchaseVerifyVo;
import com.bonus.material.purchase.mapper.PurchaseCheckDetailsMapper;
import com.bonus.material.purchase.domain.vo.PurchaseCheckFormVo;
import com.bonus.material.purchase.mapper.PurchaseMacodeInfoMapper;
import com.bonus.material.task.domain.TmTask;
import com.bonus.material.task.mapper.TmTaskMapper;
import org.apache.commons.lang3.BooleanUtils;
@ -55,6 +56,9 @@ public class PurchaseCheckInfoServiceImpl implements IPurchaseCheckInfoService {
@Resource
private PurchaseCheckDetailsMapper purchaseCheckDetailsMapper;
@Autowired
private PurchaseMacodeInfoMapper purchaseMacodeInfoMapper;
@Resource
private TmTaskMapper tmTaskMapper;
@ -74,18 +78,51 @@ public class PurchaseCheckInfoServiceImpl implements IPurchaseCheckInfoService {
if (purchaseCheckInfo != null) {
purchaseCheckDtoResult.setPurchaseCheckInfo(purchaseCheckInfo);
boolean isAllowPartTransfer = bmConfigService.isBmConfigEnabledWithDefaultFalse(BmConfigItems.BOOLEAN_ALLOW_PURCHASE_PART_TRANSFER);
List<PurchaseCheckDetails> purchaseCheckDetails;
List<PurchaseCheckDetails> purchaseCheckDetailsList;
if (isAllowPartTransfer) {
purchaseCheckDetails = purchaseCheckDetailsMapper.selectPurchaseCheckDetailsListByQueryDto(purchaseQueryDto);
purchaseCheckDetailsList = purchaseCheckDetailsMapper.selectPurchaseCheckDetailsListByQueryDto(purchaseQueryDto);
if (purchaseQueryDto.getStatusList().contains(PurchaseTaskStatusEnum.TO_STORE.getStatus())) {
purchaseCheckDetailsList = purchaseCheckDetailsList.stream()
.filter(o -> MaTypeManageTypeEnum.NUMBER_DEVICE.getTypeId().equals(o.getManageType()) ||
MaTypeManageTypeEnum.CODE_DEVICE.getTypeId().equals(o.getManageType()) && getPurchaseMaCodeCount(o.getTaskId(), o.getTypeId()) > 0)
.collect(Collectors.toList());
}
//针对于app查询可能存在的验收图片
extractedFile(purchaseCheckDetailsList);
} else {
purchaseQueryDto.setStatusList(null);
purchaseCheckDetails = purchaseCheckDetailsMapper.selectPurchaseCheckDetailsListByQueryDto(purchaseQueryDto);
purchaseCheckDetailsList = purchaseCheckDetailsMapper.selectPurchaseCheckDetailsListByQueryDto(purchaseQueryDto);
//针对于app查询可能存在的验收图片
extractedFile(purchaseCheckDetailsList);
}
purchaseCheckDtoResult.setPurchaseCheckDetailsList(purchaseCheckDetails);
purchaseCheckDtoResult.setPurchaseCheckDetailsList(purchaseCheckDetailsList);
}
return purchaseCheckDtoResult;
}
/**
* 提取app新购验收文件信息
* @param purchaseCheckDetailsList
*/
private void extractedFile(List<PurchaseCheckDetails> purchaseCheckDetailsList) {
if (!CollectionUtils.isEmpty(purchaseCheckDetailsList)) {
for (PurchaseCheckDetails purchaseCheckDetails : purchaseCheckDetailsList) {
BmFileInfo fileInfo = new BmFileInfo();
fileInfo.setTaskType(10);
fileInfo.setModelId(purchaseCheckDetails.getId());
fileInfo.setTaskId(purchaseCheckDetails.getTaskId());
List<BmFileInfo> bmFileInfoList = bmFileInfoMapper.selectBmFileInfoList(fileInfo);
if (!CollectionUtils.isEmpty(bmFileInfoList)) {
purchaseCheckDetails.setBmFileInfos(bmFileInfoList);
}
}
}
}
private int getPurchaseMaCodeCount(Long taskId, Long typeId) {
return purchaseMacodeInfoMapper.getPurchaseMaCodeCount(taskId, typeId);
}
/**
* 查询新购验收任务列表
*
@ -106,9 +143,10 @@ public class PurchaseCheckInfoServiceImpl implements IPurchaseCheckInfoService {
purchaseCheckDetails = purchaseCheckDetails.stream().filter(o -> !(MaTypeManageTypeEnum.NUMBER_DEVICE.getTypeId().equals(o.getManageType()) &&
(o.getStatus().equals(PurchaseTaskStatusEnum.TO_BIND.getStatus()) || o.getStatus().equals(PurchaseTaskStatusEnum.TO_BIND_AFTER_REJECT.getStatus())))).collect(Collectors.toList());
OptionalInt minStatus = purchaseCheckDetails.stream().mapToInt(PurchaseCheckDetails::getStatus).min();
OptionalInt maxStatus = purchaseCheckDetails.stream().mapToInt(PurchaseCheckDetails::getStatus).max();
if (isAllowPartTransfer) {
purchaseCheckDetails = purchaseCheckDetails.stream().filter(o -> purchaseQueryDto.getStatusList().contains(o.getStatus())).collect(Collectors.toList());
if (!CollectionUtils.isEmpty(purchaseQueryDto.getStatusList())) {
purchaseCheckDetails = purchaseCheckDetails.stream().filter(o -> purchaseQueryDto.getStatusList().contains(o.getStatus())).collect(Collectors.toList());
}
purchaseInfo.setPurchaseMaTypeName(purchaseCheckDetailsMapper.selectMaTypeNameByTaskAndStatusList(purchaseInfo.getTaskId(), purchaseQueryDto.getStatusList()));
} else {
purchaseInfo.setPurchaseMaTypeName(purchaseCheckDetailsMapper.selectMaTypeNameByTaskAndStatusList(purchaseInfo.getTaskId(), new ArrayList<>()));
@ -132,13 +170,8 @@ public class PurchaseCheckInfoServiceImpl implements IPurchaseCheckInfoService {
purchaseInfo.setPurchaseTaxPrice(calculateTaxPrice(purchaseMaTotalPrice.get(), purchaseInfo.getTaxRate()));
}
// 设置外层任务状态入库待开始入库进行中入库已完成
if (maxStatus.isPresent() && maxStatus.getAsInt() == PurchaseTaskStatusEnum.TO_NOTICE.getStatus()) {
purchaseInfo.setTaskStatus(PurchaseTaskStatusEnum.TASK_TO_START.getStatus()); // 外层任务待开始
} else if (minStatus.isPresent() && minStatus.getAsInt() == PurchaseTaskStatusEnum.IN_STORE.getStatus()) {
purchaseInfo.setTaskStatus(PurchaseTaskStatusEnum.TASK_FINISHED.getStatus()); // 外层任务已完成
} else {
purchaseInfo.setTaskStatus(PurchaseTaskStatusEnum.TASK_IN_PROGRESS.getStatus()); //外层任务进行中
}
TmTask tmTask = tmTaskMapper.selectTmTaskByTaskId(purchaseInfo.getTaskId());
purchaseInfo.setTaskStatus(tmTask.getTaskStatus());
// 设置外层任务列表
if (isAllowPartTransfer) {
purchaseCheckInfoResult.add(purchaseInfo);
@ -189,10 +222,8 @@ public class PurchaseCheckInfoServiceImpl implements IPurchaseCheckInfoService {
int thisMonthMaxOrder = tmTaskMapper.getMonthMaxOrderByDate(DateUtils.getCurrentYear(), DateUtils.getCurrentMonth(), TmTaskTypeEnum.TM_TASK_PURCHASE.getTaskTypeId());
String taskCode = genderTaskCode(thisMonthMaxOrder);
TmTask tmTask = new TmTask(null, TmTaskTypeEnum.TM_TASK_PURCHASE.getTaskTypeId(),
PurchaseTaskStatusEnum.TO_NOTICE.getStatus(),
purchaseCheckInfo.getPurchaseCheckInfo().getCompanyId(), "1", thisMonthMaxOrder + 1, taskCode);
//tmTask.setMonthOrder(thisMonthMaxOrder);
//tmTask.setCode(genderTaskCode(purchaseCheckInfo, thisMonthMaxOrder));
PurchaseTaskStatusEnum.TASK_IN_PROGRESS.getStatus(),
purchaseCheckInfo.getPurchaseCheckInfo().getCompanyId(), thisMonthMaxOrder + 1, taskCode);
tmTask.setCreateTime(DateUtils.getNowDate());
tmTaskMapper.insertTmTask(tmTask);
Long taskId = tmTask.getTaskId();
@ -258,7 +289,6 @@ public class PurchaseCheckInfoServiceImpl implements IPurchaseCheckInfoService {
updateCount += purchaseCheckDetailsMapper.updatePurchaseDetails4Check(details);
}
}
// 注意 维护tm_task的状态但因为新购任务中的物资可以部分流转所以汇总的状态失去意义不再维护
}
return updateCount > 0 ? AjaxResult.success("验证成功") : AjaxResult.error("无验证信息");
} catch (Exception e) {
@ -272,8 +302,6 @@ public class PurchaseCheckInfoServiceImpl implements IPurchaseCheckInfoService {
try {
AjaxResult result = new AjaxResult();
if (!CollectionUtils.isEmpty(purchaseVerifyVo.getPurchaseCheckDetailsList())) {
//Long taskId = purchaseVerifyVo.getPurchaseCheckDetailsList().get(0).getTaskId();
//Integer status = purchaseCheckDetailsList.get(0).getStatus();
if (BooleanUtils.isTrue(purchaseVerifyVo.getVerifyPass())) {
for (PurchaseCheckDetails details : purchaseVerifyVo.getPurchaseCheckDetailsList()) {
if (MaTypeManageTypeEnum.CODE_DEVICE.getTypeId().equals(details.getManageType())) {
@ -282,14 +310,19 @@ public class PurchaseCheckInfoServiceImpl implements IPurchaseCheckInfoService {
details.setStatus(PurchaseTaskStatusEnum.TO_STORE.getStatus());
}
result = purchaseCheckDetailsMapper.updatePurchaseDetails4Check(details) > 0 ? AjaxResult.success("detail验证成功") : AjaxResult.error("details无验证信息");
extractedFile(details);
}
} else {
for (PurchaseCheckDetails details : purchaseVerifyVo.getPurchaseCheckDetailsList()) {
details.setStatus(PurchaseTaskStatusEnum.TO_NOTICE.getStatus());
result = purchaseCheckDetailsMapper.updatePurchaseDetails4Check(details) > 0 ? AjaxResult.success("detail验证驳回成功") : AjaxResult.error("details无验证信息");
tmTaskMapper.updateTmTask(new TmTask()
.setTaskId(details.getTaskId())
.setTaskType(TmTaskTypeEnum.TM_TASK_PURCHASE.getTaskTypeId())
.setTaskStatus(PurchaseTaskStatusEnum.TASK_IN_PROGRESS.getStatus()));
extractedFile(details);
}
}
// 注意 维护tm_task的状态但因为新购任务中的物资可以部分流转所以汇总的状态失去意义不再维护
}
return result;
} catch (Exception e) {
@ -297,6 +330,24 @@ public class PurchaseCheckInfoServiceImpl implements IPurchaseCheckInfoService {
}
}
/**
* app新购验收图片上传方法抽取
* @param details
*/
private void extractedFile(PurchaseCheckDetails details) {
if (!CollectionUtils.isEmpty(details.getBmFileInfos())) {
for (BmFileInfo bmFileInfo : details.getBmFileInfos()) {
if (bmFileInfo.getTaskType() != null && bmFileInfo.getTaskType() == 10) {
bmFileInfo.setTaskId(details.getTaskId());
bmFileInfo.setModelId(details.getId());
bmFileInfo.setCreateBy(SecurityUtils.getUsername());
bmFileInfo.setCreateTime(DateUtils.getNowDate());
bmFileInfoMapper.insertBmFileInfo(bmFileInfo);
}
}
}
}
/**
* 根据任务id查询验收单
*

View File

@ -79,7 +79,7 @@ public class PurchaseNoticePersonServiceImpl implements IPurchaseNoticePersonSer
tmTaskMapper.updateTmTask(new TmTask()
.setTaskId(purchaseNoticePersonDto.getTaskId())
.setTaskType(TmTaskTypeEnum.TM_TASK_PURCHASE.getTaskTypeId())
.setTaskStatus(PurchaseTaskStatusEnum.TO_CHECK.getStatus())
.setTaskStatus(PurchaseTaskStatusEnum.TASK_IN_PROGRESS.getStatus())
);
// 修改采购明细的任务状态

View File

@ -8,6 +8,7 @@ import com.bonus.common.core.utils.StringUtils;
import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.material.ma.mapper.MachineMapper;
import com.bonus.material.purchase.config.RemoteConfig;
import com.bonus.material.purchase.domain.PurchaseCheckDetails;
import com.bonus.material.purchase.domain.dto.PurchaseDto;
import com.bonus.material.purchase.mapper.PurchaseBindMapper;
import com.bonus.material.purchase.mapper.PurchaseStorageMapper;
@ -91,14 +92,12 @@ public class PurchaseStorageServiceImpl implements IPurchaseStorageService {
@Override
@Transactional(rollbackFor = Exception.class)
public AjaxResult warehouse(PurchaseDto dto) {
if (dto.getTaskId() != null) {
//内层入库
return processByPurchaseIds(dto);
/*if (dto.getTaskId() != null) {
//外层入库
return processByTaskIds(dto);
} else if (dto.getPurchaseId() != null) {
//内层入库
return processByPurchaseIds(dto);
}
return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), HttpCodeEnum.FAIL.getMsg());
}*/
}
/**
@ -119,6 +118,17 @@ public class PurchaseStorageServiceImpl implements IPurchaseStorageService {
return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), HttpCodeEnum.FAIL.getMsg());
}
/**
* 查询机具详情
* @param dto
* @return
*/
@Override
public AjaxResult getMachineById(PurchaseDto dto) {
List<PurchaseCheckDetails> list = purchaseBindMapper.getMachineById(dto);
return AjaxResult.success(list);
}
/**
* 内层驳回
* @param purchaseDto
@ -192,16 +202,38 @@ public class PurchaseStorageServiceImpl implements IPurchaseStorageService {
* @return
*/
private AjaxResult processByPurchaseIds(PurchaseDto purchaseDto) {
purchaseDto.setStatus(PurchaseTaskStatusEnum.IN_STORE.getStatus());
int result = 0;
try {
List<PurchaseVo> details = purchaseBindMapper.getDetails(purchaseDto);
List<PurchaseVo> purchaseVoList = purchaseBindMapper.getDetailById(purchaseDto);
if (CollectionUtils.isNotEmpty(details)) {
result += updatePurchaseInfoAndDetails(purchaseVoList, details.get(0), Integer.parseInt(purchaseDto.getPurchaseId()));
List<PurchaseVo> statusList = purchaseStorageMapper.select(details.get(0).getTaskId().toString());
result += updateTaskStatus(statusList);
//判断为数量还是编码入库
if (CollectionUtils.isEmpty(purchaseDto.getInPutList())) {
//数量入库
List<PurchaseVo> details = purchaseBindMapper.getDetails(purchaseDto);
result += updatePurchaseInfoAndDetails(details.get(0), Integer.parseInt(purchaseDto.getPurchaseId()));
} else {
//编码入库
List<PurchaseVo> purchaseVoList = purchaseBindMapper.selectPurchaseCheckInfoById(purchaseDto);
result += purchaseStorageMapper.updateNum(purchaseDto.getPurchaseId(), purchaseDto.getInPutList().size());
for (PurchaseDto dto : purchaseDto.getInPutList()) {
if (CollectionUtils.isNotEmpty(purchaseVoList)) {
for (PurchaseVo purchaseVo : purchaseVoList) {
if (purchaseVo.getMaCode().equals(dto.getMaCode())) {
dto.setOutFacCode(purchaseVo.getOutFacCode() == null ? "" : purchaseVo.getOutFacCode());
dto.setProductDate(purchaseVo.getProductDate() == null ? null : purchaseVo.getProductDate());
}
}
}
dto.setTypeId(purchaseDto.getTypeId());
result += purchaseStorageMapper.insertMachine(dto);
List<PurchaseCheckDetails> list = purchaseBindMapper.getMachineById(purchaseDto);
if (CollectionUtils.isNotEmpty(list)) {
result += purchaseStorageMapper.updateStatusById(PurchaseTaskStatusEnum.TO_STORE.getStatus(), Integer.parseInt(purchaseDto.getPurchaseId()));
} else {
result += purchaseStorageMapper.updateStatusById(PurchaseTaskStatusEnum.IN_STORE.getStatus(), Integer.parseInt(purchaseDto.getPurchaseId()));
}
}
}
List<PurchaseVo> statusList = purchaseStorageMapper.select(purchaseDto.getTaskId());
result += updateTaskStatus(statusList);
if (result > 0) {
return AjaxResult.success("入库成功");
}
@ -217,16 +249,10 @@ public class PurchaseStorageServiceImpl implements IPurchaseStorageService {
* @param purchaseId
* @return
*/
private int updatePurchaseInfoAndDetails(List<PurchaseVo> details, PurchaseVo detail, int purchaseId) {
int result = purchaseStorageMapper.updateStatusById(PurchaseTaskStatusEnum.IN_STORE.getStatus(), purchaseId);
if (MaTypeManageTypeEnum.CODE_DEVICE.getTypeId().equals(Integer.valueOf(detail.getManageType()))) {
for (PurchaseVo purchaseVo : details) {
result += purchaseStorageMapper.insertMachine(purchaseVo);
}
} else if (MaTypeManageTypeEnum.NUMBER_DEVICE.getTypeId().equals(Integer.valueOf(detail.getManageType()))) {
result += purchaseStorageMapper.updateStorageNum(detail.getCheckNum(), detail.getTypeId());
}
return result + purchaseStorageMapper.updateNum(detail.getPurchaseId(), detail.getBindNum());
private int updatePurchaseInfoAndDetails(PurchaseVo detail, int purchaseId) {
int result = purchaseStorageMapper.updateNum(detail.getPurchaseId(), detail.getCheckNum());
result += purchaseStorageMapper.updateStorageNum(detail.getCheckNum(), detail.getTypeId());
return result + purchaseStorageMapper.updateStatusById(PurchaseTaskStatusEnum.IN_STORE.getStatus(), purchaseId);
}
/**
@ -266,7 +292,8 @@ public class PurchaseStorageServiceImpl implements IPurchaseStorageService {
int result = purchaseStorageMapper.updateNum(detail.getPurchaseId(), detail.getBindNum());
result += purchaseStorageMapper.updateStatusById(PurchaseTaskStatusEnum.IN_STORE.getStatus(), Integer.parseInt(detail.getPurchaseId()));
if (MaTypeManageTypeEnum.CODE_DEVICE.getTypeId().equals(Integer.valueOf(detail.getManageType()))) {
result += purchaseStorageMapper.insertMachine(detail);
//根据类型id获取设备详情信息
//result += purchaseStorageMapper.insertMachine(detail);
} else if (MaTypeManageTypeEnum.NUMBER_DEVICE.getTypeId().equals(Integer.valueOf(detail.getManageType()))) {
result += purchaseStorageMapper.updateStorageNum(detail.getBindNum(), detail.getTypeId());
}
@ -290,11 +317,12 @@ public class PurchaseStorageServiceImpl implements IPurchaseStorageService {
.mapToInt(entry -> {
Integer id = entry.getKey();
List<Integer> statusList = entry.getValue();
if (statusList.contains(PurchaseTaskStatusEnum.TO_STORE.getStatus()) || statusList.contains(PurchaseTaskStatusEnum.TO_STORE_AFTER_REJECT.getStatus())) {
return tmTaskMapper.updateStatusById(PurchaseTaskStatusEnum.TASK_IN_PROGRESS.getStatus(), id.toString());
} else if (!statusList.contains(PurchaseTaskStatusEnum.TO_STORE.getStatus()) && !statusList.contains(PurchaseTaskStatusEnum.TO_STORE_AFTER_REJECT.getStatus())
&& statusList.stream().allMatch(status -> status.equals(PurchaseTaskStatusEnum.IN_STORE.getStatus()))) {
return tmTaskMapper.updateStatusById(PurchaseTaskStatusEnum.TASK_FINISHED.getStatus(), id.toString());
// if (statusList.contains(PurchaseTaskStatusEnum.TO_STORE.getStatus()) || statusList.contains(PurchaseTaskStatusEnum.TO_STORE_AFTER_REJECT.getStatus())) {
// return tmTaskMapper.updateStatusById(PurchaseTaskStatusEnum.TASK_IN_PROGRESS.getStatus(), id.toString());
// } else
if (!statusList.contains(PurchaseTaskStatusEnum.TO_STORE.getStatus()) && !statusList.contains(PurchaseTaskStatusEnum.TO_STORE_AFTER_REJECT.getStatus())
&& statusList.stream().allMatch(status -> status.equals(PurchaseTaskStatusEnum.IN_STORE.getStatus()))) {
return tmTaskMapper.updateTaskStatus(id.toString(), PurchaseTaskStatusEnum.TASK_FINISHED.getStatus());
}
return 0;
}).sum();

View File

@ -4,6 +4,8 @@ import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.constraints.NotNull;
import com.bonus.common.log.enums.OperaType;
import com.bonus.material.common.annotation.PreventRepeatSubmit;
import com.bonus.material.repair.domain.RepairPart;
@ -173,7 +175,7 @@ public class RepairAuditDetailsController extends BaseController {
/**
* 修改修试审核详细
*/
@ApiOperation(value = "修改修试审核详细")
@PreventRepeatSubmit
@RequiresPermissions("repair:details:edit")
@ -185,6 +187,18 @@ public class RepairAuditDetailsController extends BaseController {
} catch (Exception e) {
return error("系统错误, " + e.getMessage());
}
}*/
/**
* 批量修改修试审核详细
*/
@ApiOperation(value = "批量修改修试审核详细")
@PreventRepeatSubmit
@RequiresPermissions("repair:details:edit")
@SysLog(title = "批量修试审核详细", businessType = OperaType.UPDATE, logType = 1,module = "仓储管理->批量修改修试审核详细")
@PutMapping
public AjaxResult edit(@RequestBody @NotNull List<RepairAuditDetails> repairAuditDetails) {
return toAjax(repairAuditDetailsService.updateRepairAuditDetailsBatch(repairAuditDetails));
}
/**

View File

@ -10,6 +10,8 @@ import com.bonus.material.repair.domain.RepairApplyRecord;
import com.bonus.material.repair.domain.RepairPartDetails;
import com.bonus.material.repair.domain.RepairTask;
import com.bonus.material.repair.domain.RepairTaskDetails;
import com.bonus.material.repair.domain.vo.RepairDeviceListVo;
import com.bonus.material.repair.domain.vo.RepairDeviceVO;
import com.bonus.material.repair.service.RepairService;
import com.bonus.system.api.domain.SysUser;
import com.fasterxml.jackson.core.JsonProcessingException;
@ -17,13 +19,16 @@ import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.constraints.NotNull;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;
/**
* @author syruan
@ -44,7 +49,7 @@ public class RepairController extends BaseController {
/**
* 获取维修任务列表
*/
@ApiOperation(value = "获取维修任务列表")
@ApiOperation(value = "获取维修任务列表--分页")
@GetMapping("/getRepairTaskList")
@RequiresPermissions(value = "repair:manage:list")
public TableDataInfo getRepairTaskList(RepairTask bean) {
@ -54,21 +59,9 @@ public class RepairController extends BaseController {
}
/**
* 导出维修任务列表
* 获取维修任务列表--不分页--NO_PAGE
*/
@PostMapping("/export")
@RequiresPermissions("repair:manage:export")
@ApiOperation(value = "导出维修任务列表")
public void export(HttpServletResponse response, RepairTask bean) {
List<RepairTask> list = service.exportRepairTaskList(bean);
ExcelUtil<RepairTask> util = new ExcelUtil<>(RepairTask.class);
util.exportExcel(response, list, "维修任务列表");
}
/**
* 获取维修任务列表--APP
*/
@ApiOperation(value = "获取维修任务列表---APP")
@ApiOperation(value = "获取维修任务列表---不分页")
@GetMapping("/getAppRepairTaskList")
@RequiresPermissions("repair:manage:list")
public AjaxResult getAppRepairTaskList(RepairTask bean) {
@ -81,20 +74,20 @@ public class RepairController extends BaseController {
*/
@ApiOperation(value = "获取维修物资设备列表---分页")
@GetMapping("/getRepairMaTypeList")
@RequiresPermissions("repair:manage:preview")
// @RequiresPermissions("repair:manage:preview")
public TableDataInfo getRepairMaTypeList(RepairTaskDetails bean) {
startPage();
List<RepairTaskDetails> list = service.getRepairMaTypeList(bean);
List<RepairDeviceListVo> list = service.getRepairMaTypeList(bean);
return getDataTable(list);
}
/**
* 获取维修任务机具列表
* 获取维修任务机具列表--级页面详情列表
*/
@ApiOperation(value = "获取维修物资设备列表---不分页")
@GetMapping("/getAppRepairMaTypeList")
public AjaxResult getAppRepairMaTypeList(RepairTaskDetails bean) {
List<RepairTaskDetails> list = service.getRepairMaTypeList(bean);
List<RepairDeviceListVo> list = service.getRepairMaTypeList(bean);
return AjaxResult.success(list);
}
@ -106,8 +99,10 @@ public class RepairController extends BaseController {
public AjaxResult submitRepairApply(@RequestBody @NotNull RepairApplyRecord bean) {
try {
String partStrList = bean.getPartStrList();
List<RepairPartDetails> repairPartDetails = objectMapper.readValue(partStrList, new TypeReference<List<RepairPartDetails>>() {});
bean.setPartList(repairPartDetails);
if (StringUtils.isNoneBlank(partStrList)) {
List<RepairPartDetails> repairPartDetails = objectMapper.readValue(partStrList, new TypeReference<List<RepairPartDetails>>() {});
bean.setPartList(Optional.ofNullable(repairPartDetails).orElse(new ArrayList<>()));
}
return service.submitRepairApply(bean);
} catch (JsonProcessingException e) {
throw new ServiceException("Jackson反序列化异常:" + e.getMessage());
@ -115,32 +110,50 @@ public class RepairController extends BaseController {
}
/**
* 快捷维修记录
* 快捷维修 1.把维修都设置为内部维修增加维修配件明细
*/
@ApiOperation(value = "快捷维修记录")
@ApiOperation(value = "快捷维修--批量--默认内部维修")
@PostMapping("/fastRepairApply")
public AjaxResult fastRepairApply(@RequestBody List<RepairTaskDetails> list) {
return service.fastRepairApply(list);
}
/**
* 完成维修
* 批量维修 1.判断维修方式增加维修配件明细
*/
@ApiOperation(value = "完成维修")
@ApiOperation(value = "批量维修--批量--按照传参维修方式进行维修")
@PostMapping("/batchRepairApply")
public AjaxResult batchRepairApply(@RequestBody @NotNull List<RepairDeviceVO> list) {
return service.batchRepairApply(list);
}
/**
* 维修明细--批量审核--更新明细status
*/
@ApiOperation(value = "维修明细更新status--批量")
@PostMapping("/completeRepair")
public AjaxResult completeRepair(@RequestBody ArrayList<Long> ids) {
return toAjax(service.completeRepair(ids));
}
/**
* 提交审核
* 任务维修完成--提交修饰审核
*/
@ApiOperation(value = "提交审核")
@ApiOperation(value = "任务维修完成--提交至修饰审核")
@PostMapping("/endRepairTask")
public AjaxResult endRepairTask(@RequestBody ArrayList<RepairTask> taskList) {
return service.endRepairTask(taskList);
}
/**
* 驳回退料--批量
*/
@ApiOperation(value = "驳回退料--批量")
@DeleteMapping("/{ids}")
public AjaxResult rejectRepair(@PathVariable Long[] ids) {
return service.rejectRepair(Arrays.asList(ids));
}
/**
* 获取维修员下拉选
*/
@ -150,4 +163,17 @@ public class RepairController extends BaseController {
return AjaxResult.success(list);
}
/**
* 导出维修任务列表--外层--壹级列表
*/
@PostMapping("/export")
@RequiresPermissions("repair:manage:export")
@ApiOperation(value = "导出维修任务列表")
public void export(HttpServletResponse response, RepairTask bean) {
List<RepairTask> list = service.exportRepairTaskList(bean);
ExcelUtil<RepairTask> util = new ExcelUtil<>(RepairTask.class);
util.exportExcel(response, list, "维修任务列表");
}
}

View File

@ -7,20 +7,22 @@ import java.util.List;
import com.bonus.common.core.annotation.Excel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import com.bonus.common.core.web.domain.BaseEntity;
import lombok.experimental.Accessors;
/**
* 维修记录对象 repair_apply_record
*
* @author xsheng
* @date 2024-10-16
* @author syruan
*/
@EqualsAndHashCode(callSuper = false)
@Data
@ToString
@Accessors(chain = true)
public class RepairApplyRecord extends BaseEntity {
private static final long serialVersionUID = 1L;
/** $column.columnComment */
@ -53,7 +55,7 @@ public class RepairApplyRecord extends BaseEntity {
/** 维修方式1内部2返厂3报废 */
@Excel(name = "维修方式", readConverterExp = "1=内部2返厂3报废")
private String repairType;
private Integer repairType;
/** 数据所属组织 */
@Excel(name = "数据所属组织")
@ -91,7 +93,7 @@ public class RepairApplyRecord extends BaseEntity {
/** 类型0不收费1收费 */
@Excel(name = "类型", readConverterExp = "0=不收费1收费")
private String partType;
private Integer partType;
/** 配件名称 */
@Excel(name = "配件名称")

View File

@ -91,7 +91,7 @@ public class RepairAuditDetails extends BaseEntity {
/** 0未审核1已审核2驳回 */
@Excel(name = "状态", readConverterExp = "0=未审核,1=已审核,2=驳回")
@ApiModelProperty(value = "0未审核1已审核2驳回")
private char status;
private String status;
/** 数据所属组织 */
@ApiModelProperty(value = "数据所属组织")

View File

@ -1,11 +1,15 @@
package com.bonus.material.repair.domain;
import java.math.BigDecimal;
import java.util.List;
import com.bonus.common.core.annotation.Excel;
import com.bonus.material.basic.domain.BmFileInfo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.ToString;
import com.bonus.common.core.web.domain.BaseEntity;
import lombok.experimental.Accessors;
/**
* 维修配件详细对象 repair_part_details
@ -13,10 +17,9 @@ import com.bonus.common.core.web.domain.BaseEntity;
* @author xsheng
* @date 2024-10-16
*/
@Data
@ToString
@Accessors(chain = true)
public class RepairPartDetails extends BaseEntity {
private static final long serialVersionUID = 1L;
@ -55,7 +58,7 @@ public class RepairPartDetails extends BaseEntity {
/** 类型0不收费1收费 */
@Excel(name = "类型", readConverterExp = "0=不收费1收费")
private String partType;
private Integer partType;
/** 数据所属组织 */
@Excel(name = "数据所属组织")
@ -68,9 +71,27 @@ public class RepairPartDetails extends BaseEntity {
private String repairContent;
/** 维修数量 */
@ApiModelProperty(value = "维修数量")
private Integer repairNum;
/** 报废数量 */
@ApiModelProperty(value = "报废数量")
private Integer scrapNum;
/** 报废原因 */
@ApiModelProperty(value = "报废原因")
private String scrapReason;
/** 报废原因类型0自然损坏1人为损坏 */
@Excel(name = "损坏原因类型", readConverterExp = "0=自然损坏1人为损坏")
private String scrapType;
/** 附件集合 */
@ApiModelProperty(value = "附件集合")
private List<BmFileInfo> fileList;
/** 维修人员 */
@ApiModelProperty(value = "维修人")
private String repairer;
@ApiModelProperty(value = "配件名称")

View File

@ -18,6 +18,13 @@ public class RepairTask {
*/
@ApiModelProperty(value = "任务id")
private String taskId;
@ApiModelProperty(value = "任务状态")
private Integer taskStatus;
@ApiModelProperty(value = "任务类型")
private Integer taskType;
/**
* 维修单号
*/

View File

@ -34,6 +34,13 @@ public class RepairTaskDetails extends BaseEntity {
*/
@ApiModelProperty(value = "类型名称")
private String typeName;
/**
* 规格类型id
*/
@ApiModelProperty(value = "规格型号id")
private String typeId;
/**
* 规格型号
*/
@ -49,13 +56,20 @@ public class RepairTaskDetails extends BaseEntity {
/**
* 编码
*/
@ApiModelProperty(value = "编码")
@ApiModelProperty(value = "设备编码")
private String code;
/**
* 维修总量
*/
@ApiModelProperty(value = "维修总量")
private int repairNum;
/**
* 维修方式: 1内部 2外部返厂 3报废
*/
@ApiModelProperty(value = "维修方式: 1内部 2外部 3报废")
private Integer repairType;
/**
* 维修合格数量
*/
@ -72,12 +86,6 @@ public class RepairTaskDetails extends BaseEntity {
@ApiModelProperty(value = "待修状态")
private String status;
/**
* 规格类型id
*/
@ApiModelProperty(value = "规格型号id")
private String typeId;
@ApiModelProperty(value = "组织id")
private Long companyId;

View File

@ -0,0 +1,65 @@
package com.bonus.material.repair.domain.vo;
import com.bonus.common.biz.domain.BaseVO;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.ArrayList;
import java.util.List;
/**
* @author : 阮世耀
* @version : 1.0
* @CreateTime: 2024-11-15 13:26
* @Description: 维修设备列表返回VO
*/
@EqualsAndHashCode(callSuper = false)
@Data
public class RepairDeviceListVo extends BaseVO {
@ApiModelProperty(value = "id")
private Long id;
@ApiModelProperty(value = "任务ID")
private Integer taskId;
@ApiModelProperty(value = "类型id")
private Long typeNameId;
@ApiModelProperty(value = "设备编码")
private String code;
@ApiModelProperty(value = "类型名称")
private String typeName;
@ApiModelProperty(value = "规格型号id")
private Long typeId;
@ApiModelProperty(value = "规格型号")
private String type;
@ApiModelProperty(value = "物资设备计量单位")
private String unitName;
@ApiModelProperty(value = "管理模式")
private Integer manageType;
@ApiModelProperty(value = "设备表主键id")
private Long maId;
@ApiModelProperty(value = "维修人员")
private String repairer;
@ApiModelProperty(value = "维修总量")
private int repairNum;
@ApiModelProperty(value = "已修数量")
private int repairedNum;
@ApiModelProperty(value = "维修报废数量")
private int scrapNum;
@ApiModelProperty(value = "内层物资类型集合")
private List<RepairDeviceVO> repairDeviceList = new ArrayList<>();
}

View File

@ -0,0 +1,137 @@
package com.bonus.material.repair.domain.vo;
import com.bonus.material.repair.domain.RepairPart;
import com.bonus.material.repair.domain.RepairPartDetails;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import java.util.ArrayList;
import java.util.List;
/**
* @author : 阮世耀
* @version : 1.0
* @CreateTime: 2024-11-15 14:35
* @Description: 维修设备VO
*/
@Data
@Accessors(chain = true)
public class RepairDeviceVO {
@ApiModelProperty(value = "主键")
private Long id;
@ApiModelProperty(value = "任务ID")
private Long taskId;
@ApiModelProperty(value = "设备表主键id")
private Long maId;
@ApiModelProperty(value = "设备类型")
private String typeName;
@ApiModelProperty(value = "规格型号")
private String type;
@ApiModelProperty(value = "规格型号ID")
private Long typeId;
@ApiModelProperty(value = "设备编码")
private String code;
@ApiModelProperty(value = "状态")
private String status;
@ApiModelProperty(value = "维修配件信息")
private String partInfo;
@ApiModelProperty(value = "维修方式: 1内部 2外部返厂 3报废")
private Integer repairType;
@ApiModelProperty(value = "维修人员")
private String repairer;
@ApiModelProperty(value = "管理模式")
private Integer manageType;
@ApiModelProperty(value = "附件")
private String fileUrl;
@ApiModelProperty(value = "维修数量")
private int repairNum;
@ApiModelProperty(value = "维修合格数量")
private int repairedNum;
@ApiModelProperty(value = "维修报废数量")
private int scrapNum;
@ApiModelProperty(value = "编码--内部维修配件集合")
private List<RepairPartDetails> codeInRepairPartList;
@ApiModelProperty(value = "编码--返厂维修配件集合")
private List<RepairPartDetails> codeOutRepairPartList;
@ApiModelProperty(value = "编码--报废维修配件集合")
private List<RepairPartDetails> codeScrapRepairPartList;
@ApiModelProperty(value = "数量--内部维修配件集合")
private List<RepairPartDetails> numberInRepairPartList;
@ApiModelProperty(value = "数量--返厂维修配件集合")
private List<RepairPartDetails> numberOutRepairPartList;
@ApiModelProperty(value = "数量--报废维修配件集合")
private List<RepairPartDetails> numberScrapRepairPartList;
// 手动覆盖 getter 方法确保 List 始终被初始化
public List<RepairPartDetails> getCodeInRepairPartList() {
if (this.codeInRepairPartList == null) {this.codeInRepairPartList = new ArrayList<>();}
return this.codeInRepairPartList;
}
public List<RepairPartDetails> getCodeOutRepairPartList() {
if (this.codeOutRepairPartList == null) {this.codeOutRepairPartList = new ArrayList<>();}
return this.codeOutRepairPartList;
}
public List<RepairPartDetails> getCodeScrapRepairPartList() {
if (this.codeScrapRepairPartList == null) {this.codeScrapRepairPartList = new ArrayList<>();}
return this.codeScrapRepairPartList;
}
public List<RepairPartDetails> getNumberInRepairPartList() {
if (this.numberInRepairPartList == null) {this.numberInRepairPartList = new ArrayList<>();}
return this.numberInRepairPartList;
}
public List<RepairPartDetails> getNumberOutRepairPartList() {
if (this.numberOutRepairPartList == null) {this.numberOutRepairPartList = new ArrayList<>();}
return this.numberOutRepairPartList;
}
public List<RepairPartDetails> getNumberScrapRepairPartList() {
if (this.numberScrapRepairPartList == null) {this.numberScrapRepairPartList = new ArrayList<>();}
return this.numberScrapRepairPartList;
}
// 自定义 clear 方法
public void clear() {
this.id = null;
this.taskId = null;
this.typeName = null;
this.type = null;
this.code = null;
this.status = null;
this.partInfo = null;
this.repairType = null;
this.fileUrl = null;
this.codeInRepairPartList.clear();
this.codeOutRepairPartList.clear();
this.codeScrapRepairPartList.clear();
this.numberInRepairPartList.clear();
this.numberOutRepairPartList.clear();
this.numberScrapRepairPartList.clear();
}
}

View File

@ -1,12 +1,12 @@
package com.bonus.material.repair.mapper;
import java.util.List;
import java.util.Map;
import com.bonus.material.repair.domain.RepairAuditDetails;
import com.bonus.material.repair.domain.RepairPart;
import com.bonus.material.repair.domain.RepairRecord;
import com.bonus.material.repair.domain.RepairTaskDetails;
import com.bonus.common.biz.domain.vo.KeyValueVO;
import com.bonus.material.repair.domain.vo.RepairAuditDetailsVO;
import com.bonus.material.repair.domain.vo.ScrapApplyDetailsVO;
import org.apache.ibatis.annotations.Param;
@ -61,6 +61,14 @@ public interface RepairAuditDetailsMapper {
*/
int updateRepairAuditDetails(RepairAuditDetails repairAuditDetails);
/**
* 批量修改修试审核详细--批量
*
* @param ids 批量修试审核详细
* @return 结果
*/
int updateRepairAuditDetailsBatch(@Param("ids") List<Long> ids, @Param("status") String status);
/**
* 删除修试审核详细
*
@ -89,7 +97,7 @@ public interface RepairAuditDetailsMapper {
* 根据taskIds批量查询规格名称---批量
* @param taskIds 任务id集合
*/
Map<Long, String> selectTypeNamesByTaskIds(@Param("taskIds") List<Long> taskIds);
List<KeyValueVO> selectTypeNamesByTaskIds(@Param("taskIds") List<Long> taskIds);
List<RepairAuditDetails> selectRepairAuditDetailsByTaskId(Long taskId);

View File

@ -4,6 +4,7 @@ import com.bonus.material.repair.domain.RepairApplyRecord;
import com.bonus.material.repair.domain.RepairPartDetails;
import com.bonus.material.repair.domain.RepairTask;
import com.bonus.material.repair.domain.RepairTaskDetails;
import com.bonus.material.repair.domain.vo.RepairDeviceListVo;
import com.bonus.system.api.domain.SysUser;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -27,7 +28,7 @@ public interface RepairMapper {
* 获取维修详细列表
* @param bean 维修任务详情--查询条件
*/
List<RepairTaskDetails> getRepairMaTypeList(RepairTaskDetails bean);
List<RepairDeviceListVo> getRepairMaTypeList(RepairTaskDetails bean);
/**
* 新增维修记录
@ -81,7 +82,7 @@ public interface RepairMapper {
* @param taskList 任务列表集合
* @param userid 用户id
*/
int updateTaskStatus(@Param("taskList") List<RepairTask> taskList, @Param("userId") Long userid);
int updateTaskStatus(@Param("taskList") List<RepairTask> taskList, @Param("userId") Long userid, @Param("taskStatus") Integer taskStatus);
/**
* 新增任务
@ -107,7 +108,7 @@ public interface RepairMapper {
* @param repairNum 维修数量
* @param userid 用户id
*/
int updateRepairedNumTwo(@Param("id")Long id, @Param("repairNum")int repairNum, @Param("userId")Long userid);
int updateRepairedNumTwo(@Param("id") Long id, @Param("repairNum") int repairNum, @Param("userId") Long userid);
/**
* 查询是否存在未完成维修的
@ -122,7 +123,7 @@ public interface RepairMapper {
List<RepairTaskDetails> getDetailsListByTaskId(RepairTask task);
/**
* 新增实验建议审核数据
* 新增修饰审核审核数据
* @param details 数据详情
*/
int addAuditDetails(RepairTaskDetails details);
@ -135,7 +136,7 @@ public interface RepairMapper {
/**
* 新增维修费用
*/
int addRepairCost(@Param("bean") RepairApplyRecord bean, @Param("costs") BigDecimal costs,@Param("partType") String partType);
int addRepairCost(@Param("bean") RepairApplyRecord bean, @Param("costs") BigDecimal costs, @Param("partType") String partType);
/**
* 查询配件价格

View File

@ -80,6 +80,14 @@ public interface IRepairAuditDetailsService {
*/
int updateRepairAuditDetails(RepairAuditDetails repairAuditDetails);
/**
* 批量修改修试审核详细
*
* @param repairAuditDetails 修试审核详细集合
* @return 结果
*/
int updateRepairAuditDetailsBatch(List<RepairAuditDetails> repairAuditDetails);
/**
* 批量删除修试审核详细
*

View File

@ -5,6 +5,8 @@ import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.material.repair.domain.RepairApplyRecord;
import com.bonus.material.repair.domain.RepairTask;
import com.bonus.material.repair.domain.RepairTaskDetails;
import com.bonus.material.repair.domain.vo.RepairDeviceListVo;
import com.bonus.material.repair.domain.vo.RepairDeviceVO;
import com.bonus.system.api.domain.SysUser;
import java.util.ArrayList;
@ -24,15 +26,11 @@ public interface RepairService {
/**
* 获取维修详细列表
* @param bean
* @return
*/
List<RepairTaskDetails> getRepairMaTypeList(RepairTaskDetails bean);
List<RepairDeviceListVo> getRepairMaTypeList(RepairTaskDetails bean);
/**
* 新增维修记录
* @param bean
* @return
* 提交维修记录
*/
AjaxResult submitRepairApply(RepairApplyRecord bean);
@ -43,10 +41,10 @@ public interface RepairService {
*/
AjaxResult fastRepairApply(List<RepairTaskDetails> list);
AjaxResult batchRepairApply(List<RepairDeviceVO> repairDeviceVOList);
/**
* 完成维修
* @param ids
* @return
* 维修明细--批量审核--更新明细status
*/
int completeRepair(ArrayList<Long> ids);
@ -58,11 +56,12 @@ public interface RepairService {
/**
* 提交审核
* @param taskList
* @return
* @param taskList 任务信息集合
*/
AjaxResult endRepairTask(List<RepairTask> taskList);
AjaxResult rejectRepair(List<Long> taskList);
/**
* 导出维修列表

View File

@ -1,11 +1,8 @@
package com.bonus.material.repair.service.impl;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
import cn.hutool.core.collection.CollectionUtil;
import com.bonus.common.biz.constant.MaterialConstants;
import com.bonus.common.biz.domain.vo.KeyValueVO;
import com.bonus.common.biz.enums.RepairTaskStatusEnum;
import com.bonus.common.biz.enums.TmTaskTypeEnum;
import com.bonus.common.core.exception.ServiceException;
@ -16,20 +13,24 @@ import com.bonus.material.repair.domain.*;
import com.bonus.material.repair.domain.vo.RepairAuditDetailsVO;
import com.bonus.material.repair.domain.vo.ScrapApplyDetailsVO;
import com.bonus.material.repair.domain.vo.ScrapAudit;
import com.bonus.material.repair.mapper.RepairAuditDetailsMapper;
import com.bonus.material.repair.mapper.RepairInputDetailsMapper;
import com.bonus.material.repair.service.IRepairAuditDetailsService;
import com.bonus.material.scrap.domain.ScrapApplyDetails;
import com.bonus.material.scrap.mapper.ScrapApplyDetailsMapper;
import com.bonus.material.task.domain.TmTask;
import com.bonus.material.task.domain.TmTaskAgreement;
import com.bonus.material.task.mapper.TmTaskAgreementMapper;
import com.bonus.material.task.mapper.TmTaskMapper;
import com.bonus.material.task.domain.TmTask;
import javax.validation.constraints.NotNull;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import com.bonus.material.repair.mapper.RepairAuditDetailsMapper;
import com.bonus.material.repair.service.IRepairAuditDetailsService;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import javax.validation.constraints.NotNull;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
/**
* 修试审核详细Service业务层处理
@ -38,6 +39,7 @@ import javax.annotation.Resource;
* @date 2024-10-16
*/
@Service
@Slf4j
public class RepairAuditDetailsServiceImpl implements IRepairAuditDetailsService {
@Resource
@ -68,8 +70,7 @@ public class RepairAuditDetailsServiceImpl implements IRepairAuditDetailsService
}
/**
* @param repairAuditDetails
* @return
* @param repairAuditDetails 查询参数
*/
@Override
public List<RepairAuditDetails> getRepairAuditList(RepairAuditDetails repairAuditDetails) {
@ -110,14 +111,14 @@ public class RepairAuditDetailsServiceImpl implements IRepairAuditDetailsService
.collect(Collectors.toList());
// 批量查询 typeName
Map<Long, String> typeNameMap = repairAuditDetailsMapper.selectTypeNamesByTaskIds(taskIds);
List<KeyValueVO> keyValueList = repairAuditDetailsMapper.selectTypeNamesByTaskIds(taskIds);
// 设置 itemType
if (CollectionUtil.isNotEmpty(typeNameMap)) {
if (CollectionUtil.isNotEmpty(keyValueList)) {
Map<String, String> keyValueMap = keyValueList.stream().collect(Collectors.toMap(KeyValueVO::getMapKey, KeyValueVO::getMapValue));
for (ScrapApplyDetailsVO scrapApplyDetailsVO : repairQuestList) {
Long taskId = scrapApplyDetailsVO.getTaskId();
if (taskId != null) {
String typeName = typeNameMap.get(taskId);
String typeName = keyValueMap.get(String.valueOf(taskId));
if (typeName != null) {
scrapApplyDetailsVO.setItemType(typeName);
}
@ -312,7 +313,7 @@ public class RepairAuditDetailsServiceImpl implements IRepairAuditDetailsService
if (CollectionUtil.isNotEmpty(auditDetailList)) {
for (RepairAuditDetails bean : auditDetailList) {
bean.setAuditBy(SecurityUtils.getLoginUser().getUserid());
bean.setStatus(status);
bean.setStatus(String.valueOf(status));
bean.setUpdateBy(String.valueOf(SecurityUtils.getLoginUser().getUserid()));
bean.setAuditRemark(scrapAudit.getRemark());
repairAuditDetailsMapper.updateStatus(bean);
@ -322,7 +323,7 @@ public class RepairAuditDetailsServiceImpl implements IRepairAuditDetailsService
if (auditAllList != null) {
for (RepairAuditDetails bean : auditAllList) {
bean.setAuditBy(SecurityUtils.getLoginUser().getUserid());
bean.setStatus(status);
bean.setStatus(String.valueOf(status));
bean.setUpdateBy(String.valueOf(SecurityUtils.getLoginUser().getUserid()));
bean.setAuditRemark(scrapAudit.getRemark());
repairAuditDetailsMapper.updateStatus(bean);
@ -445,6 +446,33 @@ public class RepairAuditDetailsServiceImpl implements IRepairAuditDetailsService
}
}
/**
* 批量修改修试审核详细
*
* @param repairAuditDetails 修试审核详细
* @return 结果
*/
@Override
public int updateRepairAuditDetailsBatch(@NotNull List<RepairAuditDetails> repairAuditDetails) {
// 提取所有需要更新的 ID
List<Long> ids = repairAuditDetails.stream()
.filter(Objects::nonNull)
.map(RepairAuditDetails::getId)
.filter(Objects::nonNull)
.collect(Collectors.toList());
if (ids.isEmpty()) {
return 0;
}
try {
// 调用 Mapper 方法进行批量更新
return repairAuditDetailsMapper.updateRepairAuditDetailsBatch(ids, String.valueOf(repairAuditDetails.get(0).getStatus()));
} catch (Exception e) {
throw new ServiceException("错误信息描述");
}
}
/**
* 批量删除修试审核详细
*

View File

@ -1,23 +1,31 @@
package com.bonus.material.repair.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import com.bonus.common.biz.enums.RepairTaskStatusEnum;
import com.bonus.common.biz.enums.TmTaskTypeEnum;
import com.bonus.common.core.exception.ServiceException;
import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.common.security.utils.SecurityUtils;
import com.bonus.material.repair.domain.RepairApplyRecord;
import com.bonus.material.repair.domain.RepairPartDetails;
import com.bonus.material.repair.domain.RepairTask;
import com.bonus.material.repair.domain.RepairTaskDetails;
import com.bonus.material.basic.domain.BmFileInfo;
import com.bonus.material.basic.mapper.BmFileInfoMapper;
import com.bonus.material.repair.domain.*;
import com.bonus.material.repair.domain.vo.RepairDeviceListVo;
import com.bonus.material.repair.domain.vo.RepairDeviceVO;
import com.bonus.material.repair.mapper.RepairMapper;
import com.bonus.material.repair.service.RepairService;
import com.bonus.material.task.mapper.TmTaskMapper;
import com.bonus.system.api.domain.SysUser;
import com.bonus.system.api.model.LoginUser;
import org.springframework.dao.DataAccessException;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
/**
* @author syruan
@ -28,6 +36,17 @@ public class RepairServiceImpl implements RepairService {
@Resource
private RepairMapper repairMapper;
@Resource
private TmTaskMapper taskMapper;
@Resource
private BmFileInfoMapper bmFileInfoMapper;
// 1:内部维修 2:外部返厂维修 3:报废
private final int inRepairType = 1, outRepairType = 2, scrapRepairType = 3;
// 维修管理方式--0编码管理 1数量管理
private final int manageTypeByCode = 0, manageTypeByNumber = 1;
@Override
public List<RepairTask> getRepairTaskList(RepairTask bean) {
@ -40,69 +59,101 @@ public class RepairServiceImpl implements RepairService {
}
@Override
public List<RepairTaskDetails> getRepairMaTypeList(RepairTaskDetails bean) {
//Long companyId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
public List<RepairDeviceListVo> getRepairMaTypeList(RepairTaskDetails bean) {
bean.setCompanyId(null);
return repairMapper.getRepairMaTypeList(bean);
List<RepairDeviceListVo> repairMaTypeList = repairMapper.getRepairMaTypeList(bean);
if (repairMaTypeList.isEmpty()) {
return repairMaTypeList;
}
// 创建Map集合用于快速分组使用 ConcurrentHashMap 保证线程安全
Map<Long, RepairDeviceListVo> resultMap = new ConcurrentHashMap<>();
// 遍历处理把相同的父级对象拆分到子集合中
repairMaTypeList.forEach(item -> {
// 创建对象并复制字段value
RepairDeviceVO repairDeviceVO = new RepairDeviceVO();
try {
BeanUtil.copyProperties(item, repairDeviceVO);
} catch (Exception e) {
// 记录异常日志并提供更详细的错误信息
System.err.println("复制属性时发生错误: {}" + e.getMessage());
throw new RuntimeException("复制属性时发生错误", e);
}
if (item.getTypeNameId() == null) {
// 处理 typeNameId 为空的情况
System.err.println("typeNameId 为空,跳过当前项: " + item);
return;
}
// 使用 computeIfAbsent 方法如果 key 不存在则创建一个新对象并添加到 resultMap
resultMap.computeIfAbsent(item.getTypeNameId(), k -> item).getRepairDeviceList().add(repairDeviceVO);
});
return new ArrayList<>(resultMap.values());
}
/**
* 新增维修记录
* 提交维修记录
* @param bean repairApplyRecord
*/
@Override
@Transactional(rollbackFor = Exception.class)
public AjaxResult submitRepairApply(RepairApplyRecord bean) {
public AjaxResult submitRepairApply(@NotNull(message = "参数不能为空") RepairApplyRecord bean) {
// 获取维修详情记录待维修已维修报废的数量
RepairTaskDetails details = repairMapper.getById(bean.getId());
LoginUser loginUser = SecurityUtils.getLoginUser();
bean.setCreateBy(String.valueOf(loginUser.getUserid()));
// 获取维修配件列表
List<RepairPartDetails> partList = bean.getPartList();
BigDecimal sfCosts = new BigDecimal("0");
String nbType = "1";
String fcType = "2";
// 收费配件
String sfPart = "1";
String bsfPart = "0";
if (partList != null && !partList.isEmpty()) {
if (CollectionUtil.isNotEmpty(partList)) {
bean.setRepairNum(partList.get(0).getRepairNum());
bean.setRepairer(partList.get(0).getRepairer());
}
// 根据维修类型更新维修数量报废数量
switch (bean.getRepairType()) {
case "1": {
int repairNum = (details.getRepairedNum() + bean.getRepairNum());
int num = repairNum + details.getScrapNum();
if (num > details.getRepairNum()) {
throw new ServiceException("维修数量大于维修总量");
}
repairMapper.updateRepairedNum(bean.getId(), repairNum, Long.valueOf(bean.getRepairer()), loginUser.getUserid());
case inRepairType: {
int repairNum = verifyRepairNum(bean, details);
// 更新维修数量并修改维修人员
repairMapper.updateRepairedNum(bean.getId(), repairNum, loginUser.getUserid(), loginUser.getUserid());
break;
}
case "2": {
int repairNum = (int) (details.getRepairedNum() + bean.getRepairNum());
int num = repairNum + details.getScrapNum();
if (num > details.getRepairNum()) {
throw new ServiceException("维修数量大于维修总量");
}
case outRepairType: {
int repairNum = verifyRepairNum(bean, details);
// 更新维修数量维修人员不变
repairMapper.updateRepairedNumTwo(bean.getId(), repairNum, loginUser.getUserid());
break;
}
case "3": {
int scrapNum = (int) (details.getScrapNum() + bean.getScrapNum());
case scrapRepairType: {
int scrapNum = details.getScrapNum() + bean.getScrapNum();
int num = scrapNum + details.getRepairedNum();
if (num > details.getRepairNum()) {
throw new ServiceException("维修数量大于维修总量");
}
// 更新报废数量
repairMapper.updateScrapNum(bean.getId(), scrapNum, loginUser.getUserid());
break;
}
default:
break;
}
if (partList != null && !partList.isEmpty()) {
if (nbType.equals(bean.getRepairType())) {
// 判断配件列表是否为空
if (CollectionUtil.isNotEmpty(partList)) {
// 内部维修
if (Objects.equals(inRepairType, bean.getRepairType())) {
// 遍历配件列表判断配件类型收费还是不收费
for (RepairPartDetails partDetails : partList) {
if (partDetails.getPartId() != null) {
// 有维修配件时
// 有维修配件时,如果价格为空设置为0
if (partDetails.getPartCost() == null) {
partDetails.setPartCost(new BigDecimal(0));
}
@ -111,23 +162,30 @@ public class RepairServiceImpl implements RepairService {
partDetails.setTypeId(bean.getTypeId());
partDetails.setCreateBy(String.valueOf(loginUser.getUserid()));
partDetails.setCompanyId(bean.getCompanyId());
// 根据partid 找到配件单价
// 根据 partId 找配件单价
BigDecimal partPrice = repairMapper.selectPartPrice(partDetails.getPartId());
// 设置配件费用
partDetails.setPartCost(partPrice);
// 添加维修配件明细表
repairMapper.addPart(partDetails);
bean.setPartPrice(partDetails.getPartCost());
bean.setPartId((long) partDetails.getPartId().intValue());
bean.setPartNum(partDetails.getPartNum());
bean.setRepairContent(partDetails.getRepairContent());
bean.setPartType(partDetails.getPartType());
// 添加维修记录表
repairMapper.addRecord(bean);
} else {
// 不选维修配件时
// 不选维修配件时, 只添加维修记录表
repairMapper.addRecord(bean);
}
}
}
if (fcType.equals(bean.getRepairType())) {
// 返厂维修
if (outRepairType == bean.getRepairType()) {
bean.setPartName(partList.get(0).getPartName());
bean.setPartType(partList.get(0).getPartType());
bean.setRepairContent(partList.get(0).getRepairContent());
@ -142,81 +200,499 @@ public class RepairServiceImpl implements RepairService {
bean.setPartPrice(partList.get(0).getPartPrice());
}
bean.setPartNum(partList.get(0).getPartNum());
// 新增维修记录表
repairMapper.addRecord(bean);
}
for (RepairPartDetails partDetails : partList) {
if (partDetails.getPartCost() != null) {
BigDecimal partCost = partDetails.getPartCost();
BigDecimal partNumber = new BigDecimal(partDetails.getPartNum());
sfCosts = sfCosts.add(partCost.multiply(partNumber));
}
}
if (!"0".equals(sfCosts.toString())) {
// 配件费用计算
sfCosts = countPartCosts(partList, sfCosts);
// 判断是否是收费配件
if (sfPart.equals(sfCosts.toString())) {
// SQL: 新增维修费用记录表
repairMapper.addRepairCost(bean, sfCosts, sfPart);
}
} else {
// 新增预报废记录
// 新增维修记录表--预报废
repairMapper.addRecord(bean);
}
return AjaxResult.success();
}
/**
* 校验维修数量
*/
private static int verifyRepairNum(RepairApplyRecord bean, RepairTaskDetails details) {
int repairNum = OptionalInt.of(details.getRepairedNum()).orElse(0) + bean.getRepairNum();
if (repairNum + OptionalInt.of(details.getScrapNum()).orElse(0) > details.getRepairNum()) {
throw new ServiceException("维修数量大于维修总量");
}
return repairNum;
}
@Override
@Transactional(rollbackFor = Exception.class)
public AjaxResult fastRepairApply(List<RepairTaskDetails> list) {
LoginUser loginUser = SecurityUtils.getLoginUser();
// 判断待维修数量是否大于0
for (RepairTaskDetails bean : list) {
int repairedNum = bean.getRepairNum() - bean.getRepairedNum() - bean.getScrapNum();
if (repairedNum <= 0) {
throw new ServiceException("选中的数据中包含待维修数量为0的机具请重新选择");
}
}
// 执行SQL 1.增加维修记录表 2.修改维修明细表的维修数量
for (RepairTaskDetails bean : list) {
int repairedNum = bean.getRepairNum() - bean.getRepairedNum() - bean.getScrapNum();
RepairApplyRecord partDetails = new RepairApplyRecord();
partDetails.setTaskId(Long.valueOf(bean.getTaskId()));
partDetails.setMaId(Long.valueOf(bean.getMaId()));
partDetails.setTypeId(Long.valueOf(bean.getTypeId()));
partDetails.setRepairNum(repairedNum);
partDetails.setRepairType("1");
partDetails.setCreateBy(String.valueOf(loginUser.getUserid()));
partDetails.setCompanyId(bean.getCompanyId());
repairMapper.addRecord(partDetails);
RepairApplyRecord repairRecord = new RepairApplyRecord();
repairRecord.setTaskId(Long.valueOf(bean.getTaskId()));
repairRecord.setMaId(Long.valueOf(bean.getMaId()));
repairRecord.setTypeId(Long.valueOf(bean.getTypeId()));
repairRecord.setRepairNum(repairedNum);
// 快捷维修设置为内部维修
repairRecord.setRepairType(inRepairType);
repairRecord.setCreateBy(String.valueOf(loginUser.getUserid()));
repairRecord.setCompanyId(bean.getCompanyId());
repairMapper.addRecord(repairRecord);
int i = repairedNum + bean.getRepairedNum();
repairMapper.updateRepairedNumTwo(bean.getId(), i, loginUser.getUserid());
}
// 执行完毕无异常返回至前端
return AjaxResult.success();
}
@Override
@Transactional(rollbackFor = Exception.class)
public AjaxResult endRepairTask(List<RepairTask> taskList) {
public AjaxResult batchRepairApply(@NotNull List<RepairDeviceVO> repairDeviceVOList) {
// 准备业务逻辑数据
LoginUser loginUser = SecurityUtils.getLoginUser();
for (RepairTask task : taskList) {
int i = repairMapper.getUnFinish(task);
if (i > 0) {
throw new ServiceException("选中的数据中包含维修未完成的,请完成维修再进行提交审核");
// 配件集合
List<RepairPartDetails> partList = new ArrayList<>();
// 校验参数过滤空数据
repairDeviceVOList.removeIf(Objects::isNull);
for (RepairDeviceVO bean : repairDeviceVOList) {
if (bean.getManageType() == null) {
throw new ServiceException("请选择物资管理方式");
}
if (Objects.equals(manageTypeByCode, bean.getManageType())) {
// 物资管理方式--编码管理
// 根据维修方式更新维修数量报废数量
switch (bean.getRepairType()) {
case inRepairType: {
partList = bean.getCodeInRepairPartList();
// 更新维修数量并修改维修人员
repairMapper.updateRepairedNum(bean.getId(), 1, loginUser.getUserid(), loginUser.getUserid());
break;
}
case outRepairType: {
partList = bean.getCodeOutRepairPartList();
// 更新维修数量维修人员不变
repairMapper.updateRepairedNumTwo(bean.getId(), 1, loginUser.getUserid());
break;
}
case scrapRepairType: {
// 报废无需上传配件直接初始化空集合
partList = bean.getCodeScrapRepairPartList();
// 更新报废数量
repairMapper.updateScrapNum(bean.getId(), 1, loginUser.getUserid());
break;
}
default:
System.err.println("请输入正确的维修类型:" + bean.getRepairType());
break;
}
// 统一处理配件集合数据
copeNumberManageInList(bean, partList, loginUser, bean.getManageType());
} else if (Objects.equals(manageTypeByNumber, bean.getManageType())) {
// 物资管理方式--数量管理
if (bean.getId() == null) {
throw new ServiceException("请完善参数维修详情ID为空!");
}
// 处理配件--数量管理--内部维修
if (CollectionUtil.isNotEmpty(bean.getNumberInRepairPartList())) {
// 获取维修详情表中的维修详情记录待维修已维修已报废的数量
RepairTaskDetails details = repairMapper.getById(bean.getId());
if (Objects.isNull(details)) {
throw new ServiceException("此维修记录不存在,请检查后提交!");
}
partList = bean.getNumberInRepairPartList();
if (bean.getNumberInRepairPartList().get(0).getRepairNum() != null && bean.getNumberInRepairPartList().get(0).getRepairNum() != 0) {
// ---------------校验维修数量-----------------
// 统计已维修数量 + 本次维修数量
int repairNum = OptionalInt.of(details.getRepairedNum()).orElse(0) + bean.getNumberInRepairPartList().get(0).getRepairNum();
// 统计报废数量 + 维修合计数量
int num = repairNum + details.getScrapNum();
if (num > details.getRepairNum()) {
throw new ServiceException("维修数量大于维修总量");
}
// ---------------校验维修数量-----------------
// 更新维修数量并修改维修人员
repairMapper.updateRepairedNum(bean.getId(), repairNum, loginUser.getUserid(), loginUser.getUserid());
// 处理配件集合数据
copeNumberManageInList(bean, partList, loginUser, bean.getManageType());
}
}
// 处理配件集合数据 -- 数量管理--外部返厂维修
if (CollectionUtil.isNotEmpty(bean.getNumberOutRepairPartList())) {
// 获取维修详情表中的维修详情记录待维修已维修已报废的数量
RepairTaskDetails details = repairMapper.getById(bean.getId());
if (Objects.isNull(details)) {
throw new ServiceException("此维修记录不存在,请检查后提交!");
}
BigDecimal sfCosts = new BigDecimal("0");
partList = bean.getNumberOutRepairPartList();
// 重新查询维修详情
details = repairMapper.getById(bean.getId());
// 判断外部维修配件数量是否为空
if (partList.get(0).getRepairNum() != null && partList.get(0).getRepairNum() != 0) {
// 统计已维修数量 + 本次维修数量
int repairNum = OptionalInt.of(details.getRepairedNum()).orElse(0) + partList.get(0).getRepairNum();
// 统计报废数量 + 维修合计数量
if ((repairNum + OptionalInt.of(details.getScrapNum()).orElse(0)) > details.getRepairNum()) {
throw new ServiceException("维修数量大于维修总量");
}
// 更新维修数量维修人员不变
repairMapper.updateRepairedNumTwo(bean.getId(), repairNum, loginUser.getUserid());
if (partList.get(0).getSupplierId() == null) {
throw new ServiceException("请选择返厂厂家");
}
// 数量管理--外部返厂维修 -- 记录表插入数据
RepairApplyRecord repairApplyRecord = new RepairApplyRecord();
for (RepairPartDetails repairPartDetails : partList) {
repairApplyRecord.setId(bean.getId()).setTaskId(bean.getTaskId()).setMaId(bean.getMaId()).setTypeId(bean.getTypeId())
.setRepairType(outRepairType).setRepairNum(repairPartDetails.getRepairNum()).setScrapNum(0)
.setPartName(repairPartDetails.getPartName()).setPartType(repairPartDetails.getPartType())
.setRepairContent(repairPartDetails.getRepairContent()).setSupplierId(repairPartDetails.getSupplierId())
.setPartNum(repairPartDetails.getPartNum()).setRepairer(loginUser.getUsername())
.setPartPrice(Optional.ofNullable(repairPartDetails.getPartPrice()).orElse(new BigDecimal(0)))
.setCreateBy(loginUser.getUsername());
// 新增维修记录表
repairMapper.addRecord(repairApplyRecord);
}
sfCosts = countPartCosts(partList, sfCosts);
// TODO: 判断是否是收费配件因数据存在多条可能有些是免费配件 有些收费所以这里用价格统一做处理后续讨论
// SQL: 新增维修费用记录表
repairMapper.addRepairCost(repairApplyRecord, sfCosts, sfCosts.equals(new BigDecimal("0")) ? "0" : "1");
}
}
// 处理配件集合数据 -- 数量管理--报废维修
if (CollectionUtil.isNotEmpty(bean.getNumberScrapRepairPartList())) {
// 判断报废数量是否为空
if (bean.getNumberScrapRepairPartList().get(0).getScrapNum() != null && bean.getNumberScrapRepairPartList().get(0).getScrapNum() > 0) {
// 获取维修详情表中的维修详情记录待维修已维修已报废的数量
RepairTaskDetails details = repairMapper.getById(bean.getId());
if (Objects.isNull(details)) {
throw new ServiceException("此维修记录不存在,请检查后提交!");
}
// -------------校验维修数量开始----------------
// 统计历史已报废数量 + 本次报废数量 = 报废总数
int scrapNum = OptionalInt.of(details.getScrapNum()).orElse(0) + bean.getNumberScrapRepairPartList().get(0).getScrapNum();
// 统计 报废总数 + 历史已维修数量,
int num = scrapNum + details.getRepairedNum();
// 不能大与总的待维修数量
if (num > details.getRepairNum()) {
throw new ServiceException("报废数量大于维修总量! 本次报废数量:" + bean.getScrapNum() + ",已报废数量:" + details.getScrapNum() + ",维修总量:" + details.getRepairNum());
}
// -------------校验维修数量结束----------------
// 更新报废数量
repairMapper.updateScrapNum(bean.getId(), scrapNum, loginUser.getUserid());
if (CollectionUtil.isNotEmpty(bean.getNumberScrapRepairPartList().get(0).getFileList())) {
for (BmFileInfo fileInfo : bean.getNumberScrapRepairPartList().get(0).getFileList()) {
fileInfo.setTaskType(TmTaskTypeEnum.TM_TASK_REPAIR.getTaskTypeId())
.setTaskId(bean.getTaskId()).setModelId(bean.getId())
.setCreateBy(loginUser.getUsername());
bmFileInfoMapper.insertBmFileInfo(fileInfo);
// 报废类型无需配件所以配件为空添加维修记录表
// 维修记录表信息
RepairApplyRecord repairApplyRecord = new RepairApplyRecord();
repairApplyRecord.setTaskId(bean.getTaskId()).setMaId(bean.getMaId()).setTypeId(bean.getTypeId())
.setRepairType(scrapRepairType).setStatus(0L).setIsSlt(0L).setPartNum(0)
.setFileIds(fileInfo.getId() == null ? "" : String.valueOf(fileInfo.getId()))
.setRepairNum(0).setScrapNum(bean.getNumberScrapRepairPartList().get(0).getScrapNum())
.setScrapReason(bean.getNumberScrapRepairPartList().get(0).getScrapReason())
.setScrapType(bean.getNumberScrapRepairPartList().get(0).getScrapType())
.setRepairer(loginUser.getUsername()).setCreateBy(loginUser.getUsername());
// 因报废操作无需配件, 只添加维修记录表
repairMapper.addRecord(repairApplyRecord);
}
} else {
// 报废类型无需配件所以配件为空添加维修记录表
// 维修记录表信息
RepairApplyRecord repairApplyRecord = new RepairApplyRecord();
repairApplyRecord.setTaskId(bean.getTaskId()).setMaId(bean.getMaId()).setTypeId(bean.getTypeId())
.setRepairType(scrapRepairType).setStatus(0L).setIsSlt(0L).setPartNum(0)
.setRepairNum(0).setScrapNum(bean.getNumberScrapRepairPartList().get(0).getScrapNum())
.setScrapReason(bean.getNumberScrapRepairPartList().get(0).getScrapReason())
.setScrapType(bean.getNumberScrapRepairPartList().get(0).getScrapType())
.setRepairer(loginUser.getUsername()).setCreateBy(loginUser.getUsername());
// 因报废操作无需配件, 只添加维修记录表
repairMapper.addRecord(repairApplyRecord);
}
}
}
} else {
throw new ServiceException("请选择正确的维修类型");
}
}
int i = repairMapper.updateTaskStatus(taskList, loginUser.getUserid());
return AjaxResult.success("维修完成");
}
/**
* 配件列表价格合计
* @param partList 配件列表
* @param sfCosts 配件价格合计
* @return 配件合计后的价格
*/
private static BigDecimal countPartCosts(List<RepairPartDetails> partList, BigDecimal sfCosts) {
for (RepairPartDetails partDetails : partList) {
if (partDetails.getPartPrice() != null) {
BigDecimal partPrice = partDetails.getPartPrice();
BigDecimal partNumber = new BigDecimal(partDetails.getPartNum());
sfCosts = sfCosts.add(partPrice.multiply(partNumber));
}
}
return sfCosts;
}
/**
* 处理配件集合数据
* @param bean 维修申请单
* @param partList 配件列表
* @param loginUser 当前登录用户
* @param manageType 管理方式0编码管理 1数量管理
*/
private void copeNumberManageInList(RepairDeviceVO bean, List<RepairPartDetails> partList, LoginUser loginUser, Integer manageType) {
if (CollectionUtil.isNotEmpty(partList)) {
if (bean.getManageType() == null) {
throw new ServiceException("请选择物资管理方式");
}
// 如果是数量管理那么默认为内部维修
if (bean.getRepairType() == null && manageType == manageTypeByNumber) {
bean.setRepairType(inRepairType);
}
// 再检查还是null的话直接结束任务
if (bean.getRepairType() == null) {
return;
}
// 内部维修
if (bean.getRepairType() == inRepairType) {
RepairApplyRecord repairApplyRecord = new RepairApplyRecord();
// 遍历配件列表判断配件类型收费还是不收费
for (RepairPartDetails partDetails : partList) {
// 维修记录表信息
repairApplyRecord.setTaskId(bean.getTaskId()).setMaId(bean.getMaId()).setTypeId(bean.getTypeId()).setRepairType(inRepairType);
if (manageType == manageTypeByCode) {
repairApplyRecord.setRepairNum(scrapRepairType != bean.getRepairType() ? 1 : 0);
repairApplyRecord.setScrapNum(scrapRepairType == bean.getRepairType() ? 1 : 0);
}
if (manageType == manageTypeByNumber) {
repairApplyRecord.setRepairNum(partDetails.getRepairNum());
}
repairApplyRecord.setCreateBy(loginUser.getUsername());
repairApplyRecord.setStatus(0L);
if (partDetails.getPartId() != null && partDetails.getPartNum() != null) {
// 有维修配件时,如果价格为空设置为0
if (partDetails.getPartCost() == null) {
partDetails.setPartCost(new BigDecimal(0));
}
partDetails.setTaskId(bean.getTaskId()).setMaId(bean.getMaId()).setTypeId(bean.getTypeId()).setCompanyId(null);
partDetails.setCreateBy(String.valueOf(loginUser.getUserid()));
// 根据 partId 找配件单价
BigDecimal partPrice = repairMapper.selectPartPrice(partDetails.getPartId());
// 设置配件单价费用
partDetails.setPartPrice(partPrice);
// 添加维修配件明细表
repairMapper.addPart(partDetails);
// 设置维修记录的配件费用
repairApplyRecord.setId(bean.getId()).setPartPrice(partPrice)
.setPartNum(partDetails.getPartNum())
.setRepairContent(partDetails.getRepairContent())
.setPartType(partDetails.getPartType())
.setPartId(partDetails.getPartId() == null ? 0L : partDetails.getPartId());
// 添加维修记录表
repairMapper.addRecord(repairApplyRecord);
} else {
// 不选维修配件时, 只添加维修记录表
repairMapper.addRecord(repairApplyRecord);
}
}
BigDecimal sfCosts = countPartCosts(partList, new BigDecimal(0));
// TODO: 判断是否是收费配件因数据存在多条可能有些是免费配件 有些收费所以这里用价格统一做处理后续讨论
// SQL: 新增维修费用记录表
repairMapper.addRepairCost(repairApplyRecord, sfCosts, sfCosts.equals(new BigDecimal("0")) ? "0" : "1");
}
// 外部维修
if (bean.getRepairType() == outRepairType) {
// ---------------校验维修数量-----------------
// 统计已维修数量 + 本次维修数量
int repairNum = OptionalInt.of(bean.getRepairedNum()).orElse(0) + bean.getRepairNum();
// 统计报废数量 + 维修合计数量 不能 大与> 总的待维修量
if (repairNum + OptionalInt.of(bean.getScrapNum()).orElse(0) > bean.getRepairNum()) {
throw new ServiceException("维修数量大于维修总量");
}
// 更新维修数量维修人员不变
repairMapper.updateRepairedNumTwo(bean.getId(), repairNum, loginUser.getUserid());
// 编码管理--外部返厂维修
RepairApplyRecord repairApplyRecord = new RepairApplyRecord().setId(bean.getId()).setTaskId(bean.getTaskId()).setMaId(bean.getMaId())
.setTypeId(bean.getTypeId()).setRepairType(outRepairType)
.setPartName(partList.get(0).getPartName())
.setPartType(partList.get(0).getPartType())
.setRepairContent(partList.get(0).getRepairContent()).setPartNum(partList.get(0).getPartNum());
if (partList.get(0).getSupplierId() == null) {
throw new ServiceException("请选择返厂厂家");
}
repairApplyRecord.setSupplierId(partList.get(0).getSupplierId());
repairApplyRecord.setPartPrice(Optional.ofNullable(partList.get(0).getPartPrice()).orElse(new BigDecimal(0)));
// 新增维修记录表
repairMapper.addRecord(repairApplyRecord);
// 配件费用计算
BigDecimal sfCosts = countPartCosts(partList, new BigDecimal(0));
// TODO: 判断是否是收费配件因数据存在多条可能有些是免费配件 有些收费所以这里用价格统一做处理后续讨论
// SQL: 新增维修费用记录表
repairMapper.addRepairCost(repairApplyRecord, sfCosts, sfCosts.equals(new BigDecimal("0")) ? "0" : "1");
}
// 如果是报废类型进行上传附件相关处理
if (scrapRepairType == bean.getRepairType()) {
if (CollectionUtil.isNotEmpty(partList.get(0).getFileList())) {
for (BmFileInfo fileInfo : partList.get(0).getFileList()) {
fileInfo.setTaskType(TmTaskTypeEnum.TM_TASK_REPAIR.getTaskTypeId())
.setTaskId(bean.getTaskId()).setModelId(bean.getId())
.setCreateBy(loginUser.getUsername());
bmFileInfoMapper.insertBmFileInfo(fileInfo);
// 配件为空添加维修记录表
RepairApplyRecord repairApplyRecord = new RepairApplyRecord();
repairApplyRecord.setTaskId(bean.getTaskId()).setMaId(bean.getMaId()).setTypeId(bean.getTypeId())
.setRepairType(bean.getRepairType()).setStatus(0L).setFileIds(String.valueOf(fileInfo.getId()))
.setRepairNum(bean.getRepairType() != scrapRepairType ? 1 : 0)
.setScrapNum(bean.getRepairType() == scrapRepairType ? 1 : 0)
.setCreateBy(loginUser.getUsername());
// 不选维修配件时, 只添加维修记录表
repairMapper.addRecord(repairApplyRecord);
}
} else {
// 配件为空添加维修记录表
RepairApplyRecord repairApplyRecord = new RepairApplyRecord();
repairApplyRecord.setTaskId(bean.getTaskId()).setMaId(bean.getMaId()).setTypeId(bean.getTypeId())
.setRepairType(bean.getRepairType()).setStatus(0L)
.setRepairNum(bean.getRepairType() != scrapRepairType ? 1 : 0)
.setScrapNum(bean.getRepairType() == scrapRepairType ? 1 : 0)
.setCreateBy(loginUser.getUsername());
// 不选维修配件时, 只添加维修记录表
repairMapper.addRecord(repairApplyRecord);
}
}
} else {
// 配件为空添加维修记录表
RepairApplyRecord repairApplyRecord = new RepairApplyRecord();
repairApplyRecord.setTaskId(bean.getTaskId()).setMaId(bean.getMaId()).setTypeId(bean.getTypeId())
.setRepairType(bean.getRepairType()).setStatus(0L)
.setRepairNum(bean.getRepairType() != scrapRepairType ? 1 : 0)
.setScrapNum(bean.getRepairType() == scrapRepairType ? 1 : 0)
.setCreateBy(loginUser.getUsername());
// 不选维修配件时, 只添加维修记录表
repairMapper.addRecord(repairApplyRecord);
}
}
@Override
@Transactional(rollbackFor = Exception.class)
public AjaxResult endRepairTask(@NotNull List<RepairTask> taskList) {
LoginUser loginUser = SecurityUtils.getLoginUser();
// 1.查询选择任务是否还有未完成维修的数据
for (RepairTask task : taskList) {
if (repairMapper.getUnFinish(task) > 0) {
return AjaxResult.error("选中的数据中包含维修未完成的,请完成维修再进行提交审核");
}
}
// 2.更新tm_task任务状态
repairMapper.updateTaskStatus(taskList, loginUser.getUserid(), RepairTaskStatusEnum.TASK_STATUS_COMPLETE.getStatus());
// 3.业务逻辑处理
for (RepairTask task : taskList) {
task.setCreateBy(loginUser.getUserid());
// 查询任务的协议id
Long agreementId = repairMapper.getAgreementId(task);
// 查询维修任务的详情表
List<RepairTaskDetails> detailsList = repairMapper.getDetailsListByTaskId(task);
// 新增tm_task表数据修饰审核任务状态是待审核
task.setTaskType(TmTaskTypeEnum.TM_TASK_REPAIR_STORAGE.getTaskTypeId());
task.setTaskStatus(RepairTaskStatusEnum.TASK_STATUS_TO_EXAM.getStatus());
repairMapper.addTask(task);
// 循环插入修饰审核明细表
for (RepairTaskDetails details : detailsList) {
details.setCreateBy(String.valueOf(loginUser.getUserid()));
details.setTaskId(task.getTaskId());
repairMapper.addAuditDetails(details);
}
// 新增协议任务表--关联修饰任务与协议
task.setAgreementId(agreementId);
repairMapper.createAgreementTask(task);
}
return AjaxResult.success();
}
@Override
public AjaxResult rejectRepair(@NotNull List<Long> taskList) {
try {
taskList.forEach(taskId -> taskMapper.updateTaskStatus(String.valueOf(taskId), RepairTaskStatusEnum.TASK_STATUS_REJECT.getStatus()));
} catch (DataAccessException e) {
System.err.println(e.getMessage());
return AjaxResult.error("数据库SQL修改执行失败" + e.getMessage());
}
return AjaxResult.success("执行完成");
}
/**
* 维修明细--批量审核--更新明细status
*/
@Override
public int completeRepair(ArrayList<Long> ids) {
LoginUser loginUser = SecurityUtils.getLoginUser();

View File

@ -1,7 +1,11 @@
package com.bonus.material.settlement.mapper;
import java.util.List;
import com.bonus.material.lease.domain.LeaseOutDetails;
import com.bonus.material.ma.domain.Type;
import com.bonus.material.settlement.domain.SltAgreementInfo;
import org.apache.ibatis.annotations.Param;
/**
* 结算信息Mapper接口
@ -57,4 +61,10 @@ public interface SltAgreementInfoMapper {
* @return 结果
*/
public int deleteSltAgreementInfoByIds(Long[] ids);
SltAgreementInfo getSltAgreementInfo(LeaseOutDetails record);
int updSltInfo(SltAgreementInfo sltAgreementInfo);
int insSltInfo(@Param("record") LeaseOutDetails record, @Param("agreementId")String agreementId, @Param("ma") Type ma);
}

View File

@ -46,20 +46,14 @@ public class TmTask extends BaseEntity {
@ApiModelProperty(value = "数据所属组织")
private Long companyId;
/** 0不启用 1启用 */
@Excel(name = "0不启用 1启用")
@ApiModelProperty(value = "0不启用 1启用")
private String status;
@ApiModelProperty(value = "任务当月序号 例如:1 插入及查询时请携带任务类型")
private Integer monthOrder;
public TmTask(Long taskId, Integer taskType, Integer taskStatus, Long companyId, String status, Integer monthOrder, String code) {
public TmTask(Long taskId, Integer taskType, Integer taskStatus, Long companyId, Integer monthOrder, String code) {
this.taskId = taskId;
this.taskType = taskType;
this.taskStatus = taskStatus;
this.companyId = companyId;
this.status = status;
this.monthOrder = monthOrder;
this.code = code;
}

View File

@ -58,4 +58,6 @@ public interface TmTaskAgreementMapper {
* @return 结果
*/
int deleteTmTaskAgreementByTaskIds(Long[] taskIds);
String getAgreementId(String taskId);
}

View File

@ -52,13 +52,12 @@ public interface TmTaskMapper {
*/
int updateTmTask(TmTask tmTask);
/**
* 根据任务id更新任务状态 -- 批量限制状态
* @param taskId 任务id 必传
* @param newTaskStatus 新状态
* @param newStatus 新状态
*/
int updateTmTaskStatusByTaskId(@Param("taskId") Long taskId, @Param("newTaskStatus") Integer newTaskStatus);
int updateTaskStatus(@Param("taskId") String taskId, @Param("newStatus") int newStatus);
/**
* 删除任务
@ -76,14 +75,6 @@ public interface TmTaskMapper {
*/
int deleteTmTaskByTaskIds(Long[] taskIds);
/**
* 更新任务状态
* @param updatedStatus
* @param id
* @return
*/
int updateStatusById(@Param("updatedStatus") Integer updatedStatus, @Param("id") String id);
int deleteTmTaskByPurchaseIds(Long[] ids);
/**
@ -95,11 +86,4 @@ public interface TmTaskMapper {
*/
String selectTaskNumByMonths(Date nowDate, Integer taskType);
// List<TmTaskRequestVo> getAuditListByLeaseTmTask(@Param("record") TmTaskRequestVo tmTaskRequestVo);
//
// List<TmTaskRequestVo> getAuditListByLeaseTmTaskByPeople(@Param("record") TmTaskRequestVo tmTaskRequestVo);
//
// List<LeaseApplyInfo> getAuditListByLeaseInfo(@Param("record") TmTaskRequestVo record);
//
// List<LeaseApplyDetails> getLeaseApplyDetails(@Param("record") LeaseApplyInfo record);
}

View File

@ -50,7 +50,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
FROM
back_apply_info bai
LEFT JOIN back_apply_details bad on bad.parent_id = bai.id
LEFT JOIN tm_task tt on tt.task_id = bai.task_id and tt.status = '1'
LEFT JOIN tm_task tt on tt.task_id = bai.task_id
LEFT JOIN tm_task_agreement tta on tta.task_id = tt.task_id
LEFT JOIN bm_agreement_info bagi on bagi.agreement_id = tta.agreement_id
AND bagi.`status` = '1'
@ -71,11 +71,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
bai.phone like concat('%', #{keyWord}, '%')
)
</if>
<if test="unitId != null">
and bu.unit_id = #{unitId}
</if>
<if test="proId != null">
and bp.pro_id = #{proId}
</if>
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
<![CDATA[and bai.create_time BETWEEN #{startTime} AND #{endTime} ]]>
</if>
<if test="status != null">
and bai.status = #{status}
and tt.task_status = #{status}
</if>
GROUP BY bai.`code`
ORDER BY bai.create_time desc
@ -309,65 +315,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</trim>
</insert>
<insert id="insertTmTask" parameterType = "com.bonus.material.back.domain.BackApplyInfo" keyColumn="task_id" keyProperty="taskId" useGeneratedKeys="true">
insert into tm_task (
<if test="taskType != null">task_type, </if>
<if test="taskStatus != null">task_status, </if>
<if test="code != null and code != ''">code, </if>
<if test="createBy != null and createBy != ''">create_by, </if>
<if test="remark != null and remark != ''">remark, </if>
<if test="companyId != null">company_id, </if>
create_time
) values (
<if test="taskType != null">#{taskType}, </if>
<if test="taskStatus != null">#{taskStatus}, </if>
<if test="code != null and code != ''">#{code}, </if>
<if test="createBy != null and createBy != ''">#{createBy}, </if>
<if test="remark != null and remark != ''">#{remark}, </if>
<if test="companyId != null">#{companyId}, </if>
NOW()
)
</insert>
<insert id="insertTaskAgreement">
insert into tm_task_agreement
(
<if test="taskId != null">
task_id,
</if>
<if test="agreementId != null">
agreement_id,
</if>
<if test="createBy != null and createBy != ''">
create_by,
</if>
<if test="remark != null and remark != ''">
remark,
</if>
<if test="companyId != null">
company_id,
</if>
create_time
) values (
<if test="taskId != null">
#{taskId},
</if>
<if test="agreementId != null">
#{agreementId},
</if>
<if test="createBy != null and createBy != ''">
#{createBy},
</if>
<if test="remark != null and remark != ''">
#{remark},
</if>
<if test="companyId != null">
#{companyId},
</if>
NOW()
)
</insert>
<insert id="insertBackApplyDetails" useGeneratedKeys="true" keyProperty="id">
insert into back_apply_details
<trim prefix="(" suffix=")" suffixOverrides=",">
@ -565,21 +512,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
delete from back_apply_info where id = #{id}
</delete>
<delete id="deleteBackApplyInfoByIds" parameterType="String">
delete from back_apply_info where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<delete id="deleteTask">
update tm_task set status = 0 where task_id = #{taskId}
</delete>
<delete id="deleteTaskAgreement">
delete from tm_task_agreement where task_id = #{taskId}
</delete>
<delete id="deleteBackApply">
delete from back_apply_info where id = #{id}
</delete>

View File

@ -20,15 +20,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
<result property="companyId" column="company_id" />
<result property="fileName" column="file_name" />
<result property="fileUrl" column="file_url" />
<result property="status" column="status" />
<result property="protocol" column="protocol" />
<result property="isSlt" column="is_slt" />
<result property="taskId" column="task_id" />
</resultMap>
<select id="selectBmAgreementInfoList" parameterType="com.bonus.material.basic.domain.BmAgreementInfo" resultMap="BmAgreementInfoResult">
SELECT bai.agreement_id, bai.agreement_code , contract_code,file_url ,file_name,sign_time,
SELECT bai.agreement_id, bai.agreement_code , contract_code,sign_time,
bu.unit_id,bu.unit_name , bp.pro_id as projectId , bp.pro_name as projectName,
plan_start_time,lease_day,auth_person,phone,bai.remark,bai.protocol
FROM bm_agreement_info bai
@ -60,13 +59,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<select id="selectBmAgreementInfoByAgreementId" parameterType="Long" resultMap="BmAgreementInfoResult">
SELECT bai.agreement_id, bai.agreement_code , contract_code,file_url ,file_name,sign_time,
SELECT bai.agreement_id, bai.agreement_code , contract_code,sign_time,
bu.unit_id,bu.unit_name , bp.pro_id as projectId , bp.pro_name as projectName,
plan_start_time,lease_day,auth_person,phone,bai.remark,bai.protocol
plan_start_time,lease_day,auth_person,phone,bai.remark,bai.protocol,tta.task_id
FROM bm_agreement_info bai
LEFT JOIN bm_project bp ON bp.pro_id = bai.project_id
LEFT JOIN bm_unit bu ON bu.unit_id = bai.unit_id
where bai.status = '1' and agreement_id = #{agreementId}
LEFT JOIN bm_project bp ON bp.pro_id = bai.project_id
LEFT JOIN bm_unit bu ON bu.unit_id = bai.unit_id
LEFT JOIN (select MIN(task_id) as task_id,agreement_id from tm_task_agreement
where agreement_id = #{agreementId}) tta on bai.agreement_id = tta.agreement_id
where bai.status = '1' and bai.agreement_id = #{agreementId}
</select>
<insert id="insertBmAgreementInfo" parameterType="com.bonus.material.basic.domain.BmAgreementInfo" useGeneratedKeys="true" keyProperty="agreementId">
@ -102,8 +103,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="companyId != null">company_id = #{companyId},</if>
<if test="fileName != null">file_name = #{fileName},</if>
<if test="fileUrl != null">file_url = #{fileUrl},</if>
<if test="status != null">status = #{status},</if>
<if test="protocol != null">protocol = #{protocol},</if>
<if test="isSlt != null">is_slt = #{isSlt},</if>
@ -125,4 +124,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectNumByMonth" resultType="java.lang.Integer">
select count(*) from bm_agreement_info where DATE_FORMAT(create_time,'%y%m') = DATE_FORMAT(#{date},'%y%m')
</select>
<select id="getProtocol" resultType="java.lang.String">
select protocol
from bm_agreement_info
where agreement_id = #{agreementId}
</select>
</mapper>

View File

@ -305,4 +305,40 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
ORDER BY
level
</select>
<select id="getUnitListApp" resultType="com.bonus.material.basic.domain.BmUnit">
/*根据标段工程id关联协议查询往来单位*/
<if test="projectId != null">
SELECT DISTINCT bu.unit_id AS unitId,
bu.unit_name AS unitName
FROM bm_project bpl
LEFT JOIN bm_agreement_info bai ON bpl.pro_id = bai.project_id AND bai.`status` = '1'
LEFT JOIN bm_unit bu ON bai.unit_id = bu.unit_id AND bu.del_flag = '0'
WHERE bpl.pro_id = #{projectId} AND bpl.del_flag = '0'
</if>
<if test="projectId == null">
SELECT unit_id AS unitId,
unit_name AS unitName
FROM bm_unit
WHERE del_flag = '0'
</if>
</select>
<select id="getProjectListApp" resultType="com.bonus.material.basic.domain.BmProject">
/*根据往来单位id关联协议查询工程*/
<if test="unitId != null">
SELECT DISTINCT bp.pro_id AS proId,
bp.pro_name AS proName
FROM bm_unit bu
LEFT JOIN bm_agreement_info bai ON bu.unit_id = bai.unit_id AND bai.`status` = '1'
LEFT JOIN bm_project bp ON bai.project_id = bp.pro_id AND bp.del_flag = '0'
WHERE bu.unit_id = #{unitId} AND bu.del_flag = '0'
</if>
<if test="unitId == null">
SELECT pro_id AS proId,
pro_name AS proName
FROM bm_project
WHERE del_flag = '0'
</if>
</select>
</mapper>

View File

@ -36,7 +36,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
IFNULL(lad.pre_num,0) as pre_num,
IFNULL(lad.audit_num,0) as audit_num,
IFNULL(lad.al_num,0) as al_num,
lad.status, mt.unit_name,
IFNULL(lad.status,0) as status, mt.unit_name,
lad.create_by, lad.create_time, lad.update_by, lad.update_time, lad.remark, lad.company_id
from
lease_apply_details lad
@ -188,4 +188,30 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
WHERE
parent_id = #{record.parentId} and type_id = #{record.typeId}
</update>
<select id="getOutboundNum" resultType="com.bonus.material.lease.domain.LeaseApplyDetails">
SELECT id, parent_id as parentId, type_id as typeId, pre_num as preNum, al_num as alNum, `status`, remark
FROM lease_apply_details
WHERE id = #{id} AND (pre_num - IFNULL(al_num, 0)) > 0
</select>
<select id="selectMaTypeNameByParentId" resultType="java.lang.String">
select
GROUP_CONCAT(type_name) typeName
from
(
select
distinct lad.parent_id, mt1.type_name
from
lease_apply_details lad
left join ma_type mt on lad.type_id = mt.type_id
left join ma_type mt1 on mt.parent_id = mt1.type_id
where
1=1
<if test="parentId != null">
and lad.parent_id = #{parentId}
</if>
) t
GROUP BY parent_id
</select>
</mapper>

View File

@ -80,6 +80,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{item}
</foreach>
</if>
<if test="keyWord != null and keyWord != ''">
and (bu.unit_name like concat('%', #{keyWord}, '%') or
bp.pro_name like concat('%', #{keyWord}, '%') or
lai.code like concat('%', #{keyWord}, '%') or
lai.create_by like concat('%', #{keyWord}, '%') or
lai.lease_person like concat('%', #{keyWord}, '%') or
lai.phone like concat('%', #{keyWord}, '%'))
</if>
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
<![CDATA[ AND DATE_FORMAT( lai.create_time, '%Y-%m-%d' ) BETWEEN #{startTime} AND #{endTime} ]]>
</if>
<if test="directId != null "> and lai.direct_id = #{directId}</if>
<if test="leaseType != null and leaseType != ''"> and lai.lease_type = #{leaseType}</if>
<if test="estimateLeaseTime != null "> and lai.estimate_lease_time = #{estimateLeaseTime}</if>
@ -191,4 +202,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{id}
</foreach>
</delete>
<select id="getTaskId" resultType="java.lang.String">
select task_id
from lease_apply_info
where id = #{parentId}
</select>
</mapper>

View File

@ -53,92 +53,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
lod.parent_id = #{parentId}
</where>
</select>
<insert id="insertLeaseOutDetails" parameterType="com.bonus.material.lease.domain.LeaseOutDetails" useGeneratedKeys="true" keyProperty="id">
insert into lease_out_details
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="parentId != null">parent_id,</if>
<if test="typeId != null">type_id,</if>
<if test="maId != null">ma_id,</if>
<if test="outNum != null">out_num,</if>
<if test="outType != null">out_type,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
<if test="companyId != null">company_id,</if>
<if test="carCode != null">car_code,</if>
<if test="pushNotifications != null">push_notifications,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="parentId != null">#{parentId},</if>
<if test="typeId != null">#{typeId},</if>
<if test="maId != null">#{maId},</if>
<if test="outNum != null">#{outNum},</if>
<if test="outType != null">#{outType},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
<if test="companyId != null">#{companyId},</if>
<if test="carCode != null">#{carCode},</if>
<if test="pushNotifications != null">#{pushNotifications},</if>
</trim>
</insert>
<update id="updateLeaseOutDetails" parameterType="com.bonus.material.lease.domain.LeaseOutDetails">
update lease_out_details
<trim prefix="SET" suffixOverrides=",">
<if test="parentId != null">parent_id = #{parentId},</if>
<if test="typeId != null">type_id = #{typeId},</if>
<if test="maId != null">ma_id = #{maId},</if>
<if test="outNum != null">out_num = #{outNum},</if>
<if test="outType != null">out_type = #{outType},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="companyId != null">company_id = #{companyId},</if>
<if test="carCode != null">car_code = #{carCode},</if>
<if test="pushNotifications != null">push_notifications = #{pushNotifications},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteLeaseOutDetailsById" parameterType="Long">
delete from lease_out_details where id = #{id}
</delete>
<delete id="deleteLeaseOutDetailsByIds" parameterType="String">
delete from lease_out_details where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="getOutboundNum" resultType="com.bonus.material.lease.domain.LeaseApplyDetails">
SELECT id, parent_id as parentId, type_id as typeId, pre_num as preNum, al_num as alNum, `status`, remark
FROM lease_apply_details
WHERE id = #{id} AND (pre_num - IFNULL(al_num, 0)) > 0
</select>
<select id="getTaskId" resultType="java.lang.String">
select task_id
from lease_apply_info
where id = #{parentId}
</select>
<update id="updateTaskStatus">
update tm_task
set task_status = #{status},
update_time = NOW()
where task_id = #{taskId}
</update>
<insert id="insertSelective">
insert into lease_out_details
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="parentId!= null">
@ -210,57 +126,35 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</trim>
</insert>
<select id="getSltAgreementInfo" resultType="com.bonus.material.settlement.domain.SltAgreementInfo">
SELECT
id,
agreement_id AS agreementId,
type_id AS typeId,
ma_id AS maId,
num AS num,
start_time AS startTime,
end_time AS endTime,
status AS status,
lease_id AS leaseId,
back_id AS backId,
lease_price AS leasePrice,
buy_price AS buyPrice,
company_id AS companyId
FROM
slt_agreement_info
WHERE
lease_id = #{parentId}
AND
type_id = #{typeId}
AND
ma_id IS NULL
AND
status = '0'
AND
DATE(start_time) = CURDATE();
</select>
<update id="updSltInfo">
update slt_agreement_info
set num = #{num},
update_time = now()
<update id="updateLeaseOutDetails" parameterType="com.bonus.material.lease.domain.LeaseOutDetails">
update lease_out_details
<trim prefix="SET" suffixOverrides=",">
<if test="parentId != null">parent_id = #{parentId},</if>
<if test="typeId != null">type_id = #{typeId},</if>
<if test="maId != null">ma_id = #{maId},</if>
<if test="outNum != null">out_num = #{outNum},</if>
<if test="outType != null">out_type = #{outType},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="companyId != null">company_id = #{companyId},</if>
<if test="carCode != null">car_code = #{carCode},</if>
<if test="pushNotifications != null">push_notifications = #{pushNotifications},</if>
</trim>
where id = #{id}
</update>
<select id="getAgreementId" resultType="java.lang.String">
select agreement_id
from tm_task_agreement
where task_id = #{taskId}
</select>
<delete id="deleteLeaseOutDetailsById" parameterType="Long">
delete from lease_out_details where id = #{id}
</delete>
<select id="getProtocol" resultType="java.lang.String">
select protocol
from bm_agreement_info
where agreement_id = #{agreementId}
</select>
<insert id="insSltInfo">
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,lease_type,create_time)
values (#{agreementId},#{record.typeId},#{record.maId},#{record.outNum},now(),0,#{record.parentId},#{ma.finalPrice},#{ma.buyPrice},'0',#{record.companyId},#{record.leaseType},now());
</insert>
<delete id="deleteLeaseOutDetailsByIds" parameterType="String">
delete from lease_out_details where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -230,7 +230,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
LEFT JOIN purchase_macode_info pm on pcd.task_id = pm.task_id and pm.type_id = pcd.type_id
where 1 = 1
<if test="typeId != null and typeId != ''">
AND mt.id = #{typeId}
AND mt.type_id = #{typeId}
</if>
<if test="supplierId != null and supplierId != ''">
AND ms.supplier_id = #{supplierId}
@ -319,4 +319,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</if>
</select>
<select id="getMachineById" resultType="com.bonus.material.purchase.domain.PurchaseCheckDetails">
SELECT
pmi.id as id,
pmi.task_id as taskId,
pmi.type_id as typeId,
pmi.ma_code as maCode
FROM
purchase_macode_info pmi
LEFT JOIN ma_machine mm ON pmi.ma_code = mm.ma_code
AND mm.type_id = #{typeId}
WHERE
pmi.task_id = #{taskId}
AND pmi.type_id = #{typeId}
AND mm.ma_code IS NULL
</select>
</mapper>

View File

@ -44,7 +44,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select pcd.id, pcd.task_id, pcd.type_id, pcd.purchase_price, pcd.purchase_tax_price, pcd.purchase_num, pcd.check_num, pcd.bind_num, pcd.check_result,
pcd.supplier_id, pcd.status, pcd.create_by, pcd.production_time, pcd.create_time, pcd.update_by, pcd.update_time,
pcd.remark, pcd.check_url_name, pcd.check_url, pcd.input_num, pcd.input_status, pcd.input_time, pcd.file_name,
pcd.file_url, pcd.company_id, pcd.fix_code, mt.type_name, mt.unit_name, mtp.type_name as ma_type_name, mt.manage_type as manage_type
pcd.file_url, pcd.company_id, pcd.fix_code, mt.type_name, mt.unit_name, mtp.type_name as ma_type_name, mt.manage_type as manage_type,
pcd.warn_documents as warnDocuments, pcd.reason as reason
from purchase_check_details pcd
left join ma_type mt on pcd.type_id = mt.type_id
left join ma_type mtp on mt.parent_id = mtp.type_id
@ -109,9 +110,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="productionTime != null">
and pcd.production_time between #{startTime} and #{endTime}
</if>
<!-- <if test="taskStatus != null and taskStatus != ''">-->
<!-- and pcd.status = #{taskStatus}-->
<!-- </if>-->
<if test="statusList != null and statusList.size() > 0">
and pcd.status in
<foreach item="item" collection="statusList" open="(" separator="," close=")">
@ -301,7 +299,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<foreach collection="list" item="item" index="index" separator=",">
(#{item.taskId},#{item.typeId},#{item.purchasePrice},#{item.purchaseTaxPrice},
#{item.purchaseNum},#{item.checkNum},#{item.bindNum},#{item.checkResult},#{item.supplierId},
#{item.status},#{item.productionTime},#{item.createBy},#{item.createTime},#{item.updateBy},
#{item.status},#{item.productionTime},#{item.createBy},NOW(),#{item.updateBy},
#{item.updateTime},#{item.remark},#{item.checkUrlName},#{item.checkUrl},#{item.inputNum},
#{item.inputStatus},#{item.inputTime},#{item.fileName},#{item.fileUrl},#{item.companyId},#{item.fixCode})
</foreach>
@ -334,8 +332,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<update id="updatePurchaseDetails4Check">
update
purchase_check_details
set
`status` = #{status}, check_result = #{checkResult}, check_num = purchase_num
<set>
`status` = #{status},
check_result = #{checkResult},
check_num = purchase_num,
<if test="warnDocuments != null and warnDocuments != ''">
warn_documents = #{warnDocuments},
</if>
<if test="reason != null and reason != ''">
reason = #{reason}
</if>
</set>
where
1=1
<if test="taskId != null">

View File

@ -139,6 +139,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="purchaser != null "> and pci.purchaser = #{purchaser}</if>
<if test="supplierId != null "> and pci.supplier_id = #{supplierId}</if>
<if test="taxRate != null "> and pci.tax_rate = #{taxRate}</if>
<if test="taskStatus != null "> and t.task_status = #{taskStatus}</if>
<if test="keyWord != null and keyWord != ''">
and (
t.code like concat('%', #{keyWord}, '%') or
msi.supplier like concat('%', #{keyWord}, '%') or
pci.create_by like concat('%', #{keyWord}, '%') or
pci.arrival_time like concat('%', #{keyWord}, '%') or
pci.create_time like concat('%', #{keyWord}, '%')
)
</if>
</where>
</select>

View File

@ -122,4 +122,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{id}
</foreach>
</delete>
<select id="getPurchaseMaCodeCount" resultType="Integer">
select count(1) from purchase_macode_info where task_id = #{taskId} and type_id = #{typeId}
</select>
</mapper>

View File

@ -11,6 +11,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="maCode != null">ma_code,</if>
ma_status,
<if test="qrCode != null">qr_code,</if>
<if test="productDate != null">out_fac_time,</if>
<if test="outFacCode != null">out_fac_code,</if>
create_time
</trim>
@ -19,6 +20,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="maCode != null">#{maCode},</if>
1,
<if test="qrCode != null">#{qrCode},</if>
<if test="productDate != null">#{productDate},</if>
<if test="outFacCode != null">#{outFacCode},</if>
now()
</trim>
@ -26,7 +28,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<update id="updateNum">
UPDATE purchase_check_details
SET input_num = #{bindNum},
SET input_num = COALESCE(input_num, 0) + #{bindNum},
input_time = now()
WHERE
id = #{id}

View File

@ -457,21 +457,30 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
update repair_apply_record set status = 1,update_time = now() where id = #{id}
</update>
<select id="selectTypeNamesByTaskIds" resultType="java.util.Map">
<if test="taskIds != null and taskIds.size() > 0">
<select id="selectTypeNamesByTaskIds" resultType="com.bonus.common.biz.domain.vo.KeyValueVO">
select
task_id, GROUP_CONCAT(type_name) as typeName
task_id as mapKey, GROUP_CONCAT(type_name) as mapValue
from
(select distinct rad.task_id, mt1.type_name
from repair_audit_details rad
left join ma_type mt on rad.type_id = mt.type_id
left join ma_type mt1 on mt.parent_id = mt1.type_id
where rad.task_id in
<foreach item="taskId" index="index" collection="taskIds" open="(" separator="," close=")">
#{taskId}
</foreach>
<if test="taskIds != null and taskIds.size() > 0">
where rad.task_id in
<foreach item="taskId" index="index" collection="taskIds" open="(" separator="," close=")">
#{taskId}
</foreach>
</if>
) t
GROUP BY task_id
</if>
</select>
<update id="updateRepairAuditDetailsBatch">
update repair_audit_details
set status = #{status}, update_time = now()
where id in
<foreach item="id" index="index" collection="ids" open="(" separator="," close=")">
#{id}
</foreach>
</update>
</mapper>

View File

@ -13,7 +13,7 @@
<insert id="addTask" useGeneratedKeys="true" keyProperty="taskId">
insert into tm_task (task_status,task_type,code,create_by,create_time,company_id)
values (46,45,#{repairCode},#{createBy},now(),#{companyId});
values (#{taskStatus},#{taskType},#{repairCode},#{createBy},now(),#{companyId});
</insert>
<insert id="createAgreementTask">
@ -22,13 +22,15 @@
</insert>
<insert id="addAuditDetails">
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 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 into repair_cost (task_id,repair_id,type_id,ma_id,repair_num,costs,part_type,status,repair_type)
values (#{bean.taskId},#{bean.id},#{bean.typeId},#{bean.maId},#{bean.repairNum},#{costs},#{partType},'0',#{bean.repairType});
</insert>
<update id="updateRepairedNum">
@ -61,7 +63,7 @@
<update id="updateTaskStatus">
update tm_task
set task_status = '44',
set task_status = #{taskStatus},
update_by = #{userId},
update_time = now()
where task_id in
@ -197,12 +199,13 @@
tt.create_time DESC
</select>
<select id="getRepairMaTypeList" resultType="com.bonus.material.repair.domain.RepairTaskDetails">
<select id="getRepairMaTypeList" resultType="com.bonus.material.repair.domain.vo.RepairDeviceListVo">
select
rad.id as id,
rad.task_id as taskId,
rad.ma_id as maId,
mt2.type_name as typeName,
mt2.type_id as typeNameId,
mt.type_name as type,
mt.unit_name as unitName,
mt.manage_type as manageType,

View File

@ -135,4 +135,45 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{id}
</foreach>
</delete>
<select id="getSltAgreementInfo" resultType="com.bonus.material.settlement.domain.SltAgreementInfo">
SELECT
id,
agreement_id AS agreementId,
type_id AS typeId,
ma_id AS maId,
num AS num,
start_time AS startTime,
end_time AS endTime,
status AS status,
lease_id AS leaseId,
back_id AS backId,
lease_price AS leasePrice,
buy_price AS buyPrice,
company_id AS companyId
FROM
slt_agreement_info
WHERE
lease_id = #{parentId}
AND
type_id = #{typeId}
AND
ma_id IS NULL
AND
status = '0'
AND
DATE(start_time) = CURDATE();
</select>
<update id="updSltInfo">
update slt_agreement_info
set num = #{num},
update_time = now()
where id = #{id}
</update>
<insert id="insSltInfo">
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,lease_type,create_time)
values (#{agreementId},#{record.typeId},#{record.maId},#{record.outNum},now(),0,#{record.parentId},#{ma.finalPrice},#{ma.buyPrice},'0',#{record.companyId},#{record.leaseType},now());
</insert>
</mapper>

View File

@ -32,8 +32,42 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<insert id="insertTmTaskAgreement" parameterType="com.bonus.material.task.domain.TmTaskAgreement" useGeneratedKeys="true" keyProperty="taskId">
INSERT INTO tm_task_agreement (task_id, agreement_id, create_by, create_time, company_id)
VALUES(#{taskId},#{agreementId},#{createBy},NOW(),#{companyId})
insert into tm_task_agreement
(
<if test="taskId != null">
task_id,
</if>
<if test="agreementId != null">
agreement_id,
</if>
<if test="createBy != null and createBy != ''">
create_by,
</if>
<if test="remark != null and remark != ''">
remark,
</if>
<if test="companyId != null">
company_id,
</if>
create_time
) values (
<if test="taskId != null">
#{taskId},
</if>
<if test="agreementId != null">
#{agreementId},
</if>
<if test="createBy != null and createBy != ''">
#{createBy},
</if>
<if test="remark != null and remark != ''">
#{remark},
</if>
<if test="companyId != null">
#{companyId},
</if>
NOW()
)
</insert>
<update id="updateTmTaskAgreement" parameterType="com.bonus.material.task.domain.TmTaskAgreement">
@ -60,4 +94,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{taskId}
</foreach>
</delete>
<select id="getAgreementId" resultType="java.lang.String">
select agreement_id
from tm_task_agreement
where task_id = #{taskId}
</select>
</mapper>

View File

@ -14,13 +14,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
<result property="companyId" column="company_id" />
<result property="status" column="status" />
<result property="monthOrder" column="month_order" />
</resultMap>
<sql id="selectTmTaskVo">
select task_id, task_type, task_status, code, create_by, create_time,
update_by, update_time, remark, company_id, status, month_order
update_by, update_time, remark, company_id, month_order
from tm_task
</sql>
@ -33,7 +32,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="code != null and code != ''"> and code = #{code}</if>
<if test="monthOrder != null and code != ''"> and month_order = #{monthOrder}</if>
<if test="companyId != null "> and company_id = #{companyId}</if>
<if test="status != null and status != ''"> and status = #{status}</if>
</where>
</select>
@ -55,7 +53,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
<if test="companyId != null">company_id,</if>
<if test="status != null">`status`,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="taskType != null">#{taskType},</if>
@ -68,7 +65,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
<if test="companyId != null">#{companyId},</if>
<if test="status != null">#{status},</if>
</trim>
</insert>
@ -82,16 +78,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="companyId != null">company_id = #{companyId},</if>
<if test="status != null">`status` = #{status},</if>
update_time = NOW()
</trim>
where task_id = #{taskId}
</update>
<update id="updateStatusById">
update tm_task set task_status = #{updatedStatus} where task_id = #{id}
<update id="updateTaskStatus">
update tm_task
set task_status = #{newStatus},
update_time = NOW()
where task_id = #{taskId}
</update>
<delete id="deleteTmTaskByTaskId" parameterType="Long">
@ -114,11 +112,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</if>
</select>
<update id="updateTmTaskStatusByTaskId">
update tm_task set task_status = #{newTaskStatus}
where task_id = #{taskId}
</update>
<delete id="deleteTmTaskByPurchaseIds" parameterType="String">
delete from tm_task where task_id in
(
@ -137,120 +130,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
ORDER BY create_time DESC LIMIT 1
</select>
<!-- <select id="getAuditListByLeaseTmTask" resultType="com.bonus.material.task.domain.vo.TmTaskRequestVo">-->
<!-- SELECT DISTINCT-->
<!-- tt.task_id as taskId, tt.task_type as taskType, tt.task_status as taskStatus, tt.status, tt.code,-->
<!-- su.phonenumber AS phoneNumber, sd.dept_name as deptName,-->
<!-- bpl.pro_id as proId,bpl.pro_name as projectName,-->
<!-- bui.unit_id as unitId,bui.unit_name as unitName,-->
<!-- lai.lease_person as leasePerson, lai.phone as leasePhone, tt.create_by as applyFor,-->
<!-- lai.lease_type as leaseType,lai.estimate_lease_time as estimateLeaseTime,-->
<!-- bai.agreement_code as agreementCode,-->
<!-- tt.create_time as createTimes, tt.update_time as updateTimes-->
<!-- FROM-->
<!-- tm_task tt-->
<!-- LEFT JOIN sys_user su ON tt.create_by = su.user_name-->
<!-- LEFT JOIN sys_dept sd ON su.dept_id = sd.dept_id-->
<!-- LEFT JOIN tm_task_agreement tta ON tt.task_id = tta.task_id-->
<!-- LEFT JOIN bm_agreement_info bai ON bai.agreement_id = tta.agreement_id-->
<!-- LEFT JOIN bm_project bpl ON bpl.pro_id = bai.project_id-->
<!-- LEFT JOIN bm_unit bui ON bui.unit_id = bai.unit_id-->
<!-- LEFT JOIN lease_apply_info lai ON lai.task_id = tt.task_id-->
<!-- WHERE-->
<!-- tt.task_type = 2 and tt.status = '1'-->
<!-- <if test="record.taskId != null and record.taskId != '' ">-->
<!-- AND tt.task_id = #{record.taskId}-->
<!-- </if>-->
<!-- <if test="record.startTime != null and record.startTime != '' and record.endTime != null and record.endTime != '' ">-->
<!-- AND tt.update_time BETWEEN CONCAT(#{record.startTime}, ' 00:00:00') AND CONCAT(#{record.endTime}, ' 23:59:59')-->
<!-- </if>-->
<!-- <if test="record.unitId != null and record.unitId != ''">-->
<!-- AND bui.unit_id = #{record.unitId}-->
<!-- </if>-->
<!-- <if test="record.projectId != null and record.projectId != ''">-->
<!-- AND bpl.pro_id = #{record.projectId}-->
<!-- </if>-->
<!-- <if test="record.keyWord != null and record.keyWord != ''">-->
<!-- AND (bai.agreement_code like concat('%', #{record.keyWord}, '%') or-->
<!-- tt.code like concat('%', #{record.keyWord}, '%'))-->
<!-- </if>-->
<!-- GROUP BY tt.task_id-->
<!-- ORDER BY tt.update_time DESC-->
<!-- </select>-->
<!-- <select id="getAuditListByLeaseTmTaskByPeople" resultType="com.bonus.material.task.domain.vo.TmTaskRequestVo">-->
<!-- SELECT DISTINCT-->
<!-- tt.*, su.phonenumber AS phoneNumber, sd.dept_name as deptName,-->
<!-- bpl.pro_id as proId,bpl.pro_name as projectName,-->
<!-- bui.unit_id as unitId,bui.unit_name as unitName,-->
<!-- lai.lease_person as leasePerson, lai.phone as leasePhone, tt.create_by as applyFor,-->
<!-- lai.lease_type as leaseType,lai.estimate_lease_time as estimateLeaseTime,-->
<!-- bai.agreement_code as agreementCode,-->
<!-- tt.create_time as createTimes, tt.update_time as updateTimes-->
<!-- FROM-->
<!-- tm_task tt-->
<!-- LEFT JOIN sys_user su ON tt.create_by = su.user_name-->
<!-- LEFT JOIN sys_dept sd ON su.dept_id = sd.dept_id-->
<!-- LEFT JOIN tm_task_agreement tta ON tt.task_id = tta.task_id-->
<!-- LEFT JOIN bm_agreement_info bai ON bai.agreement_id = tta.agreement_id-->
<!-- LEFT JOIN bm_project bpl ON bpl.pro_id = bai.project_id-->
<!-- LEFT JOIN bm_unit bui ON bui.unit_id = bai.unit_id-->
<!-- LEFT JOIN lease_apply_info lai ON lai.task_id = tt.task_id-->
<!-- WHERE-->
<!-- tt.task_type = 2 and tt.status = '1' and tt.create_by = #{record.createBy}-->
<!-- <if test="record.taskId != null and record.taskId != '' ">-->
<!-- AND tt.task_id = #{record.taskId}-->
<!-- </if>-->
<!-- <if test="record.startTime != null and record.startTime != '' and record.endTime != null and record.endTime != '' ">-->
<!-- AND tt.update_time BETWEEN CONCAT(#{record.startTime}, ' 00:00:00') AND CONCAT(#{record.endTime}, ' 23:59:59')-->
<!-- </if>-->
<!-- <if test="record.unitId != null and record.unitId != ''">-->
<!-- AND bui.unit_id = #{record.unitId}-->
<!-- </if>-->
<!-- <if test="record.projectId != null and record.projectId != ''">-->
<!-- AND bpl.pro_id = #{record.projectId}-->
<!-- </if>-->
<!-- <if test="record.keyWord != null and record.keyWord != ''">-->
<!-- AND (bai.agreement_code like concat('%', #{record.keyWord}, '%') or-->
<!-- tt.code like concat('%', #{record.keyWord}, '%'))-->
<!-- </if>-->
<!-- GROUP BY tt.task_id-->
<!-- ORDER BY tt.update_time DESC-->
<!-- </select>-->
<!-- <select id="getAuditListByLeaseInfo" resultType="com.bonus.material.lease.domain.LeaseApplyInfo">-->
<!-- SELECT-->
<!-- lai.id, lai.code, lai.task_id as taskId, lai.lease_person as leasePerson, lai.phone, lai.type,-->
<!-- lai.create_by as createBy, lai.create_time as createTime, lai.remark, lai.company_id as companyId,-->
<!-- lai.status, lai.direct_id as directId, lai.lease_type as leaseType, lai.estimate_lease_time as estimateLeaseTime,-->
<!-- lai.cost_bearing_party as costBearingParty-->
<!-- FROM-->
<!-- lease_apply_info lai-->
<!-- WHERE-->
<!-- lai.task_id = #{record.taskId} AND lai.`code` = #{record.code}-->
<!-- </select>-->
<!-- <select id="getLeaseApplyDetails" resultType="com.bonus.material.lease.domain.LeaseApplyDetails">-->
<!-- SELECT-->
<!-- lad.*, mt.type_name AS typeModelName, mt1.type_name AS typeName,mt.unit_name as unitName, mt.manage_type as manageType,-->
<!-- case WHEN mt.manage_type = '0' then '编号' else '计数' end manageTypeName,-->
<!-- mt.storage_num, (lad.pre_num - IF(lad.al_num IS NULL,'0',lad.al_num)) AS outNum,mm.ma_code as maCode-->
<!-- FROM-->
<!-- lease_apply_details lad-->
<!-- LEFT JOIN ma_type mt ON lad.type_id = mt.type_id-->
<!-- LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id-->
<!-- LEFT JOIN ma_machine mm ON lad.type_id = mm.type_id-->
<!-- WHERE-->
<!-- lad.parent_id = #{record.taskId}-->
<!-- GROUP BY-->
<!-- lad.id-->
<!-- </select>-->
</mapper>