Merge remote-tracking branch 'frps/master' into frp-master
This commit is contained in:
commit
6aa9887316
|
|
@ -136,4 +136,13 @@ public class BackApplyDetails extends BaseEntity {
|
|||
|
||||
@ApiModelProperty(value = "签名类型")
|
||||
private int signType;
|
||||
|
||||
@ApiModelProperty(value = "协议id")
|
||||
private Long agreementId;
|
||||
|
||||
// 是否存在于xmList
|
||||
private Boolean isXmbUse = false;
|
||||
|
||||
// 是否存在于clzInfoList
|
||||
private Boolean isClzUse = false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -524,4 +524,18 @@ public interface BackApplyInfoMapper {
|
|||
* @return
|
||||
*/
|
||||
List<ExitPermit> getCodeList(ExitPermit bean);
|
||||
|
||||
/**
|
||||
* 数据是否存在于项目中
|
||||
* @param applyInfo
|
||||
* @return
|
||||
*/
|
||||
List<SltAgreementInfo> getXmList(BackApplyDetails applyInfo);
|
||||
|
||||
/**
|
||||
* 数据是否存在于材料项目中
|
||||
* @param applyInfo
|
||||
* @return
|
||||
*/
|
||||
List<SltAgreementInfo> getClzList(BackApplyDetails applyInfo);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -172,10 +172,8 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService {
|
|||
|
||||
// 3. 优化:只有在有编码设备时才查询类型树,减少不必要的复杂查询
|
||||
Map<Long, BigDecimal> typeNumMap = new HashMap<>();
|
||||
if (hasCodedEquipment(backApplyDetailsList)) {
|
||||
List<TypeTreeNode> listL4 = mapper.getUseTypeTreeL4(backApplyInfo);
|
||||
typeNumMap = buildTypeNumMappingSimple(listL4);
|
||||
}
|
||||
List<TypeTreeNode> listL4 = mapper.getUseTypeTreeL4(backApplyInfo);
|
||||
typeNumMap = buildTypeNumMappingSimple(listL4);
|
||||
|
||||
// 4. 一次性查询所有附件信息
|
||||
Map<Long, List<BmFileInfo>> allFileInfoMap = fetchAllFileInfosOptimized(id);
|
||||
|
|
@ -325,10 +323,8 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService {
|
|||
|
||||
// 3. 优化:只有在有编码设备时才查询类型树,减少不必要的复杂查询
|
||||
Map<Long, BigDecimal> typeNumMap = new HashMap<>();
|
||||
if (hasCodedEquipment(backApplyDetailsList)) {
|
||||
List<TypeTreeNode> listL4 = mapper.getUseTypeTreeL4(backApplyInfo);
|
||||
typeNumMap = buildTypeNumMappingSimple(listL4);
|
||||
}
|
||||
List<TypeTreeNode> listL4 = mapper.getUseTypeTreeL4(backApplyInfo);
|
||||
typeNumMap = buildTypeNumMappingSimple(listL4);
|
||||
|
||||
// 4. 一次性查询所有附件信息
|
||||
Map<Long, List<BmFileInfo>> allFileInfoMap = fetchAllFileInfosOptimized(id);
|
||||
|
|
@ -1046,21 +1042,18 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService {
|
|||
result += deleteFileInfoForDetails(backApplyDetailsList, id);
|
||||
// 删除编码设备附件
|
||||
result += deleteFileInfoForMaCodes(maCodeList, id);
|
||||
if (result > 0) {
|
||||
//执行新增操作
|
||||
BackApplyInfo info = dto.getBackApplyInfo();
|
||||
info.setUpdateTime(DateUtils.getNowDate());
|
||||
info.setUpdateBy(SecurityUtils.getLoginUser().getSysUser().getNickName());
|
||||
info.setCode(backApplyInfo.getCode());
|
||||
result += backApplyInfoMapper.updateBackApplyInfo(info);
|
||||
// 保存退料详情
|
||||
result = saveBackApplyDetails(dto, info, result);
|
||||
return AjaxResult.success(result);
|
||||
}
|
||||
//执行新增操作
|
||||
BackApplyInfo info = dto.getBackApplyInfo();
|
||||
info.setUpdateTime(DateUtils.getNowDate());
|
||||
info.setUpdateBy(SecurityUtils.getLoginUser().getSysUser().getNickName());
|
||||
info.setCode(backApplyInfo.getCode());
|
||||
result += backApplyInfoMapper.updateBackApplyInfo(info);
|
||||
// 保存退料详情
|
||||
result = saveBackApplyDetails(dto, info, result);
|
||||
} catch (Exception e) {
|
||||
throw new ServiceException("修改失败,请联系管理员");
|
||||
}
|
||||
return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), HttpCodeEnum.FAIL.getMsg());
|
||||
return AjaxResult.success(HttpCodeEnum.SUCCESS);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -1341,13 +1334,13 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService {
|
|||
* @param allList
|
||||
* @return
|
||||
*/
|
||||
private int updateSlt4BeanClz(MaterialBackApplyInfo record, List<BackApplyInfo> allList) {
|
||||
private int updateSlt4BeanClz(MaterialBackApplyInfo record, List<BackApplyInfo> allList, Long agreementId) {
|
||||
for (BackApplyInfo bean : allList) {
|
||||
MaterialBackApplyInfo materialBackApplyInfo = new MaterialBackApplyInfo();
|
||||
materialBackApplyInfo.setAgreementId(bean.getAgreementId());
|
||||
materialBackApplyInfo.setAgreementId(agreementId);
|
||||
materialBackApplyInfo.setTypeId(bean.getTypeId());
|
||||
materialBackApplyInfo.setMaId(bean.getMaId() != null ? bean.getMaId() : null);
|
||||
List<SltAgreementInfo> infoList = materialBackInfoMapper.getStlInfo(materialBackApplyInfo);
|
||||
List<SltAgreementInfo> infoList = materialBackInfoMapper.getClzInfo(materialBackApplyInfo);
|
||||
if (infoList.size() > 0) {
|
||||
BigDecimal backNum = bean.getBackNum();
|
||||
for (SltAgreementInfo info : infoList) {
|
||||
|
|
@ -1361,12 +1354,11 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService {
|
|||
} else {
|
||||
BigDecimal many = num.subtract(backNum);
|
||||
materialBackInfoMapper.updateStlInfoTwo(info, record, backNum);
|
||||
info.setSource("2");
|
||||
materialBackInfoMapper.insStlInfoTwo(info, many);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
|
|
@ -2316,10 +2308,11 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService {
|
|||
}
|
||||
|
||||
// 把后续流程设置为项目部的协议进行处理
|
||||
SelectDto dto = new SelectDto();
|
||||
dto.setProjectId(backApplyInfo.getProId().toString()).setUnitId(Math.toIntExact(backApplyInfo.getUnitId()));
|
||||
backApplyInfo.setAgreementId(leaseOutDetail.getProjectUnitAgreementId());
|
||||
backApplyInfo.setUnitId(leaseOutDetail.getProjectUnitAgreementId());
|
||||
SelectDto dto = new SelectDto();
|
||||
dto.setProId(backApplyInfo.getProId()).setUnitId(Math.toIntExact(backApplyInfo.getUnitId()));
|
||||
|
||||
List<AgreementVo> list = mapper.getAgreementInfoByIdBack(dto);
|
||||
|
||||
List<BackApplyInfo> codeList = new ArrayList<>();
|
||||
|
|
@ -2330,9 +2323,9 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService {
|
|||
for (BackApplyInfo applyInfo : applyInfoList) {
|
||||
// 根据maId查询设备是否处于在用状态(需要同时查询机具和材料站)
|
||||
if (applyInfo.getMaId() != null) {
|
||||
//List<SltAgreementInfo> infoList = backApplyInfoMapper.getUserList(applyInfo);
|
||||
List<SltAgreementInfo> infoList = backApplyInfoMapper.getUserList(applyInfo);
|
||||
List<SltAgreementInfo> clzList = backApplyInfoMapper.getClzUserList(applyInfo);
|
||||
if (CollectionUtils.isEmpty(clzList)) {
|
||||
if (CollectionUtils.isEmpty(infoList) && CollectionUtils.isEmpty(clzList)) {
|
||||
codeList.add(applyInfo);
|
||||
}
|
||||
}
|
||||
|
|
@ -2358,6 +2351,32 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService {
|
|||
if (CollectionUtils.isEmpty(applyDetails)) {
|
||||
return AjaxResult.error("退料物资为空,无法进行提交");
|
||||
}
|
||||
for (BackApplyDetails applyDetail : applyDetails) {
|
||||
// 根据项目部及材料站协议查询退料设备是否存在于其中,若不存在,则不用进行退料
|
||||
applyDetail.setAgreementId(leaseOutDetail.getProjectUnitAgreementId());
|
||||
List<SltAgreementInfo> xmList = backApplyInfoMapper.getXmList(applyDetail);
|
||||
if (!CollectionUtils.isEmpty(xmList)) {
|
||||
applyDetail.setIsXmbUse(true);
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
applyDetail.setAgreementId(Long.valueOf(list.get(0).getAgreementId()));
|
||||
List<SltAgreementInfo> clzInfoList = backApplyInfoMapper.getClzList(applyDetail);
|
||||
if (!CollectionUtils.isEmpty(clzInfoList)) {
|
||||
applyDetail.setIsClzUse(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
// 项目部使用
|
||||
boolean isXmbUse = false;
|
||||
// 材料站使用
|
||||
boolean isClzUse = false;
|
||||
// 示例:统计全局是否有至少一条数据满足xmList
|
||||
isXmbUse = applyDetails.stream()
|
||||
.anyMatch(BackApplyDetails::getIsXmbUse);
|
||||
|
||||
// 示例:统计全局是否有至少一条数据满足clzInfoList
|
||||
isClzUse = applyDetails.stream()
|
||||
.anyMatch(BackApplyDetails::getIsClzUse);
|
||||
// 设置更新信息,
|
||||
backApplyInfo.setUpdateBy(SecurityUtils.getLoginUser().getSysUser().getNickName());
|
||||
backApplyInfo.setUpdateTime(DateUtils.getNowDate());
|
||||
|
|
@ -2380,52 +2399,55 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService {
|
|||
result += insertTeamTta(newTaskId, leaseOutDetail.getProjectUnitAgreementId());
|
||||
|
||||
// -----------------给材料站新建退料任务,处理数据开始✅ ----------------
|
||||
MaterialBackApplyInfo materialBackApplyInfo = new MaterialBackApplyInfo();
|
||||
BackApplyInfo backApplyInfo4 = new BackApplyInfo();
|
||||
MaterialBackApplyInfo materialBackApplyInfo = new MaterialBackApplyInfo();
|
||||
BmAgreementInfo bmAgreementInfo = new BmAgreementInfo();
|
||||
bmAgreementInfo.setUnitId(teamUnitId);
|
||||
bmAgreementInfo.setProjectId(backApplyInfo.getProId());
|
||||
BmAgreementInfo info = bmAgreementInfoMapper.queryByTeamIdAndProjectIdCl(bmAgreementInfo);
|
||||
BackApplyInfo backApplyInfo4 = new BackApplyInfo();
|
||||
|
||||
int thisMonthMaxOrder = taskMapper.getMonthMaxOrderByDate(DateUtils.getCurrentYear(), DateUtils.getCurrentMonth(), TmTaskTypeEnum.TM_TASK_MATERIAL_BACK.getTaskTypeId());
|
||||
String code = genderClzTaskCode(thisMonthMaxOrder);
|
||||
TmTask tmTask = new TmTask(null, TmTaskTypeEnum.TM_TASK_MATERIAL_BACK.getTaskTypeId(),
|
||||
BackTaskStatusEnum.BACK_TASK_IN_FINISHED.getStatus(), null, thisMonthMaxOrder + 1, code);
|
||||
tmTask.setCreateTime(DateUtils.getNowDate());
|
||||
String createBy = SecurityUtils.getLoginUser().getSysUser().getNickName();
|
||||
tmTask.setCreateBy(createBy);
|
||||
materialBackApplyInfo.setCode(code);
|
||||
materialBackApplyInfo.setCreateBy(createBy);
|
||||
materialBackApplyInfo.setCreateTime(DateUtils.getNowDate());
|
||||
// 保存退料信息到 tm_task 表中
|
||||
result += taskMapper.insertTmTask(tmTask);
|
||||
if (result > 0) {
|
||||
TmTaskAgreement tmTaskAgreement = new TmTaskAgreement(tmTask.getTaskId(), info.getAgreementId());
|
||||
tmTaskAgreement.setCreateTime(DateUtils.getNowDate());
|
||||
tmTaskAgreement.setCreateBy(createBy);
|
||||
taskAgreementMapper.insertTmTaskAgreement(tmTaskAgreement);
|
||||
materialBackApplyInfo.setTaskId(tmTask.getTaskId());
|
||||
materialBackApplyInfo.setBackStyle("2");
|
||||
materialBackApplyInfo.setStatus("2");
|
||||
BackApplyInfo backApplyInfo1 = backApplyInfoMapper.selectBackApplyInfoById(backApplyInfo.getId());
|
||||
if (backApplyInfo1 != null) {
|
||||
materialBackApplyInfo.setBackPerson(StringUtils.isNotBlank(backApplyInfo1.getBackPerson()) ? backApplyInfo1.getBackPerson() : "");
|
||||
materialBackApplyInfo.setPhone(StringUtils.isNotBlank(backApplyInfo1.getPhone()) ? backApplyInfo1.getPhone() : "");
|
||||
}
|
||||
result += materialBackInfoMapper.insertBackApplyInfo(materialBackApplyInfo);
|
||||
if (CollectionUtils.isNotEmpty(applyDetails)) {
|
||||
for (BackApplyDetails applyInfo : applyDetails) {
|
||||
MaterialBackApplyDetails details = new MaterialBackApplyDetails();
|
||||
details.setCode(code);
|
||||
details.setParentId(materialBackApplyInfo.getId());
|
||||
details.setPreNum(applyInfo.getPreNum());
|
||||
details.setAuditNum(applyInfo.getPreNum());
|
||||
details.setStatus(String.valueOf(BackTaskStatusEnum.BACK_TASK_NO_FINISHED.getStatus()));
|
||||
details.setCreateBy(createBy);
|
||||
details.setCreateTime(DateUtils.getNowDate());
|
||||
details.setTypeId(applyInfo.getTypeId());
|
||||
// 保存退料详情
|
||||
result += materialBackInfoMapper.insertBackApplyDetails(details);
|
||||
if (isClzUse) {
|
||||
int thisMonthMaxOrder = taskMapper.getMonthMaxOrderByDate(DateUtils.getCurrentYear(), DateUtils.getCurrentMonth(), TmTaskTypeEnum.TM_TASK_MATERIAL_BACK.getTaskTypeId());
|
||||
String code = genderClzTaskCode(thisMonthMaxOrder);
|
||||
TmTask tmTask = new TmTask(null, TmTaskTypeEnum.TM_TASK_MATERIAL_BACK.getTaskTypeId(),
|
||||
BackTaskStatusEnum.BACK_TASK_IN_FINISHED.getStatus(), null, thisMonthMaxOrder + 1, code);
|
||||
tmTask.setCreateTime(DateUtils.getNowDate());
|
||||
String createBy = SecurityUtils.getLoginUser().getSysUser().getNickName();
|
||||
tmTask.setCreateBy(createBy);
|
||||
materialBackApplyInfo.setCode(code);
|
||||
materialBackApplyInfo.setCreateBy(createBy);
|
||||
materialBackApplyInfo.setCreateTime(DateUtils.getNowDate());
|
||||
// 保存退料信息到 tm_task 表中
|
||||
result += taskMapper.insertTmTask(tmTask);
|
||||
if (result > 0) {
|
||||
TmTaskAgreement tmTaskAgreement = new TmTaskAgreement(tmTask.getTaskId(), info.getAgreementId());
|
||||
tmTaskAgreement.setCreateTime(DateUtils.getNowDate());
|
||||
tmTaskAgreement.setCreateBy(createBy);
|
||||
taskAgreementMapper.insertTmTaskAgreement(tmTaskAgreement);
|
||||
materialBackApplyInfo.setTaskId(tmTask.getTaskId());
|
||||
materialBackApplyInfo.setBackStyle("2");
|
||||
materialBackApplyInfo.setStatus("2");
|
||||
BackApplyInfo backApplyInfo1 = backApplyInfoMapper.selectBackApplyInfoById(backApplyInfo.getId());
|
||||
if (backApplyInfo1 != null) {
|
||||
materialBackApplyInfo.setBackPerson(StringUtils.isNotBlank(backApplyInfo1.getBackPerson()) ? backApplyInfo1.getBackPerson() : "");
|
||||
materialBackApplyInfo.setPhone(StringUtils.isNotBlank(backApplyInfo1.getPhone()) ? backApplyInfo1.getPhone() : "");
|
||||
}
|
||||
result += materialBackInfoMapper.insertBackApplyInfo(materialBackApplyInfo);
|
||||
if (CollectionUtils.isNotEmpty(applyDetails)) {
|
||||
for (BackApplyDetails applyInfo : applyDetails) {
|
||||
MaterialBackApplyDetails details = new MaterialBackApplyDetails();
|
||||
details.setCode(code);
|
||||
details.setParentId(materialBackApplyInfo.getId());
|
||||
details.setPreNum(applyInfo.getPreNum());
|
||||
details.setAuditNum(applyInfo.getPreNum());
|
||||
details.setStatus(String.valueOf(BackTaskStatusEnum.BACK_TASK_NO_FINISHED.getStatus()));
|
||||
details.setCreateBy(createBy);
|
||||
details.setCreateTime(DateUtils.getNowDate());
|
||||
details.setTypeId(applyInfo.getTypeId());
|
||||
// 保存退料详情
|
||||
if (applyInfo.getIsClzUse()) {
|
||||
result += materialBackInfoMapper.insertBackApplyDetails(details);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2433,43 +2455,49 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService {
|
|||
|
||||
|
||||
// 材料站对分公司建立退料任务
|
||||
int backMonthMaxOrder = taskMapper.getMonthMaxOrderByDate(DateUtils.getCurrentYear(), DateUtils.getCurrentMonth(), TmTaskTypeEnum.TM_TASK_BACK.getTaskTypeId());
|
||||
String backCode = genderTaskCode(backMonthMaxOrder);
|
||||
TmTask newTask = new TmTask(null, TmTaskTypeEnum.TM_TASK_BACK.getTaskTypeId(),
|
||||
BackTaskStatusEnum.BACK_TASK_IN_FINISHED.getStatus(),
|
||||
null, backMonthMaxOrder + 1, backCode);
|
||||
newTask.setCreateTime(DateUtils.getNowDate());
|
||||
newTask.setCreateBy(SecurityUtils.getLoginUser().getSysUser().getNickName());
|
||||
backApplyInfo4.setCode(backCode);
|
||||
backApplyInfo4.setCreateBy(SecurityUtils.getLoginUser().getSysUser().getNickName());
|
||||
backApplyInfo4.setCreateTime(DateUtils.getNowDate());
|
||||
// 保存退料信息到 tm_task 表中
|
||||
result += taskMapper.insertTmTask(newTask);
|
||||
if (result > 0) {
|
||||
// 根据单位和工程id查询项目部关联协议id
|
||||
BackApplyInfo backApplyInfo3 = backApplyInfoMapper.selectInfo(backApplyInfo);
|
||||
if (backApplyInfo3 != null) {
|
||||
// 给项目部处理的时候要使用挂靠的项目部协议ID
|
||||
TmTaskAgreement tmTaskAgreement = new TmTaskAgreement(newTask.getTaskId(), leaseOutDetail.getAgreementId());
|
||||
tmTaskAgreement.setCreateTime(DateUtils.getNowDate());
|
||||
tmTaskAgreement.setCreateBy(SecurityUtils.getLoginUser().getSysUser().getNickName());
|
||||
taskAgreementMapper.insertTmTaskAgreement(tmTaskAgreement);
|
||||
if (isXmbUse) {
|
||||
int backMonthMaxOrder = taskMapper.getMonthMaxOrderByDate(DateUtils.getCurrentYear(), DateUtils.getCurrentMonth(), TmTaskTypeEnum.TM_TASK_BACK.getTaskTypeId());
|
||||
String backCode = genderTaskCode(backMonthMaxOrder);
|
||||
TmTask newTask = new TmTask(null, TmTaskTypeEnum.TM_TASK_BACK.getTaskTypeId(),
|
||||
BackTaskStatusEnum.BACK_TASK_IN_FINISHED.getStatus(),
|
||||
null, backMonthMaxOrder + 1, backCode);
|
||||
newTask.setCreateTime(DateUtils.getNowDate());
|
||||
newTask.setCreateBy(SecurityUtils.getLoginUser().getSysUser().getNickName());
|
||||
backApplyInfo4.setCode(backCode);
|
||||
backApplyInfo4.setCreateBy(SecurityUtils.getLoginUser().getSysUser().getNickName());
|
||||
backApplyInfo4.setCreateTime(DateUtils.getNowDate());
|
||||
// 保存退料信息到 tm_task 表中
|
||||
result += taskMapper.insertTmTask(newTask);
|
||||
if (result > 0) {
|
||||
// 根据单位和工程id查询项目部关联协议id
|
||||
BackApplyInfo backApplyInfo3 = backApplyInfoMapper.selectInfo(backApplyInfo);
|
||||
if (backApplyInfo3 != null) {
|
||||
// 给项目部处理的时候要使用挂靠的项目部协议ID
|
||||
TmTaskAgreement tmTaskAgreement = new TmTaskAgreement(newTask.getTaskId(), leaseOutDetail.getAgreementId());
|
||||
tmTaskAgreement.setCreateTime(DateUtils.getNowDate());
|
||||
tmTaskAgreement.setCreateBy(SecurityUtils.getLoginUser().getSysUser().getNickName());
|
||||
taskAgreementMapper.insertTmTaskAgreement(tmTaskAgreement);
|
||||
}
|
||||
backApplyInfo4.setTaskId(newTask.getTaskId());
|
||||
BackApplyInfo backApplyInfo2 = backApplyInfoMapper.selectBackApplyInfoById(backApplyInfo.getId());
|
||||
if (backApplyInfo2 != null) {
|
||||
backApplyInfo4.setBackPerson(StringUtils.isNotBlank(backApplyInfo2.getBackPerson()) ? backApplyInfo2.getBackPerson() : "");
|
||||
backApplyInfo4.setPhone(StringUtils.isNotBlank(backApplyInfo2.getPhone()) ? backApplyInfo2.getPhone() : "");
|
||||
backApplyInfo4.setBackStyle("2");
|
||||
}
|
||||
result += backApplyInfoMapper.insertBackApplyInfo(backApplyInfo4);
|
||||
}
|
||||
backApplyInfo4.setTaskId(newTask.getTaskId());
|
||||
BackApplyInfo backApplyInfo2 = backApplyInfoMapper.selectBackApplyInfoById(backApplyInfo.getId());
|
||||
if (backApplyInfo2 != null) {
|
||||
backApplyInfo4.setBackPerson(StringUtils.isNotBlank(backApplyInfo2.getBackPerson()) ? backApplyInfo2.getBackPerson() : "");
|
||||
backApplyInfo4.setPhone(StringUtils.isNotBlank(backApplyInfo2.getPhone()) ? backApplyInfo2.getPhone() : "");
|
||||
backApplyInfo4.setBackStyle("2");
|
||||
}
|
||||
result += backApplyInfoMapper.insertBackApplyInfo(backApplyInfo4);
|
||||
}
|
||||
// 保存退料详情
|
||||
if (CollectionUtils.isNotEmpty(applyDetails)) {
|
||||
for (BackApplyDetails applyDetail : applyDetails) {
|
||||
// 保存退料详情
|
||||
applyDetail.setAuditNum(applyDetail.getPreNum());
|
||||
result += backApplyInfoMapper.insertBackApplyDetails(applyDetail);
|
||||
// 保存退料详情
|
||||
if (CollectionUtils.isNotEmpty(applyDetails)) {
|
||||
for (BackApplyDetails applyDetail : applyDetails) {
|
||||
// 保存退料详情
|
||||
applyDetail.setAuditNum(applyDetail.getPreNum());
|
||||
applyDetail.setParentId(backApplyInfo4.getId());
|
||||
applyDetail.setCode(backCode);
|
||||
if (applyDetail.getIsXmbUse()) {
|
||||
result += backApplyInfoMapper.insertBackApplyDetails(applyDetail);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for (String typeId : typeIdList) {
|
||||
|
|
@ -2483,42 +2511,48 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService {
|
|||
List<BackApplyInfo> allList = backApplyInfoMapper.selectBackDetails(backApplyInfo);
|
||||
if (CollectionUtils.isNotEmpty(allList)) {
|
||||
// 更新结算协议✍️表
|
||||
int res = updateBzSlt4Bean(backApplyInfo, allList);
|
||||
int res = updateBzSlt4Bean(backApplyInfo,backApplyInfo4, allList);
|
||||
// 检查机具是否领料
|
||||
if (res == 0) { throw new RuntimeException("该机具未被领料使用");}
|
||||
|
||||
List<BackApplyInfo> clzList = new ArrayList<>();
|
||||
List<BackApplyInfo> xmList = new ArrayList<>();
|
||||
for (BackApplyInfo applyInfo : allList) {
|
||||
applyInfo.setAgreementId(info.getAgreementId());
|
||||
MaterialBackApplyDetails details = new MaterialBackApplyDetails();
|
||||
details.setParentId(materialBackApplyInfo.getId());
|
||||
details.setTypeId(Long.parseLong(typeId));
|
||||
details.setCreateBy(SecurityUtils.getLoginUser().getSysUser().getNickName());
|
||||
details.setCreateTime(DateUtils.getNowDate());
|
||||
details.setPreNum(applyInfo.getBackNum());
|
||||
details.setStatus("0");
|
||||
details.setMaId(applyInfo.getMaId() != null ? applyInfo.getMaId() : null);
|
||||
details.setIsFinished(1);
|
||||
result += materialBackInfoMapper.insertCheckDetails(details);
|
||||
|
||||
// 查询材料站同步数据
|
||||
clzList = backApplyInfoMapper.selectClzList(details);
|
||||
BackApplyDetails backApplyDetails = new BackApplyDetails();
|
||||
backApplyDetails.setParentId(backApplyInfo4.getId());
|
||||
backApplyDetails.setTypeId(Long.parseLong(typeId));
|
||||
backApplyDetails.setCreateBy(SecurityUtils.getLoginUser().getSysUser().getNickName());
|
||||
backApplyDetails.setCreateTime(DateUtils.getNowDate());
|
||||
backApplyDetails.setPreNum(applyInfo.getBackNum());
|
||||
backApplyDetails.setMaId(applyInfo.getMaId() != null ? applyInfo.getMaId() : null);
|
||||
backApplyDetails.setStatus("0");
|
||||
backApplyDetails.setIsFinished(1);
|
||||
result += backApplyInfoMapper.insertCheckDetails(backApplyDetails);
|
||||
// 查询项目部同步数据
|
||||
//xmList = backApplyInfoMapper.selectXmList(backApplyDetails);
|
||||
if (isXmbUse) {
|
||||
for (BackApplyInfo applyInfo : allList) {
|
||||
BackApplyDetails backApplyDetails = new BackApplyDetails();
|
||||
backApplyDetails.setParentId(backApplyInfo4.getId());
|
||||
backApplyDetails.setTypeId(Long.parseLong(typeId));
|
||||
backApplyDetails.setCreateBy(SecurityUtils.getLoginUser().getSysUser().getNickName());
|
||||
backApplyDetails.setCreateTime(DateUtils.getNowDate());
|
||||
backApplyDetails.setPreNum(applyInfo.getBackNum());
|
||||
backApplyDetails.setMaId(applyInfo.getMaId() != null ? applyInfo.getMaId() : null);
|
||||
backApplyDetails.setStatus("0");
|
||||
backApplyDetails.setIsFinished(1);
|
||||
result += backApplyInfoMapper.insertCheckDetails(backApplyDetails);
|
||||
}
|
||||
}
|
||||
if (isClzUse) {
|
||||
for (BackApplyInfo applyInfo : allList) {
|
||||
applyInfo.setAgreementId(info.getAgreementId());
|
||||
MaterialBackApplyDetails details = new MaterialBackApplyDetails();
|
||||
details.setParentId(materialBackApplyInfo.getId());
|
||||
details.setTypeId(Long.parseLong(typeId));
|
||||
details.setCreateBy(SecurityUtils.getLoginUser().getSysUser().getNickName());
|
||||
details.setCreateTime(DateUtils.getNowDate());
|
||||
details.setPreNum(applyInfo.getBackNum());
|
||||
details.setStatus("0");
|
||||
details.setMaId(applyInfo.getMaId() != null ? applyInfo.getMaId() : null);
|
||||
details.setIsFinished(1);
|
||||
result += materialBackInfoMapper.insertCheckDetails(details);
|
||||
// 查询材料站同步数据
|
||||
clzList = backApplyInfoMapper.selectClzList(details);
|
||||
// 查询项目部同步数据
|
||||
//xmList = backApplyInfoMapper.selectXmList(backApplyDetails);
|
||||
}
|
||||
res = updateSlt4BeanClz(materialBackApplyInfo, clzList, info.getAgreementId());
|
||||
if (res == 0) {
|
||||
throw new RuntimeException("同步材料站结算出错");
|
||||
}
|
||||
}
|
||||
res = updateSlt4BeanClz(materialBackApplyInfo, clzList);
|
||||
if (res == 0) { throw new RuntimeException("同步材料站结算出错");}
|
||||
/*res = updateSlt4BeanXm(backApplyInfo4, xmList);
|
||||
if (res == 0) {
|
||||
throw new RuntimeException("同步项目部结算出错");
|
||||
|
|
@ -2526,6 +2560,7 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService {
|
|||
}
|
||||
// 完成退料部分,更新 back_check_details
|
||||
finishBackCheckDetails(backApplyInfo);
|
||||
backApplyInfoMapper.updateCheckDetails(backApplyInfo4);
|
||||
}
|
||||
}
|
||||
// 如果所有操作都成功
|
||||
|
|
@ -2582,7 +2617,7 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService {
|
|||
* @param allList
|
||||
* @return
|
||||
*/
|
||||
private int updateBzSlt4Bean(BackApplyInfo record, List<BackApplyInfo> allList) {
|
||||
private int updateBzSlt4Bean(BackApplyInfo record, BackApplyInfo backApplyInfo4, List<BackApplyInfo> allList) {
|
||||
for (BackApplyInfo bean : allList) {
|
||||
List<SltAgreementInfo> infoList = backApplyInfoMapper.getStlInfo(bean);
|
||||
if (CollectionUtils.isEmpty(infoList)) {
|
||||
|
|
@ -2620,18 +2655,21 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService {
|
|||
// 非班组退料才同步班组分公司数据
|
||||
BigDecimal tbBackNum = bean.getBackNum();
|
||||
if (CollectionUtils.isNotEmpty(tbList)) {
|
||||
BackApplyInfo backApplyInfo = new BackApplyInfo();
|
||||
backApplyInfo.setId(backApplyInfo4.getId());
|
||||
for (SltAgreementInfo info : tbList) {
|
||||
// 获取前端要退数量
|
||||
BigDecimal num = info.getBackNum();
|
||||
if (tbBackNum.compareTo(num) == 0) {
|
||||
backApplyInfoMapper.updateStlInfo(info, record);
|
||||
backApplyInfoMapper.updateStlInfo(info, backApplyInfo);
|
||||
break;
|
||||
} else if (tbBackNum.compareTo(num) > 0) {
|
||||
tbBackNum = tbBackNum.subtract(num);
|
||||
backApplyInfoMapper.updateStlInfo(info, record);
|
||||
backApplyInfoMapper.updateStlInfo(info, backApplyInfo);
|
||||
} else {
|
||||
BigDecimal many = num.subtract(tbBackNum);
|
||||
backApplyInfoMapper.updateStlInfoTwo(info, record, tbBackNum);
|
||||
backApplyInfoMapper.updateStlInfoTwo(info, backApplyInfo, tbBackNum);
|
||||
info.setSource("2");
|
||||
backApplyInfoMapper.insStlInfoTwo(info, many);
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,16 +9,34 @@ import com.bonus.common.core.web.controller.BaseController;
|
|||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.material.basic.domain.report.*;
|
||||
import com.bonus.material.basic.service.BmReportService;
|
||||
import com.bonus.material.common.utils.DocxUtil;
|
||||
import com.bonus.material.common.utils.HttpFileUtil;
|
||||
import com.bonus.material.part.domain.PartTypeCheckInfo;
|
||||
import com.bonus.material.part.domain.PartTypeQueryDto;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.apache.commons.compress.archivers.zip.ZipArchiveEntry;
|
||||
import org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream;
|
||||
import org.apache.poi.util.IOUtils;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
import java.net.URLEncoder;
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.LinkedHashMap;
|
||||
|
||||
import static com.bonus.common.core.web.page.TableSupport.PAGE_NUM;
|
||||
import static com.bonus.common.core.web.page.TableSupport.PAGE_SIZE;
|
||||
|
||||
/**
|
||||
* @Author ma_sh
|
||||
|
|
@ -568,4 +586,153 @@ public class BmReportController extends BaseController {
|
|||
ExcelUtil<ScrapDetailsInfo> util = new ExcelUtil<>(ScrapDetailsInfo.class);
|
||||
util.exportExcel(response, list, "设备追溯查询-报废报表详情查询");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 报告查询
|
||||
*/
|
||||
@ApiOperation("报告查询")
|
||||
@GetMapping("/reportList")
|
||||
public AjaxResult reportList(ReportQuery bean) {
|
||||
final List<ReportQuery> list = bmReportService.getReportList(bean);
|
||||
final Integer pageIndex = Convert.toInt(ServletUtils.getParameter(PAGE_NUM), 1);
|
||||
final Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10);
|
||||
return AjaxResult.success(ListPagingUtil.paging(pageIndex, pageSize, list));
|
||||
}
|
||||
|
||||
@PostMapping("/downloadSingle")
|
||||
public void downloadSingle(@RequestBody DownloadRequest request, HttpServletResponse response) throws IOException {
|
||||
handleDownload(request, response);
|
||||
}
|
||||
|
||||
@PostMapping("/downloadBulk")
|
||||
public void downloadBulk(@RequestBody DownloadRequest request, HttpServletResponse response) throws IOException {
|
||||
String zipName = request.getZipName() != null ? request.getZipName() : "报告下载_" + LocalDate.now();
|
||||
String encoded = URLEncoder.encode(zipName + ".zip", "UTF-8");
|
||||
response.setHeader(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename*=UTF-8''" + encoded);
|
||||
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
|
||||
|
||||
try (ZipArchiveOutputStream zipOut = new ZipArchiveOutputStream(response.getOutputStream())) {
|
||||
|
||||
// 按工程 + 领用日期分组
|
||||
Map<String, Map<String, List<DownloadRequest.ItemInfo>>> grouped = request.getItems().stream()
|
||||
.collect(Collectors.groupingBy(
|
||||
item -> sanitize(item.getProName()), // 工程
|
||||
LinkedHashMap::new,
|
||||
Collectors.groupingBy(item -> sanitize(item.getTestTime()), LinkedHashMap::new, Collectors.toList()) // 日期
|
||||
));
|
||||
|
||||
for (Map.Entry<String, Map<String, List<DownloadRequest.ItemInfo>>> projectEntry : grouped.entrySet()) {
|
||||
String projectFolder = projectEntry.getKey();
|
||||
Map<String, List<DownloadRequest.ItemInfo>> dateMap = projectEntry.getValue();
|
||||
|
||||
for (Map.Entry<String, List<DownloadRequest.ItemInfo>> dateEntry : dateMap.entrySet()) {
|
||||
String dateFolder = dateEntry.getKey();
|
||||
List<DownloadRequest.ItemInfo> items = dateEntry.getValue();
|
||||
String baseDatePath = projectFolder + "/" + dateFolder + "/";
|
||||
|
||||
// 1. 生成合并的出库检验报告
|
||||
byte[] mergedReport = DocxUtil.generateReportByList(items);
|
||||
addToZip(zipOut, baseDatePath + "出库检验报告.docx", mergedReport);
|
||||
|
||||
// 2. 遍历每个类型-规格,创建文件夹并添加附加文件
|
||||
Map<String, List<DownloadRequest.ItemInfo>> typeMap = items.stream()
|
||||
.collect(Collectors.groupingBy(item -> sanitize(item.getTypeName() + "-" + item.getTypeModelName())));
|
||||
|
||||
for (Map.Entry<String, List<DownloadRequest.ItemInfo>> typeEntry : typeMap.entrySet()) {
|
||||
String typeFolder = typeEntry.getKey();
|
||||
String typePath = baseDatePath + typeFolder + "/";
|
||||
|
||||
// **先创建空文件夹**
|
||||
ZipArchiveEntry folderEntry = new ZipArchiveEntry(typePath);
|
||||
zipOut.putArchiveEntry(folderEntry);
|
||||
zipOut.closeArchiveEntry();
|
||||
|
||||
// 再添加附加文件(如果存在)
|
||||
for (DownloadRequest.ItemInfo item : typeEntry.getValue()) {
|
||||
addFileIfExists(zipOut, typePath, "合格证", item.getQualifiedUrl());
|
||||
addFileIfExists(zipOut, typePath, "型式试验报告", item.getTestReportUrl());
|
||||
addFileIfExists(zipOut, typePath, "第三方检测报告", item.getThirdReportUrl());
|
||||
addFileIfExists(zipOut, typePath, "出厂检测报告", item.getFactoryReportUrl());
|
||||
addFileIfExists(zipOut, typePath, "其他文件", item.getOtherReportUrl());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
zipOut.finish();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/** 将多条 ItemInfo 转成生成报告需要的列表 */
|
||||
private static List<DownloadRequest.ItemInfo> flattenItemMap(Map<String, List<DownloadRequest.ItemInfo>> typeMap) {
|
||||
List<DownloadRequest.ItemInfo> list = new ArrayList<>();
|
||||
typeMap.values().forEach(list::addAll);
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void handleDownload(DownloadRequest request, HttpServletResponse response) throws IOException {
|
||||
String zipName = request.getZipName() != null ? request.getZipName() : "报告下载";
|
||||
String encoded = URLEncoder.encode(zipName + ".zip", "UTF-8");
|
||||
response.setHeader(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename*=UTF-8''" + encoded);
|
||||
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
|
||||
|
||||
try (ZipArchiveOutputStream zipOut = new ZipArchiveOutputStream(response.getOutputStream())) {
|
||||
for (DownloadRequest.ItemInfo item : request.getItems()) {
|
||||
String projectFolder = sanitize(item.getProName());
|
||||
String matFolder = sanitize(item.getTypeName() + "-" + item.getTypeModelName());
|
||||
String basePath = projectFolder + "/" + matFolder + "/";
|
||||
|
||||
// 1. 生成出库检验报告.docx
|
||||
byte[] docBytes = DocxUtil.generateReport(item);
|
||||
addToZip(zipOut, basePath + "出库检验报告.docx", docBytes);
|
||||
|
||||
// 2. 附加各类报告文件
|
||||
addFileIfExists(zipOut, basePath, "合格证", item.getQualifiedUrl());
|
||||
addFileIfExists(zipOut, basePath, "型式试验报告", item.getTestReportUrl());
|
||||
addFileIfExists(zipOut, basePath, "第三方检测报告", item.getThirdReportUrl());
|
||||
addFileIfExists(zipOut, basePath, "出厂检测报告", item.getFactoryReportUrl());
|
||||
addFileIfExists(zipOut, basePath, "其他文件", item.getOtherReportUrl());
|
||||
}
|
||||
zipOut.finish();
|
||||
}
|
||||
}
|
||||
|
||||
private void addFileIfExists(ZipArchiveOutputStream zipOut, String base, String name, String url) {
|
||||
if (url == null || url.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
byte[] bytes = HttpFileUtil.downloadFile(url);
|
||||
if (bytes != null) {
|
||||
addToZip(zipOut, base + name + getFileExtension(url), bytes);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.err.println("跳过文件:" + url + " -> " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private void addToZip(ZipArchiveOutputStream zipOut, String path, byte[] bytes) throws IOException {
|
||||
ZipArchiveEntry entry = new ZipArchiveEntry(path);
|
||||
zipOut.putArchiveEntry(entry);
|
||||
try (ByteArrayInputStream in = new ByteArrayInputStream(bytes)) {
|
||||
IOUtils.copy(in, zipOut);
|
||||
}
|
||||
zipOut.closeArchiveEntry();
|
||||
}
|
||||
|
||||
private String sanitize(String name) {
|
||||
if (name == null) {
|
||||
return "未知";
|
||||
}
|
||||
return name.replaceAll("[\\\\/:*?\"<>|]", "_");
|
||||
}
|
||||
|
||||
private String getFileExtension(String url) {
|
||||
int idx = url.lastIndexOf('.');
|
||||
return (idx > 0 && idx < url.length() - 1) ? url.substring(idx) : "";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,66 @@
|
|||
package com.bonus.material.basic.domain.report;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class DownloadRequest {
|
||||
private String zipName;
|
||||
private List<ItemInfo> items;
|
||||
|
||||
@Data
|
||||
public static class ItemInfo {
|
||||
private String taskId;
|
||||
private String id;
|
||||
private String proName;
|
||||
private String typeName;
|
||||
private String typeModelName;
|
||||
private String qualifiedUrl;
|
||||
private String testReportUrl;
|
||||
private String thirdReportUrl;
|
||||
private String factoryReportUrl;
|
||||
private String otherReportUrl;
|
||||
/**
|
||||
* 分公司
|
||||
*/
|
||||
private String impUnitName;
|
||||
|
||||
/**
|
||||
* 项目部
|
||||
*/
|
||||
private String departName;
|
||||
@ApiModelProperty(value = "计量单位")
|
||||
private String unit;
|
||||
|
||||
@ApiModelProperty(value = "数量")
|
||||
private BigDecimal num;
|
||||
|
||||
@ApiModelProperty(value = "编码")
|
||||
private String maCode;
|
||||
|
||||
@ApiModelProperty("额定载荷")
|
||||
private String ratedLoad;
|
||||
|
||||
@ApiModelProperty("试验载荷")
|
||||
private String testLoad;
|
||||
|
||||
@ApiModelProperty("持荷时间")
|
||||
private String holdingTime;
|
||||
|
||||
@ApiModelProperty("试验日期")
|
||||
private String testTime;
|
||||
|
||||
@ApiModelProperty("下次试验日期")
|
||||
private String nextTestTime;
|
||||
|
||||
@ApiModelProperty("验收结论")
|
||||
private String checkResult;
|
||||
|
||||
@ApiModelProperty("备注")
|
||||
private String remark;
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,144 @@
|
|||
package com.bonus.material.basic.domain.report;
|
||||
|
||||
import com.bonus.common.core.annotation.Excel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class ReportQuery {
|
||||
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 分公司
|
||||
*/
|
||||
private String impUnitName;
|
||||
|
||||
/**
|
||||
* 项目部
|
||||
*/
|
||||
private String departName;
|
||||
|
||||
/**
|
||||
* 工程
|
||||
*/
|
||||
private String proName;
|
||||
|
||||
@ApiModelProperty(value = "物资名称")
|
||||
private String typeName;
|
||||
|
||||
@ApiModelProperty(value = "规格型号")
|
||||
private String typeModelName;
|
||||
|
||||
@ApiModelProperty(value = "计量单位")
|
||||
private String unit;
|
||||
|
||||
@ApiModelProperty(value = "数量")
|
||||
private BigDecimal num;
|
||||
|
||||
@ApiModelProperty(value = "编码")
|
||||
private String maCode;
|
||||
|
||||
@ApiModelProperty(value="二维码")
|
||||
private String qrCode;
|
||||
|
||||
/**
|
||||
* 领用日期
|
||||
*/
|
||||
private String leaseTime;
|
||||
|
||||
/**
|
||||
* 合格证文件名称
|
||||
*/
|
||||
private String qualifiedName;
|
||||
/**
|
||||
* 合格证文件路径
|
||||
*/
|
||||
private String qualifiedUrl;
|
||||
/**
|
||||
* 型式试验报告文件名称
|
||||
*/
|
||||
private String testReportName;
|
||||
/**
|
||||
* 型式试验报告文件路径
|
||||
*/
|
||||
private String testReportUrl;
|
||||
/**
|
||||
* 出厂检测报告名称
|
||||
*/
|
||||
private String factoryReportName;
|
||||
/**
|
||||
* 出厂检测报告路径
|
||||
*/
|
||||
private String factoryReportUrl;
|
||||
/**
|
||||
* 第三方检测报告名称
|
||||
*/
|
||||
private String thirdReportName;
|
||||
/**
|
||||
* 第三方检测报告路径
|
||||
*/
|
||||
private String thirdReportUrl;
|
||||
/**
|
||||
* 其他报告名称
|
||||
*/
|
||||
private String otherReportName;
|
||||
/**
|
||||
* 其他报告路径
|
||||
*/
|
||||
private String otherReportUrl;
|
||||
|
||||
@ApiModelProperty(value="开始时间")
|
||||
private String startTime;
|
||||
|
||||
@ApiModelProperty(value="结束时间")
|
||||
private String endTime;
|
||||
|
||||
private String keyword;
|
||||
|
||||
@ApiModelProperty(value = "设备ID")
|
||||
private Long maId;
|
||||
|
||||
/** 类型ID */
|
||||
@ApiModelProperty(value = "类型ID")
|
||||
private Long typeId;
|
||||
|
||||
@ApiModelProperty(value = "任务ID")
|
||||
private Long taskId;
|
||||
|
||||
/**
|
||||
* i8工程id集合
|
||||
*/
|
||||
private List<String> projectIdList;
|
||||
|
||||
@ApiModelProperty(value = "实施单位id")
|
||||
private String impUnit;
|
||||
|
||||
@ApiModelProperty("机具类型(1机具,2安全工器具)")
|
||||
private String jiJuType;
|
||||
|
||||
@ApiModelProperty("额定载荷")
|
||||
private String ratedLoad;
|
||||
|
||||
@ApiModelProperty("试验载荷")
|
||||
private String testLoad;
|
||||
|
||||
@ApiModelProperty("持荷时间")
|
||||
private String holdingTime;
|
||||
|
||||
@ApiModelProperty("试验日期")
|
||||
private String testTime;
|
||||
|
||||
@ApiModelProperty("下次试验日期")
|
||||
private String nextTestTime;
|
||||
|
||||
@ApiModelProperty("验收结论")
|
||||
private String checkResult;
|
||||
|
||||
@ApiModelProperty("备注")
|
||||
private String remark;
|
||||
|
||||
}
|
||||
|
|
@ -124,4 +124,11 @@ public interface BmReportMapper {
|
|||
* @return
|
||||
*/
|
||||
String selectUserNameById(String repairPersonName);
|
||||
|
||||
/**
|
||||
* 报表查询
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
List<ReportQuery> getReportList(ReportQuery bean);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -116,4 +116,11 @@ public interface BmReportService {
|
|||
* @return
|
||||
*/
|
||||
List<ScrapDetailsInfo> getScrapDetailsList(ScrapInfo bean);
|
||||
|
||||
/**
|
||||
* 报表查询
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
List<ReportQuery> getReportList(ReportQuery bean);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ import org.springframework.stereotype.Service;
|
|||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
|
@ -389,6 +390,16 @@ public class BmReportServiceImpl implements BmReportService {
|
|||
return bmReportMapper.getScrapDetailsList(bean);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ReportQuery> getReportList(ReportQuery bean) {
|
||||
try {
|
||||
return bmReportMapper.getReportList(bean);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return new ArrayList<>();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断字符串是否为纯数字(可用于判断是否为用户ID)
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -282,4 +282,12 @@ public class MaterialRetainedEquipmentInfo {
|
|||
|
||||
@ApiModelProperty(value = "租赁费用(万元)")
|
||||
private BigDecimal rentPrice;
|
||||
|
||||
@ApiModelProperty(value = "项目部集合")
|
||||
private List<String> departIdList;
|
||||
|
||||
/**
|
||||
* 是否过滤(true 过滤,默认过滤)
|
||||
*/
|
||||
private Boolean enableFilter = true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -268,4 +268,11 @@ public interface MaterialBackInfoMapper {
|
|||
* @return
|
||||
*/
|
||||
List<LeaseOutSign> getLeaseOutSignList(MaterialBackApplyInfo backApplyInfo);
|
||||
|
||||
/**
|
||||
* 获取材料站同步数据
|
||||
* @param materialBackApplyInfo
|
||||
* @return
|
||||
*/
|
||||
List<SltAgreementInfo> getClzInfo(MaterialBackApplyInfo materialBackApplyInfo);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -334,4 +334,11 @@ public interface MaterialMachineMapper {
|
|||
* @return
|
||||
*/
|
||||
List<MaterialRetainedEquipmentInfo> getLeaseInfo(MaterialRetainedEquipmentInfo bean);
|
||||
|
||||
/**
|
||||
* 获取分包商的数据
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
List<MaterialProvideNumInfo> getSubNumList(MaterialRetainedEquipmentInfo bean);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1096,22 +1096,24 @@ public class MaterialMachineServiceImpl implements MaterialMachineService {
|
|||
*/
|
||||
@Override
|
||||
public List<MaterialRetainedEquipmentInfo> getImpUnitNameList(MaterialRetainedEquipmentInfo bean) {
|
||||
String username = SecurityUtils.getLoginUser().getUsername();
|
||||
Set<String> userRoles = SecurityUtils.getLoginUser().getRoles();
|
||||
// 检查用户是否具有特殊角色
|
||||
boolean hasSpecialRole = hasSpecialRole(userRoles);
|
||||
if (!hasSpecialRole) {
|
||||
// 根据用户名查询项目部信息
|
||||
List<String> departId = mapper.getDepartId(username);
|
||||
// 根据项目部id查询工程信息
|
||||
if (!CollectionUtils.isEmpty(departId)) {
|
||||
List<String> projectIdList = mapper.getProjectId(departId);
|
||||
if (!CollectionUtils.isEmpty(projectIdList)) {
|
||||
bean.setProjectIdList(projectIdList);
|
||||
if (bean != null && bean.getEnableFilter()) {
|
||||
String username = SecurityUtils.getLoginUser().getUsername();
|
||||
Set<String> userRoles = SecurityUtils.getLoginUser().getRoles();
|
||||
// 检查用户是否具有特殊角色
|
||||
boolean hasSpecialRole = hasSpecialRole(userRoles);
|
||||
if (!hasSpecialRole) {
|
||||
// 根据用户名查询项目部信息
|
||||
List<String> departId = mapper.getDepartId(username);
|
||||
// 根据项目部id查询工程信息
|
||||
if (!CollectionUtils.isEmpty(departId)) {
|
||||
List<String> projectIdList = mapper.getProjectId(departId);
|
||||
if (!CollectionUtils.isEmpty(projectIdList)) {
|
||||
bean.setProjectIdList(projectIdList);
|
||||
}
|
||||
}
|
||||
// 部门查询赋值
|
||||
extractedDept(bean);
|
||||
}
|
||||
// 部门查询赋值
|
||||
extractedDept(bean);
|
||||
}
|
||||
return materialMachineMapper.getImpUnitNameList(bean);
|
||||
}
|
||||
|
|
@ -1123,22 +1125,25 @@ public class MaterialMachineServiceImpl implements MaterialMachineService {
|
|||
*/
|
||||
@Override
|
||||
public List<MaterialRetainedEquipmentInfo> getDepartNameList(MaterialRetainedEquipmentInfo bean) {
|
||||
String username = SecurityUtils.getLoginUser().getUsername();
|
||||
Set<String> userRoles = SecurityUtils.getLoginUser().getRoles();
|
||||
// 检查用户是否具有特殊角色
|
||||
boolean hasSpecialRole = hasSpecialRole(userRoles);
|
||||
if (!hasSpecialRole) {
|
||||
// 根据用户名查询项目部信息
|
||||
List<String> departId = mapper.getDepartId(username);
|
||||
// 根据项目部id查询工程信息
|
||||
if (!CollectionUtils.isEmpty(departId)) {
|
||||
List<String> projectIdList = mapper.getProjectId(departId);
|
||||
if (!CollectionUtils.isEmpty(projectIdList)) {
|
||||
bean.setProjectIdList(projectIdList);
|
||||
if (bean != null && bean.getEnableFilter()) {
|
||||
String username = SecurityUtils.getLoginUser().getUsername();
|
||||
Set<String> userRoles = SecurityUtils.getLoginUser().getRoles();
|
||||
// 检查用户是否具有特殊角色
|
||||
boolean hasSpecialRole = hasSpecialRole(userRoles);
|
||||
if (!hasSpecialRole) {
|
||||
// 根据用户名查询项目部信息
|
||||
List<String> departId = mapper.getDepartId(username);
|
||||
// 根据项目部id查询工程信息
|
||||
if (!CollectionUtils.isEmpty(departId)) {
|
||||
bean.setDepartIdList(departId);
|
||||
List<String> projectIdList = mapper.getProjectId(departId);
|
||||
if (!CollectionUtils.isEmpty(projectIdList)) {
|
||||
bean.setProjectIdList(projectIdList);
|
||||
}
|
||||
}
|
||||
// 部门查询赋值
|
||||
extractedDept(bean);
|
||||
}
|
||||
// 部门查询赋值
|
||||
extractedDept(bean);
|
||||
}
|
||||
return materialMachineMapper.getDepartNameList(bean);
|
||||
}
|
||||
|
|
@ -1154,18 +1159,20 @@ public class MaterialMachineServiceImpl implements MaterialMachineService {
|
|||
Set<String> userRoles = SecurityUtils.getLoginUser().getRoles();
|
||||
// 检查用户是否具有特殊角色
|
||||
boolean hasSpecialRole = hasSpecialRole(userRoles);
|
||||
if (!hasSpecialRole) {
|
||||
// 根据用户名查询项目部信息
|
||||
List<String> departId = mapper.getDepartId(username);
|
||||
// 根据项目部id查询工程信息
|
||||
if (!CollectionUtils.isEmpty(departId)) {
|
||||
List<String> projectIdList = mapper.getProjectId(departId);
|
||||
if (!CollectionUtils.isEmpty(projectIdList)) {
|
||||
bean.setProjectIdList(projectIdList);
|
||||
if (bean != null && bean.getEnableFilter()) {
|
||||
if (!hasSpecialRole) {
|
||||
// 根据用户名查询项目部信息
|
||||
List<String> departId = mapper.getDepartId(username);
|
||||
// 根据项目部id查询工程信息
|
||||
if (!CollectionUtils.isEmpty(departId)) {
|
||||
List<String> projectIdList = mapper.getProjectId(departId);
|
||||
if (!CollectionUtils.isEmpty(projectIdList)) {
|
||||
bean.setProjectIdList(projectIdList);
|
||||
}
|
||||
}
|
||||
// 部门查询赋值
|
||||
extractedDept(bean);
|
||||
}
|
||||
// 部门查询赋值
|
||||
extractedDept(bean);
|
||||
}
|
||||
List<MaterialRetainedEquipmentInfo> list = materialMachineMapper.getProjectList(bean);
|
||||
if (list.size()>0){
|
||||
|
|
@ -1184,13 +1191,15 @@ public class MaterialMachineServiceImpl implements MaterialMachineService {
|
|||
iterator.remove();
|
||||
continue;
|
||||
}
|
||||
// 根据工程去机具协议表查询关联协议数据
|
||||
List<MaterialRetainedEquipmentInfo> agreementIdList = mapper.getAgreementId(info.getProId());
|
||||
// 根据工程去材料站协议表查询关联协议数据
|
||||
List<MaterialRetainedEquipmentInfo> storageAgreementIdList = mapper.getStorageAgreementId(info.getProId());
|
||||
// 如果获取的协议数据为空,则移除该行数据
|
||||
if (CollectionUtils.isEmpty(agreementIdList) && CollectionUtils.isEmpty(storageAgreementIdList)) {
|
||||
iterator.remove();
|
||||
if (bean != null && bean.getEnableFilter()) {
|
||||
// 根据工程去机具协议表查询关联协议数据
|
||||
List<MaterialRetainedEquipmentInfo> agreementIdList = mapper.getAgreementId(info.getProId());
|
||||
// 根据工程去材料站协议表查询关联协议数据
|
||||
List<MaterialRetainedEquipmentInfo> storageAgreementIdList = mapper.getStorageAgreementId(info.getProId());
|
||||
// 如果获取的协议数据为空,则移除该行数据
|
||||
if (CollectionUtils.isEmpty(agreementIdList) && CollectionUtils.isEmpty(storageAgreementIdList)) {
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1453,10 +1462,41 @@ public class MaterialMachineServiceImpl implements MaterialMachineService {
|
|||
extractedDept(bean);
|
||||
}
|
||||
List<MaterialProvideNumInfo> recordList = materialMachineMapper.getDemandAndSupply(bean);
|
||||
if (CollectionUtils.isEmpty(recordList)) {
|
||||
// 获取施工队及分包数据
|
||||
List<MaterialProvideNumInfo> subList = materialMachineMapper.getSubNumList(bean);
|
||||
|
||||
// 若列表为空,直接返回(无需处理)
|
||||
if (CollectionUtils.isEmpty(recordList) && CollectionUtils.isEmpty(subList)) {
|
||||
return recordList;
|
||||
}
|
||||
|
||||
// 构建 recordList 的索引Map:key为(typeId, proId)的组合键,value为对应的record对象
|
||||
Map<String, MaterialProvideNumInfo> recordMap = new HashMap<>(recordList.size());
|
||||
for (MaterialProvideNumInfo record : recordList) {
|
||||
// 用下划线拼接typeId和proId作为唯一key(避免自定义对象作为key的复杂度)
|
||||
String key = record.getTypeId() + "_" + record.getProId();
|
||||
recordMap.put(key, record);
|
||||
}
|
||||
|
||||
// 遍历subList,通过Map快速匹配并合并数据
|
||||
for (MaterialProvideNumInfo subInfo : subList) {
|
||||
String key = subInfo.getTypeId() + "_" + subInfo.getProId();
|
||||
MaterialProvideNumInfo matchedRecord = recordMap.get(key);
|
||||
|
||||
// 匹配到对应记录时才进行合并(使用Objects.equals避免空指针)
|
||||
if (matchedRecord != null
|
||||
&& Objects.equals(subInfo.getTypeId(), matchedRecord.getTypeId())
|
||||
&& Objects.equals(subInfo.getProId(), matchedRecord.getProId())) {
|
||||
|
||||
// 合并数值字段(假设为BigDecimal,确保非null,若可能为null需先判断)
|
||||
matchedRecord.setUseNum(subInfo.getUseNum().add(matchedRecord.getUseNum()));
|
||||
matchedRecord.setStoreNum(matchedRecord.getStoreNum().subtract(subInfo.getUseNum()).compareTo(BigDecimal.ZERO) < 0
|
||||
? BigDecimal.ZERO : matchedRecord.getStoreNum().subtract(subInfo.getUseNum()));
|
||||
// 合并协议ID(使用StringBuilder优化拼接)
|
||||
matchedRecord.setAgreementIds(matchedRecord.getAgreementIds() + "," + subInfo.getAgreementIds());
|
||||
}
|
||||
}
|
||||
|
||||
// 1. 过滤数据(并行流加速大集合过滤)
|
||||
if (teamData != null) {
|
||||
recordList = recordList.parallelStream()
|
||||
|
|
|
|||
|
|
@ -420,4 +420,12 @@ public interface SelectMapper {
|
|||
* @return
|
||||
*/
|
||||
ProAuthorizeInfo selectProAuthorizeInfo(ProAuthorizeInfo bean);
|
||||
|
||||
/**
|
||||
* 根据单位和工程id查询该班组是否建立项目部挂靠协议
|
||||
* @param id
|
||||
* @param projectId
|
||||
* @return
|
||||
*/
|
||||
Long selectProjectUnitAgreementIdByTeamAndProject(@Param("teamId") String id, @Param("projectId") Long projectId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -415,16 +415,31 @@ public class SelectServiceImpl implements SelectService {
|
|||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
// 创建树形结构(数据集合作为参数)
|
||||
ProjectTreeBuild treeBuild = new ProjectTreeBuild(list);
|
||||
// 原查询结果转换树形结构
|
||||
if (bmUnit.getDeptId() != null) {
|
||||
groupList = treeBuild.buildTree();
|
||||
} else if (bmUnit.getProjectId() != null && bmUnit.getLeaseId() != null) {
|
||||
} else if (bmUnit.getProjectId() != null) {
|
||||
groupList = treeBuild.buildTree();
|
||||
// 获取已授权班组,进行数据拼接
|
||||
List<ProjectTreeNode> newList = mapper.getTeamLeaseList(bmUnit);
|
||||
if (CollectionUtils.isNotEmpty(newList)) {
|
||||
groupList.addAll(newList);
|
||||
}
|
||||
}
|
||||
}
|
||||
// 原查询结果转换树形结构
|
||||
if (bmUnit.getProjectId() != null && bmUnit.getLeaseId() != null) {
|
||||
// 获取已授权班组,筛选出已建立项目部挂靠协议的班组
|
||||
List<ProjectTreeNode> newList = mapper.getTeamLeaseList(bmUnit);
|
||||
if (CollectionUtils.isNotEmpty(newList)) {
|
||||
// 1. 筛选:仅保留“能查到挂靠协议ID”的班组(过滤无协议的)
|
||||
List<ProjectTreeNode> filteredList = newList.stream()
|
||||
.filter(team -> {
|
||||
// 避免team或team.getId()为空导致的空指针
|
||||
if (team == null || team.getId() == null) {
|
||||
return false;
|
||||
}
|
||||
// 查询该班组是否有挂靠协议
|
||||
Long agreementId = mapper.selectProjectUnitAgreementIdByTeamAndProject(team.getId(), bmUnit.getProjectId());
|
||||
return agreementId != null;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
// 2. 将筛选后的有效班组加入groupList
|
||||
groupList.addAll(filteredList);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,256 @@
|
|||
package com.bonus.material.common.utils;
|
||||
|
||||
import com.bonus.material.basic.domain.report.DownloadRequest;
|
||||
import org.apache.poi.xwpf.usermodel.*;
|
||||
import org.apache.poi.util.Units;
|
||||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.*;
|
||||
|
||||
import java.io.*;
|
||||
import java.math.BigInteger;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 出库检验报告生成工具类(横向 A4)
|
||||
* 格式与模板一致,页面为横向,且带印章
|
||||
*/
|
||||
public class DocxUtil {
|
||||
|
||||
public static byte[] generateReport(DownloadRequest.ItemInfo item) {
|
||||
try (XWPFDocument doc = new XWPFDocument(); ByteArrayOutputStream bos = new ByteArrayOutputStream()) {
|
||||
|
||||
// ===== 页面方向设为横向 =====
|
||||
CTSectPr sectPr = doc.getDocument().getBody().addNewSectPr();
|
||||
CTPageSz pageSize = sectPr.addNewPgSz();
|
||||
pageSize.setOrient(STPageOrientation.LANDSCAPE);
|
||||
pageSize.setW(BigInteger.valueOf(16840)); // A4横向宽
|
||||
pageSize.setH(BigInteger.valueOf(11900)); // A4横向高
|
||||
|
||||
// ===== 标题 =====
|
||||
XWPFParagraph title = doc.createParagraph();
|
||||
title.setAlignment(ParagraphAlignment.CENTER);
|
||||
XWPFRun runTitle = title.createRun();
|
||||
runTitle.setText("施工机具设备出库检验记录表");
|
||||
runTitle.setBold(true);
|
||||
runTitle.setFontFamily("宋体");
|
||||
runTitle.setFontSize(16);
|
||||
|
||||
// ===== 工程、单位信息 =====
|
||||
XWPFParagraph info = doc.createParagraph();
|
||||
info.setAlignment(ParagraphAlignment.LEFT);
|
||||
XWPFRun runInfo = info.createRun();
|
||||
runInfo.setFontFamily("宋体");
|
||||
runInfo.setFontSize(12);
|
||||
runInfo.setText("领用工程:" + safe(item.getProName()) + " 使用单位:" + safe(item.getDepartName()));
|
||||
runInfo.addBreak();
|
||||
|
||||
// ===== 表格(1标题行 + 数据行) =====
|
||||
int colNum = 12;
|
||||
XWPFTable table = doc.createTable(1, colNum);
|
||||
table.setWidth("100%");
|
||||
|
||||
// 表头文字
|
||||
String[] headers = {
|
||||
"机具名称", "规格型号", "单位", "数量", "设备编码",
|
||||
"额定载荷KN", "试验载荷KN", "持荷时间min",
|
||||
"试验日期", "下次试验日期", "检验结论", "备注"
|
||||
};
|
||||
|
||||
// 设置表头样式
|
||||
XWPFTableRow headerRow = table.getRow(0);
|
||||
for (int i = 0; i < headers.length; i++) {
|
||||
XWPFTableCell cell = headerRow.getCell(i);
|
||||
setCellText(cell, headers[i], true);
|
||||
}
|
||||
|
||||
// 数据行
|
||||
XWPFTableRow dataRow = table.createRow();
|
||||
String[] values = {
|
||||
safe(item.getTypeName()),
|
||||
safe(item.getTypeModelName()),
|
||||
safe(item.getUnit()),
|
||||
safe(String.valueOf(item.getNum())),
|
||||
safe(item.getMaCode()),
|
||||
safe(item.getRatedLoad()),
|
||||
safe(item.getTestLoad()),
|
||||
safe(item.getHoldingTime()),
|
||||
safe(item.getTestTime()),
|
||||
safe(item.getNextTestTime()),
|
||||
safe(item.getCheckResult()),
|
||||
safe(item.getRemark())
|
||||
};
|
||||
|
||||
for (int i = 0; i < colNum; i++) {
|
||||
XWPFTableCell cell = dataRow.getCell(i);
|
||||
setCellText(cell, values[i], false);
|
||||
}
|
||||
|
||||
// ===== 检验单位 =====
|
||||
XWPFParagraph footer = doc.createParagraph();
|
||||
footer.setAlignment(ParagraphAlignment.LEFT);
|
||||
footer.setSpacingBefore(400);
|
||||
XWPFRun runFooter = footer.createRun();
|
||||
runFooter.setFontFamily("宋体");
|
||||
runFooter.setFontSize(12);
|
||||
runFooter.setText("检验单位:");
|
||||
|
||||
// ===== 插入印章图片 =====
|
||||
// 使用类路径读取图片
|
||||
InputStream is = DocxUtil.class.getClassLoader().getResourceAsStream("template/gaizhang.png");
|
||||
if (is == null) {
|
||||
throw new FileNotFoundException("找不到资源:template/gaizhang.png");
|
||||
}
|
||||
|
||||
// 在同一个 Run 后面插入图片
|
||||
runFooter.addPicture(is, XWPFDocument.PICTURE_TYPE_PNG, "gaizhang.png", Units.toEMU(100), Units.toEMU(100));
|
||||
is.close();
|
||||
|
||||
|
||||
doc.write(bos);
|
||||
return bos.toByteArray();
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return new byte[0];
|
||||
}
|
||||
}
|
||||
|
||||
/** 单元格通用设置 */
|
||||
private static void setCellText(XWPFTableCell cell, String text, boolean isHeader) {
|
||||
XWPFParagraph p = cell.getParagraphs().get(0);
|
||||
p.setAlignment(ParagraphAlignment.CENTER);
|
||||
XWPFRun run = p.createRun();
|
||||
run.setFontFamily("宋体");
|
||||
run.setFontSize(10);
|
||||
run.setText(text == null ? "" : text);
|
||||
if (isHeader) {
|
||||
run.setBold(true);
|
||||
}
|
||||
// 设置单元格宽度
|
||||
cell.getCTTc().addNewTcPr().addNewTcW().setW(BigInteger.valueOf(1200));
|
||||
}
|
||||
|
||||
private static String safe(String s) {
|
||||
return s == null ? "" : s;
|
||||
}
|
||||
|
||||
/**
|
||||
* 读取图片文件为 byte 数组
|
||||
* @param file 图片文件
|
||||
* @return 图片的字节数据
|
||||
*/
|
||||
private static byte[] getImageBytes(File file) throws IOException {
|
||||
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
|
||||
try (FileInputStream fileInputStream = new FileInputStream(file)) {
|
||||
byte[] buffer = new byte[1024];
|
||||
int length;
|
||||
while ((length = fileInputStream.read(buffer)) != -1) {
|
||||
byteArrayOutputStream.write(buffer, 0, length);
|
||||
}
|
||||
}
|
||||
return byteArrayOutputStream.toByteArray();
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据文件扩展名获取图片类型
|
||||
* @param fileName 文件名
|
||||
* @return 图片类型
|
||||
*/
|
||||
private static int getPictureType(String fileName) {
|
||||
String ext = fileName.substring(fileName.lastIndexOf('.') + 1).toLowerCase();
|
||||
switch (ext) {
|
||||
case "png":
|
||||
return XWPFDocument.PICTURE_TYPE_PNG;
|
||||
case "jpeg":
|
||||
case "jpg":
|
||||
return XWPFDocument.PICTURE_TYPE_JPEG;
|
||||
case "gif":
|
||||
return XWPFDocument.PICTURE_TYPE_GIF;
|
||||
default:
|
||||
throw new IllegalArgumentException("Unsupported image type: " + ext);
|
||||
}
|
||||
}
|
||||
|
||||
public static byte[] generateReportByList(List<DownloadRequest.ItemInfo> items) {
|
||||
if (items == null || items.isEmpty()) {
|
||||
return new byte[0];
|
||||
}
|
||||
|
||||
DownloadRequest.ItemInfo first = items.get(0);
|
||||
|
||||
try (XWPFDocument doc = new XWPFDocument(); ByteArrayOutputStream bos = new ByteArrayOutputStream()) {
|
||||
// 页面横向
|
||||
CTSectPr sectPr = doc.getDocument().getBody().addNewSectPr();
|
||||
CTPageSz pageSize = sectPr.addNewPgSz();
|
||||
pageSize.setOrient(STPageOrientation.LANDSCAPE);
|
||||
pageSize.setW(BigInteger.valueOf(16840));
|
||||
pageSize.setH(BigInteger.valueOf(11900));
|
||||
|
||||
// 标题
|
||||
XWPFParagraph title = doc.createParagraph();
|
||||
title.setAlignment(ParagraphAlignment.CENTER);
|
||||
XWPFRun runTitle = title.createRun();
|
||||
runTitle.setText("施工机具设备出库检验记录表");
|
||||
runTitle.setBold(true);
|
||||
runTitle.setFontFamily("宋体");
|
||||
runTitle.setFontSize(16);
|
||||
|
||||
// 工程、单位
|
||||
XWPFParagraph info = doc.createParagraph();
|
||||
info.setAlignment(ParagraphAlignment.LEFT);
|
||||
XWPFRun runInfo = info.createRun();
|
||||
runInfo.setFontFamily("宋体");
|
||||
runInfo.setFontSize(12);
|
||||
runInfo.setText("领用工程:" + safe(first.getProName()) + " 使用单位:" + safe(first.getDepartName()));
|
||||
runInfo.addBreak();
|
||||
|
||||
// 表格
|
||||
int colNum = 12;
|
||||
XWPFTable table = doc.createTable(1, colNum);
|
||||
table.setWidth("100%");
|
||||
|
||||
String[] headers = {
|
||||
"机具名称", "规格型号", "单位", "数量", "设备编码",
|
||||
"额定载荷KN", "试验载荷KN", "持荷时间min",
|
||||
"试验日期", "下次试验日期", "检验结论", "备注"
|
||||
};
|
||||
XWPFTableRow headerRow = table.getRow(0);
|
||||
for (int i = 0; i < headers.length; i++) {
|
||||
setCellText(headerRow.getCell(i), headers[i], true);
|
||||
}
|
||||
|
||||
for (DownloadRequest.ItemInfo item : items) {
|
||||
XWPFTableRow row = table.createRow();
|
||||
String[] values = {
|
||||
safe(item.getTypeName()), safe(item.getTypeModelName()), safe(item.getUnit()), safe(String.valueOf(item.getNum())),
|
||||
safe(item.getMaCode()), safe(item.getRatedLoad()), safe(item.getTestLoad()), safe(item.getHoldingTime()),
|
||||
safe(item.getTestTime()), safe(item.getNextTestTime()), safe(item.getCheckResult()), safe(item.getRemark())
|
||||
};
|
||||
for (int i = 0; i < colNum; i++) {
|
||||
setCellText(row.getCell(i), values[i], false);
|
||||
}
|
||||
}
|
||||
|
||||
// 检验单位 + 印章
|
||||
XWPFParagraph footer = doc.createParagraph();
|
||||
footer.setAlignment(ParagraphAlignment.LEFT);
|
||||
footer.setSpacingBefore(400);
|
||||
XWPFRun runFooter = footer.createRun();
|
||||
runFooter.setFontFamily("宋体");
|
||||
runFooter.setFontSize(12);
|
||||
runFooter.setText("检验单位:");
|
||||
|
||||
InputStream is = DocxUtil.class.getClassLoader().getResourceAsStream("template/gaizhang.png");
|
||||
if (is != null) {
|
||||
runFooter.addPicture(is, XWPFDocument.PICTURE_TYPE_PNG, "gaizhang.png", Units.toEMU(100), Units.toEMU(100));
|
||||
}
|
||||
|
||||
doc.write(bos);
|
||||
return bos.toByteArray();
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return new byte[0];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
package com.bonus.material.common.utils;
|
||||
|
||||
import org.apache.http.HttpEntity;
|
||||
import org.apache.http.client.methods.CloseableHttpResponse;
|
||||
import org.apache.http.client.methods.HttpGet;
|
||||
import org.apache.http.impl.client.CloseableHttpClient;
|
||||
import org.apache.http.impl.client.HttpClients;
|
||||
import org.apache.http.util.EntityUtils;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class HttpFileUtil {
|
||||
|
||||
public static byte[] downloadFile(String url) throws IOException {
|
||||
try (CloseableHttpClient client = HttpClients.createDefault()) {
|
||||
HttpGet get = new HttpGet(url);
|
||||
try (CloseableHttpResponse response = client.execute(get)) {
|
||||
HttpEntity entity = response.getEntity();
|
||||
return entity != null ? EntityUtils.toByteArray(entity) : null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -50,6 +50,17 @@ public class FieldMaintenanceController extends BaseController {
|
|||
return AjaxResult.success(ListPagingUtil.paging(pageIndex, pageSize, list));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询现场维修三级列表
|
||||
* @param fieldApplyDetails
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "查询现场维修三级列表")
|
||||
@GetMapping("/getDetailsInfo")
|
||||
public AjaxResult getDetailsInfo(FieldApplyDetails fieldApplyDetails) {
|
||||
return AjaxResult.success(fieldMaintenanceService.getDetailsInfo(fieldApplyDetails));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增维修任务app
|
||||
|
|
@ -83,7 +94,7 @@ public class FieldMaintenanceController extends BaseController {
|
|||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "删除任务")
|
||||
@ApiOperation(value = "删除主任务")
|
||||
@PreventRepeatSubmit
|
||||
@SysLog(title = "现场维修任务", businessType = OperaType.INSERT, logType = 1, module = "仓储管理->删除任务")
|
||||
@PostMapping("/deleteFieldApplyInfoById")
|
||||
|
|
@ -107,13 +118,13 @@ public class FieldMaintenanceController extends BaseController {
|
|||
}
|
||||
}
|
||||
|
||||
@ApiOperation(value = "提交任务")
|
||||
@ApiOperation(value = "删除详情数据")
|
||||
@PreventRepeatSubmit
|
||||
@SysLog(title = "现场维修任务", businessType = OperaType.INSERT, logType = 1, module = "仓储管理->删除任务")
|
||||
@PostMapping("/deleteFieldApplyDetailsById")
|
||||
public AjaxResult deleteFieldApplyDetailsById(@RequestBody FieldApplyDetails fieldApplyDetails) {
|
||||
try {
|
||||
return fieldMaintenanceService.deleteFieldApplyDetailsById(fieldApplyDetails.getParentId(), fieldApplyDetails.getTypeId());
|
||||
return fieldMaintenanceService.deleteFieldApplyDetailsById(fieldApplyDetails);
|
||||
} catch (Exception e) {
|
||||
return error();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package com.bonus.material.fieldMaintenance.domain;
|
|||
import com.bonus.common.biz.domain.BmFileInfo;
|
||||
import com.bonus.common.core.annotation.Excel;
|
||||
import com.bonus.material.back.domain.MaCodeDto;
|
||||
import com.bonus.material.repair.domain.RepairPartDetails;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
|
@ -78,7 +79,7 @@ public class FieldApplyDetails {
|
|||
|
||||
/** 退料数量 */
|
||||
@ApiModelProperty(value = "维修数量")
|
||||
private BigDecimal preNum;
|
||||
private BigDecimal repairNum;
|
||||
|
||||
/** 审批数量 */
|
||||
@ApiModelProperty(value = "审批数量")
|
||||
|
|
@ -116,4 +117,14 @@ public class FieldApplyDetails {
|
|||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
* 附件集合
|
||||
*/
|
||||
private List<BmFileInfo> fileInfoList;
|
||||
|
||||
/**
|
||||
* 维修配件集合
|
||||
*/
|
||||
private List<RepairPartDetails> partDetails;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@ package com.bonus.material.fieldMaintenance.mapper;
|
|||
|
||||
import com.bonus.material.fieldMaintenance.domain.FieldApplyDetails;
|
||||
import com.bonus.material.fieldMaintenance.domain.FieldApplyInfo;
|
||||
import com.bonus.material.repair.domain.RepairCost;
|
||||
import com.bonus.material.repair.domain.RepairPartDetails;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -45,4 +47,43 @@ public interface FieldMaintenanceMapper {
|
|||
int deleteFieldApplyDetailsById(@Param("id") Long id, @Param("typeId") Long typeId);
|
||||
|
||||
int insertDetails(FieldApplyDetails fieldApplyDetails);
|
||||
|
||||
/**
|
||||
* 新增配件明细
|
||||
* @param partDetails
|
||||
* @return
|
||||
*/
|
||||
int insertRepairPartDetailsList(@Param("list") List<RepairPartDetails> partDetails);
|
||||
|
||||
/**
|
||||
* 往repair_cost表新增数据
|
||||
* @param repairCost
|
||||
*/
|
||||
int addRepairCost(RepairCost repairCost);
|
||||
|
||||
/**
|
||||
* 查询配件详情
|
||||
* @param fieldApplyDetails
|
||||
* @return
|
||||
*/
|
||||
List<RepairPartDetails> selectRepairPartDetailsList(FieldApplyDetails fieldApplyDetails);
|
||||
|
||||
int deletePartDetails(FieldApplyDetails fieldApplyDetails);
|
||||
|
||||
int deleteRepairCost(FieldApplyDetails fieldApplyDetails);
|
||||
|
||||
int deleteByTaskId(FieldApplyDetails fieldApplyDetails);
|
||||
|
||||
/**
|
||||
* 个人配件库存扣除
|
||||
* @param partDetails
|
||||
*/
|
||||
int subtractStorageNum(RepairPartDetails partDetails);
|
||||
|
||||
/**
|
||||
* 配件库存增加
|
||||
* @param partDetail
|
||||
* @return
|
||||
*/
|
||||
int addStorageNum(RepairPartDetails partDetail);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,9 +52,15 @@ public interface FieldMaintenanceService {
|
|||
AjaxResult submitTask(Long taskId);
|
||||
|
||||
|
||||
AjaxResult deleteFieldApplyDetailsById(Long id,Long typeId);
|
||||
AjaxResult deleteFieldApplyDetailsById(FieldApplyDetails fieldApplyDetails);
|
||||
|
||||
|
||||
AjaxResult insertDetails(FieldApplyDetails fieldApplyDetails);
|
||||
|
||||
/**
|
||||
* 查询现场维修三级列表
|
||||
* @param fieldApplyDetails
|
||||
* @return
|
||||
*/
|
||||
FieldApplyDetails getDetailsInfo(FieldApplyDetails fieldApplyDetails);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,15 +2,19 @@ package com.bonus.material.fieldMaintenance.service.impl;
|
|||
|
||||
import com.alibaba.nacos.common.utils.CollectionUtils;
|
||||
import com.bonus.common.biz.constant.MaterialConstants;
|
||||
import com.bonus.common.biz.domain.BmFileInfo;
|
||||
import com.bonus.common.biz.enums.FieldTaskStatusEnum;
|
||||
import com.bonus.common.biz.enums.TmTaskTypeEnum;
|
||||
import com.bonus.common.core.utils.DateUtils;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.common.security.utils.SecurityUtils;
|
||||
import com.bonus.material.basic.mapper.BmFileInfoMapper;
|
||||
import com.bonus.material.fieldMaintenance.domain.FieldApplyDetails;
|
||||
import com.bonus.material.fieldMaintenance.domain.FieldApplyInfo;
|
||||
import com.bonus.material.fieldMaintenance.mapper.FieldMaintenanceMapper;
|
||||
import com.bonus.material.fieldMaintenance.service.FieldMaintenanceService;
|
||||
import com.bonus.material.repair.domain.RepairCost;
|
||||
import com.bonus.material.repair.domain.RepairPartDetails;
|
||||
import com.bonus.material.task.domain.TmTask;
|
||||
import com.bonus.material.task.domain.TmTaskAgreement;
|
||||
import com.bonus.material.task.mapper.TmTaskAgreementMapper;
|
||||
|
|
@ -19,6 +23,7 @@ import lombok.extern.slf4j.Slf4j;
|
|||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
|
|
@ -37,6 +42,9 @@ public class FieldMaintenanceImpl implements FieldMaintenanceService {
|
|||
@Resource
|
||||
private TmTaskAgreementMapper taskAgreementMapper;
|
||||
|
||||
@Resource
|
||||
private BmFileInfoMapper bmFileInfoMapper;
|
||||
|
||||
/**
|
||||
* 查询现场维修任务列表
|
||||
*
|
||||
|
|
@ -119,7 +127,6 @@ public class FieldMaintenanceImpl implements FieldMaintenanceService {
|
|||
tmTaskAgreement.setCreateBy(SecurityUtils.getLoginUser().getSysUser().getNickName());
|
||||
taskAgreementMapper.insertTmTaskAgreement(tmTaskAgreement);
|
||||
fieldApplyInfo.setTaskId(tmTask.getTaskId());
|
||||
fieldApplyInfo.setAgreementId(tmTaskAgreement.getAgreementId());
|
||||
int insert = fieldMaintenanceMapper.insert(fieldApplyInfo);
|
||||
return insert > 0 ? AjaxResult.success() : AjaxResult.error("保存失败,请重试!");
|
||||
}
|
||||
|
|
@ -139,8 +146,24 @@ public class FieldMaintenanceImpl implements FieldMaintenanceService {
|
|||
@Override
|
||||
public AjaxResult deleteFieldApplyInfoById(Integer id, Long taskId) {
|
||||
try {
|
||||
FieldApplyDetails fieldApplyDetails = new FieldApplyDetails();
|
||||
fieldApplyDetails.setTaskId(taskId);
|
||||
taskMapper.deleteTmTaskByTaskId(taskId);
|
||||
int i = fieldMaintenanceMapper.deleteFieldApplyInfoById(id);
|
||||
i += fieldMaintenanceMapper.deleteByTaskId(fieldApplyDetails);
|
||||
// 查询配件详情列表,备用,用作恢复个人配件库存
|
||||
List<RepairPartDetails> partDetails = fieldMaintenanceMapper.selectRepairPartDetailsList(fieldApplyDetails);
|
||||
if (CollectionUtils.isNotEmpty(partDetails)) {
|
||||
for (RepairPartDetails partDetail : partDetails) {
|
||||
// 恢复配件库存
|
||||
partDetail.setCreateBy(SecurityUtils.getUserId().toString());
|
||||
fieldMaintenanceMapper.addStorageNum(partDetail);
|
||||
}
|
||||
}
|
||||
// 删除配件详情
|
||||
i += fieldMaintenanceMapper.deletePartDetails(fieldApplyDetails);
|
||||
// 删除repair_cost表数据
|
||||
i += fieldMaintenanceMapper.deleteRepairCost(fieldApplyDetails);
|
||||
return i > 0 ? AjaxResult.success() : AjaxResult.error();
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage());
|
||||
|
|
@ -166,14 +189,25 @@ public class FieldMaintenanceImpl implements FieldMaintenanceService {
|
|||
}
|
||||
|
||||
/**
|
||||
* @param id
|
||||
* @param typeId
|
||||
* @param fieldApplyDetails
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult deleteFieldApplyDetailsById(Long id, Long typeId) {
|
||||
public AjaxResult deleteFieldApplyDetailsById(FieldApplyDetails fieldApplyDetails) {
|
||||
try {
|
||||
int i = fieldMaintenanceMapper.deleteFieldApplyDetailsById(id, typeId);
|
||||
int i = fieldMaintenanceMapper.deleteFieldApplyDetailsById(fieldApplyDetails.getParentId(), fieldApplyDetails.getTypeId());
|
||||
// 查询配件详情列表,备用,用作恢复个人配件库存
|
||||
List<RepairPartDetails> partDetails = fieldMaintenanceMapper.selectRepairPartDetailsList(fieldApplyDetails);
|
||||
if (CollectionUtils.isNotEmpty(partDetails)) {
|
||||
for (RepairPartDetails partDetail : partDetails) {
|
||||
partDetail.setCreateBy(SecurityUtils.getUserId().toString());
|
||||
fieldMaintenanceMapper.addStorageNum(partDetail);
|
||||
}
|
||||
}
|
||||
// 删除配件详情
|
||||
i += fieldMaintenanceMapper.deletePartDetails(fieldApplyDetails);
|
||||
// 删除repair_cost表数据
|
||||
i += fieldMaintenanceMapper.deleteRepairCost(fieldApplyDetails);
|
||||
return i > 0 ? AjaxResult.success() : AjaxResult.error();
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage());
|
||||
|
|
@ -188,14 +222,83 @@ public class FieldMaintenanceImpl implements FieldMaintenanceService {
|
|||
@Override
|
||||
public AjaxResult insertDetails(FieldApplyDetails fieldApplyDetails) {
|
||||
try {
|
||||
int i = fieldMaintenanceMapper.insertDetails(fieldApplyDetails);
|
||||
return i > 0 ? AjaxResult.success() : AjaxResult.error();
|
||||
fieldApplyDetails.setCreateBy(SecurityUtils.getUserId().toString());
|
||||
fieldApplyDetails.setCreateTime(DateUtils.getNowDate());
|
||||
int result = fieldMaintenanceMapper.insertDetails(fieldApplyDetails);
|
||||
if (result < 1) {
|
||||
return AjaxResult.error("保存失败,请联系管理员!");
|
||||
}
|
||||
// 判断附件是否为空
|
||||
if (CollectionUtils.isNotEmpty(fieldApplyDetails.getFileInfoList())) {
|
||||
// 不用循环,采用集合形式往sql里面新增
|
||||
fieldApplyDetails.getFileInfoList().forEach(fileInfo -> {
|
||||
fileInfo.setCreateBy(SecurityUtils.getLoginUser().getSysUser().getNickName());
|
||||
fileInfo.setTaskId(fieldApplyDetails.getTaskId());
|
||||
fileInfo.setModelId(fieldApplyDetails.getTypeId());
|
||||
fileInfo.setTaskType(21);
|
||||
});
|
||||
result = bmFileInfoMapper.insertBmFileInfos(fieldApplyDetails.getFileInfoList());
|
||||
}
|
||||
// 判断配件明细是否为空
|
||||
if (CollectionUtils.isNotEmpty(fieldApplyDetails.getPartDetails())) {
|
||||
// 不用循环,采用集合形式往sql里面新增
|
||||
fieldApplyDetails.getPartDetails().forEach(partDetails -> {
|
||||
partDetails.setCreateBy(SecurityUtils.getUserId().toString());
|
||||
partDetails.setCreateTime(DateUtils.getNowDate());
|
||||
partDetails.setTaskId(fieldApplyDetails.getTaskId());
|
||||
partDetails.setTypeId(fieldApplyDetails.getTypeId());
|
||||
partDetails.setMaId(fieldApplyDetails.getMaId() != null ? fieldApplyDetails.getMaId() : null);
|
||||
// 单价乘数量
|
||||
partDetails.setPartCost(partDetails.getPartPrice().multiply(new BigDecimal(partDetails.getPartNum())));
|
||||
// 个人配件库存扣除
|
||||
fieldMaintenanceMapper.subtractStorageNum(partDetails);
|
||||
});
|
||||
result = fieldMaintenanceMapper.insertRepairPartDetailsList(fieldApplyDetails.getPartDetails());
|
||||
|
||||
// 往repair_cost表新增数据
|
||||
fieldApplyDetails.getPartDetails().forEach(partDetails -> {
|
||||
RepairCost repairCost = new RepairCost();
|
||||
repairCost.setTaskId(fieldApplyDetails.getTaskId());
|
||||
repairCost.setTypeId(fieldApplyDetails.getTypeId());
|
||||
repairCost.setMaId(fieldApplyDetails.getMaId() != null ? fieldApplyDetails.getMaId() : null);
|
||||
repairCost.setCosts(partDetails.getPartPrice().multiply(new BigDecimal(partDetails.getPartNum())));
|
||||
repairCost.setCreateBy(SecurityUtils.getUserId().toString());
|
||||
repairCost.setCreateTime(DateUtils.getNowDate());
|
||||
repairCost.setRepairType("4");
|
||||
repairCost.setPartType(partDetails.getPartType().toString());
|
||||
repairCost.setRepairNum(fieldApplyDetails.getRepairNum());
|
||||
fieldMaintenanceMapper.addRepairCost(repairCost);
|
||||
});
|
||||
}
|
||||
|
||||
return result > 0 ? AjaxResult.success("新增成功") : AjaxResult.error("操作失败");
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage());
|
||||
return AjaxResult.error();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询现场维修三级列表
|
||||
* @param fieldApplyDetails
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public FieldApplyDetails getDetailsInfo(FieldApplyDetails fieldApplyDetails) {
|
||||
FieldApplyDetails applyDetails = new FieldApplyDetails();
|
||||
// 查询附件列表
|
||||
BmFileInfo fileInfo = new BmFileInfo();
|
||||
fileInfo.setTaskId(fieldApplyDetails.getTaskId());
|
||||
fileInfo.setModelId(fieldApplyDetails.getTypeId());
|
||||
fileInfo.setTaskType(21);
|
||||
List<BmFileInfo> bmFileInfos = bmFileInfoMapper.selectBmFileInfoList(fileInfo);
|
||||
applyDetails.setFileInfoList(bmFileInfos);
|
||||
// 查询配件详情
|
||||
List<RepairPartDetails> partDetails = fieldMaintenanceMapper.selectRepairPartDetailsList(fieldApplyDetails);
|
||||
applyDetails.setPartDetails(partDetails);
|
||||
return applyDetails;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 生成现场维修任务单号
|
||||
|
|
|
|||
|
|
@ -206,4 +206,26 @@ public class DirectApplyInfo extends BaseEntity {
|
|||
private List<Integer> statusList;
|
||||
|
||||
private Integer deptId;
|
||||
|
||||
/**
|
||||
* 领料i8工程id
|
||||
*/
|
||||
private String leaseExternalId;
|
||||
|
||||
/**
|
||||
* 退料i8工程id
|
||||
*/
|
||||
private String backExternalId;
|
||||
|
||||
@ApiModelProperty(value = "领料分公司")
|
||||
private String leaseImpUnitName;
|
||||
|
||||
@ApiModelProperty(value = "退料分公司")
|
||||
private String backImpUnitName;
|
||||
|
||||
@ApiModelProperty(value = "领料项目部")
|
||||
private String leaseDepartName;
|
||||
|
||||
@ApiModelProperty(value = "退料项目部")
|
||||
private String backDepartName;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -308,4 +308,46 @@ public class Type extends BaseEntity {
|
|||
private String resultMsg;
|
||||
|
||||
private Integer inputType;
|
||||
|
||||
/**
|
||||
* 合格证文件名称
|
||||
*/
|
||||
private String qualifiedName;
|
||||
/**
|
||||
* 合格证文件路径
|
||||
*/
|
||||
private String qualifiedUrl;
|
||||
/**
|
||||
* 型式试验报告文件名称
|
||||
*/
|
||||
private String testReportName;
|
||||
/**
|
||||
* 型式试验报告文件路径
|
||||
*/
|
||||
private String testReportUrl;
|
||||
/**
|
||||
* 出厂检测报告名称
|
||||
*/
|
||||
private String factoryReportName;
|
||||
/**
|
||||
* 出厂检测报告路径
|
||||
*/
|
||||
private String factoryReportUrl;
|
||||
/**
|
||||
* 第三方检测报告名称
|
||||
*/
|
||||
private String thirdReportName;
|
||||
/**
|
||||
* 第三方检测报告路径
|
||||
*/
|
||||
private String thirdReportUrl;
|
||||
/**
|
||||
* 其他报告名称
|
||||
*/
|
||||
private String otherReportName;
|
||||
/**
|
||||
* 其他报告路径
|
||||
*/
|
||||
private String otherReportUrl;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -116,4 +116,6 @@ public interface DirectRotationMapper {
|
|||
* @return
|
||||
*/
|
||||
List<SltAgreementInfo> getBatchInfo(@Param("agreementId") Long agreementId, @Param("pairs")List<SltAgreementInfo> list);
|
||||
|
||||
DirectApplyInfo getDeptInfo(DirectApplyInfo directApplyInfo);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -146,10 +146,6 @@ public class DirectRotationImpl implements DirectRotationService {
|
|||
return AjaxResult.error("申请失败,不能转入同单位同工程");
|
||||
}
|
||||
// 根据退料协议ID查询该协议是否还有未审核单据待处理,若有,则无法申请,剔除工地直转
|
||||
/*int result = workSiteDirectManageService.checkLeaseApply(directApplyInfos);
|
||||
if (result > 0) {
|
||||
return AjaxResult.error("申请失败,该转出单位和转出工程下有未审核单据待处理,请处理完毕后再重新提交");
|
||||
}*/
|
||||
code = workSiteDirectManageService.genderLeaseCode();
|
||||
directApplyInfos.setCode(code);
|
||||
directApplyInfos.setCreateTime(new Date());
|
||||
|
|
@ -270,6 +266,18 @@ public class DirectRotationImpl implements DirectRotationService {
|
|||
@Override
|
||||
public DirectApplyInfo getInfoById(SltAgreementInfo sltAgreementInfo) {
|
||||
DirectApplyInfo directApplyInfo = mapper.getInfoById(sltAgreementInfo);
|
||||
// 根据领退料i8工程id查询分公司及项目部信息
|
||||
DirectApplyInfo leaseApplyInfo = mapper.getDeptInfo(directApplyInfo);
|
||||
if (leaseApplyInfo != null) {
|
||||
directApplyInfo.setLeaseImpUnitName(leaseApplyInfo.getLeaseImpUnitName());
|
||||
directApplyInfo.setLeaseDepartName(leaseApplyInfo.getLeaseDepartName());
|
||||
}
|
||||
directApplyInfo.setLeaseExternalId(directApplyInfo.getBackExternalId());
|
||||
leaseApplyInfo = mapper.getDeptInfo(directApplyInfo);
|
||||
if (leaseApplyInfo != null) {
|
||||
directApplyInfo.setBackImpUnitName(leaseApplyInfo.getLeaseImpUnitName());
|
||||
directApplyInfo.setBackDepartName(leaseApplyInfo.getLeaseDepartName());
|
||||
}
|
||||
if (directApplyInfo.getDirUrl()!= null){
|
||||
//用逗号分割放入数组
|
||||
String[] split = directApplyInfo.getDirUrl().split(",");
|
||||
|
|
@ -372,8 +380,8 @@ public class DirectRotationImpl implements DirectRotationService {
|
|||
}
|
||||
List<DirectApplyDetails> detailById = mapper.getDetailById(sltAgreementInfo);
|
||||
List<DirectApplyDetails> list = mapper.selectDetails(sltAgreementInfo);
|
||||
int thisMonthMaxOrder = taskMapper.getMonthMaxOrderByDate(DateUtils.getCurrentYear(), DateUtils.getCurrentMonth(), TmTaskTypeEnum.TM_TASK_BACK.getTaskTypeId());
|
||||
String codes = genderTaskCode(thisMonthMaxOrder);
|
||||
int thisMonthMaxOrder = taskMapper.getMonthMaxOrderByDateTwo(DateUtils.getCurrentYear(), DateUtils.getCurrentMonth(), TmTaskTypeEnum.TM_TASK_BACK.getTaskTypeId());
|
||||
String codes = genderZzBackTaskCode(thisMonthMaxOrder);
|
||||
TmTask task = new TmTask(null, TmTaskTypeEnum.TM_TASK_BACK.getTaskTypeId(),
|
||||
BackTaskStatusEnum.BACK_TASK_IN_FINISHED.getStatus(),
|
||||
null,thisMonthMaxOrder + 1, codes);
|
||||
|
|
@ -395,8 +403,8 @@ public class DirectRotationImpl implements DirectRotationService {
|
|||
extractedCheckDetails(backApplyInfo, detailById, result);
|
||||
}
|
||||
// 审核通过,处理转入单位领料逻辑
|
||||
int maxOrderByDate = tmTaskMapper.getMonthMaxOrderByDate(DateUtils.getCurrentYear(), DateUtils.getCurrentMonth(), TmTaskTypeEnum.TM_TASK_LEASE.getTaskTypeId());
|
||||
String taskCode = genderLeaseTaskCode(maxOrderByDate);
|
||||
int maxOrderByDate = tmTaskMapper.getMonthMaxOrderByDateTwo(DateUtils.getCurrentYear(), DateUtils.getCurrentMonth(), TmTaskTypeEnum.TM_TASK_LEASE.getTaskTypeId());
|
||||
String taskCode = genderZzLeaseTaskCode(maxOrderByDate);
|
||||
TmTask tmTask1 = new TmTask(null, TmTaskTypeEnum.TM_TASK_LEASE.getTaskTypeId(),
|
||||
LeaseTaskStatusEnum.LEASE_TASK_FINISHED.getStatus(),null
|
||||
,maxOrderByDate + 1, taskCode);
|
||||
|
|
@ -616,6 +624,14 @@ public class DirectRotationImpl implements DirectRotationService {
|
|||
return MaterialConstants.BACK_TASK_TYPE_LABEL + result + String.format("-%03d", thisMonthMaxOrder + 1);
|
||||
}
|
||||
|
||||
private String genderZzBackTaskCode(int thisMonthMaxOrder) {
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||
Date nowDate = DateUtils.getNowDate();
|
||||
String format = dateFormat.format(nowDate);
|
||||
String result = format.replace("-", "");
|
||||
return "ZT" + result + String.format("-%03d", thisMonthMaxOrder + 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增退料信息
|
||||
* @param info
|
||||
|
|
@ -732,6 +748,14 @@ public class DirectRotationImpl implements DirectRotationService {
|
|||
return MaterialConstants.LEASE_TASK_TYPE_LABEL + result + String.format("-%03d", thisMonthMaxOrder + 1);
|
||||
}
|
||||
|
||||
private static String genderZzLeaseTaskCode(Integer thisMonthMaxOrder) {
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||
Date nowDate = DateUtils.getNowDate();
|
||||
String format = dateFormat.format(nowDate);
|
||||
String result = format.replace("-", "");
|
||||
return "ZL" + result + String.format("-%03d", thisMonthMaxOrder + 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增lease_apply_details表数据
|
||||
* @param list
|
||||
|
|
|
|||
|
|
@ -705,6 +705,35 @@ public class PurchaseCheckInfoServiceImpl implements IPurchaseCheckInfoService {
|
|||
o.setCreateTime(DateUtils.getNowDate());
|
||||
});
|
||||
bmFileInfoMapper.insertBmFileInfos(bmFileInfos);
|
||||
Type type = new Type();
|
||||
for (BmFileInfo bmFileInfo : bmFileInfos){
|
||||
//将对应数据插入ma_type表
|
||||
if (bmFileInfo.getFileType()!=null){
|
||||
if (bmFileInfo.getFileType()==0){
|
||||
type.setQualifiedName(bmFileInfo.getName());
|
||||
type.setQualifiedUrl(bmFileInfo.getUrl());
|
||||
}
|
||||
if (bmFileInfo.getFileType()==1){
|
||||
type.setTestReportName(bmFileInfo.getName());
|
||||
type.setTestReportUrl(bmFileInfo.getUrl());
|
||||
}
|
||||
if (bmFileInfo.getFileType()==2){
|
||||
type.setFactoryReportName(bmFileInfo.getName());
|
||||
type.setFactoryReportUrl(bmFileInfo.getUrl());
|
||||
}
|
||||
if (bmFileInfo.getFileType()==3){
|
||||
type.setThirdReportName(bmFileInfo.getName());
|
||||
type.setThirdReportUrl(bmFileInfo.getUrl());
|
||||
}
|
||||
if (bmFileInfo.getFileType()==4){
|
||||
type.setOtherReportName(bmFileInfo.getName());
|
||||
type.setOtherReportUrl(bmFileInfo.getUrl());
|
||||
}
|
||||
}
|
||||
}
|
||||
type.setTypeId(bmFileInfos.get(0).getModelId());
|
||||
//更新ma_type表
|
||||
int res = typeMapper.updateType(type);
|
||||
}
|
||||
Type type = new Type();
|
||||
type.setTypeId(details.getTypeId());
|
||||
|
|
|
|||
|
|
@ -231,7 +231,7 @@ public class PurchaseStorageServiceImpl implements IPurchaseStorageService {
|
|||
result += updateTaskStatus(statusList);
|
||||
return AjaxResult.error("该设备已全部入库,请勿重复操作");
|
||||
}
|
||||
purchaseDto.setInputNum(details.get(0).getCheckNum());
|
||||
purchaseDto.setInputNum(details.get(0).getCheckNum().subtract(details.get(0).getInPutNum()));
|
||||
result += updatePurchaseInfoAndDetails(details.get(0), Integer.parseInt(purchaseDto.getPurchaseId()));
|
||||
}
|
||||
} else {
|
||||
|
|
@ -318,9 +318,9 @@ public class PurchaseStorageServiceImpl implements IPurchaseStorageService {
|
|||
type.setTypeId(Long.valueOf(detail.getTypeId()));
|
||||
type.setStyle("4");
|
||||
type.setCode(detail.getPurchaseCode());
|
||||
type.setInputNum(detail.getCheckNum());
|
||||
type.setInputNum(detail.getCheckNum().subtract(detail.getInPutNum()));
|
||||
int result = typeService.updateNumAddOrSubtract(type);
|
||||
result += purchaseStorageMapper.updateNum(detail.getPurchaseId(), detail.getCheckNum());
|
||||
result += purchaseStorageMapper.updateNum(detail.getPurchaseId(), detail.getCheckNum().subtract(detail.getInPutNum()));
|
||||
//result += purchaseStorageMapper.updateStorageNum(detail.getCheckNum(), detail.getTypeId());
|
||||
return result + purchaseStorageMapper.updateStatusById(PurchaseTaskStatusEnum.IN_STORE.getStatus(), purchaseId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,6 +43,8 @@ public interface TmTaskMapper {
|
|||
*/
|
||||
int getMonthMaxOrderByDate(@Param("year") String year, @Param("month") String month, @Param("taskType") Integer taskType);
|
||||
|
||||
int getMonthMaxOrderByDateTwo(@Param("year") String year, @Param("month") String month, @Param("taskType") Integer taskType);
|
||||
|
||||
/**
|
||||
* 查询任务列表
|
||||
*
|
||||
|
|
@ -211,4 +213,5 @@ public interface TmTaskMapper {
|
|||
* @return
|
||||
*/
|
||||
List<Long> selectRepairInfo(TmTask info);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -579,8 +579,8 @@ public class SysWorkflowRecordHistoryServiceImpl implements SysWorkflowRecordHis
|
|||
}
|
||||
List<DirectApplyDetails> detailById = mapper.getDetailById(sltAgreementInfo);
|
||||
List<DirectApplyDetails> list = mapper.selectDetails(sltAgreementInfo);
|
||||
int thisMonthMaxOrder = taskMapper.getMonthMaxOrderByDate(DateUtils.getCurrentYear(), DateUtils.getCurrentMonth(), TmTaskTypeEnum.TM_TASK_BACK.getTaskTypeId());
|
||||
String codes = genderTaskCode(thisMonthMaxOrder);
|
||||
int thisMonthMaxOrder = taskMapper.getMonthMaxOrderByDateTwo(DateUtils.getCurrentYear(), DateUtils.getCurrentMonth(), TmTaskTypeEnum.TM_TASK_BACK.getTaskTypeId());
|
||||
String codes = genderZzBackTaskCode(thisMonthMaxOrder);
|
||||
TmTask task = new TmTask(null, TmTaskTypeEnum.TM_TASK_BACK.getTaskTypeId(),
|
||||
BackTaskStatusEnum.BACK_TASK_IN_FINISHED.getStatus(),
|
||||
null,thisMonthMaxOrder + 1, codes);
|
||||
|
|
@ -601,8 +601,8 @@ public class SysWorkflowRecordHistoryServiceImpl implements SysWorkflowRecordHis
|
|||
extractedCheckDetails(backApplyInfo, detailById, result);
|
||||
}
|
||||
// 审核通过,处理转入单位领料逻辑
|
||||
int maxOrderByDate = tmTaskMapper.getMonthMaxOrderByDate(DateUtils.getCurrentYear(), DateUtils.getCurrentMonth(), TmTaskTypeEnum.TM_TASK_LEASE.getTaskTypeId());
|
||||
String taskCode = genderLeaseTaskCode(maxOrderByDate);
|
||||
int maxOrderByDate = tmTaskMapper.getMonthMaxOrderByDateTwo(DateUtils.getCurrentYear(), DateUtils.getCurrentMonth(), TmTaskTypeEnum.TM_TASK_LEASE.getTaskTypeId());
|
||||
String taskCode = genderZzLeaseTaskCode(maxOrderByDate);
|
||||
TmTask tmTask1 = new TmTask(null, TmTaskTypeEnum.TM_TASK_LEASE.getTaskTypeId(),
|
||||
LeaseTaskStatusEnum.LEASE_TASK_FINISHED.getStatus(),null
|
||||
,maxOrderByDate + 1, taskCode);
|
||||
|
|
@ -1367,6 +1367,14 @@ public class SysWorkflowRecordHistoryServiceImpl implements SysWorkflowRecordHis
|
|||
return MaterialConstants.LEASE_TASK_TYPE_LABEL + result + String.format("-%03d", thisMonthMaxOrder + 1);
|
||||
}
|
||||
|
||||
private static String genderZzLeaseTaskCode(Integer thisMonthMaxOrder) {
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||
Date nowDate = DateUtils.getNowDate();
|
||||
String format = dateFormat.format(nowDate);
|
||||
String result = format.replace("-", "");
|
||||
return "ZL" + result + String.format("-%03d", thisMonthMaxOrder + 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存退料详情数据 back_check_details
|
||||
* @param backApplyInfo
|
||||
|
|
@ -1483,6 +1491,14 @@ public class SysWorkflowRecordHistoryServiceImpl implements SysWorkflowRecordHis
|
|||
return MaterialConstants.BACK_TASK_TYPE_LABEL + result + String.format("-%03d", thisMonthMaxOrder + 1);
|
||||
}
|
||||
|
||||
private String genderZzBackTaskCode(int thisMonthMaxOrder) {
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||
Date nowDate = DateUtils.getNowDate();
|
||||
String format = dateFormat.format(nowDate);
|
||||
String result = format.replace("-", "");
|
||||
return "ZT" + result + String.format("-%03d", thisMonthMaxOrder + 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* 过滤字符串,保留 sourceStr 中在 referenceStr 里也存在的元素(都用逗号分隔)
|
||||
*
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@
|
|||
INSERT INTO field_apply_info
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="taskId != null">task_id,</if>
|
||||
<if test="agreementId != null">agreement_id,</if>
|
||||
<if test="fieldPerson != null">field_person,</if>
|
||||
<if test="phone != null">phone,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
|
|
@ -17,7 +16,6 @@
|
|||
</trim>
|
||||
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
|
||||
<if test="taskId != null">#{taskId},</if>
|
||||
<if test="agreementId != null">#{agreementId},</if>
|
||||
<if test="fieldPerson != null">#{fieldPerson},</if>
|
||||
<if test="phone != null">#{phone},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
|
|
@ -29,47 +27,113 @@
|
|||
<insert id="insertDetails">
|
||||
INSERT INTO field_apply_details
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="code != null">code,</if>
|
||||
<if test="parentId != null">parent_id,</if>
|
||||
<if test="taskId != null">task_id,</if>
|
||||
<if test="id != null">parent_id,</if>
|
||||
<if test="typeId != null">type_id,</if>
|
||||
<if test="preNum != null">pre_num,</if>
|
||||
<if test="repairNum != null">repair_num,</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="maCode != null">ma_code,</if>
|
||||
<if test="maId != null">ma_id,</if>
|
||||
</trim>
|
||||
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
|
||||
<if test="code != null">#{code},</if>
|
||||
<if test="parentId != null">#{taskId},</if>
|
||||
<if test="taskId != null">#{taskId},</if>
|
||||
<if test="id != null">#{id},</if>
|
||||
<if test="typeId != null">#{typeId},</if>
|
||||
<if test="preNum != null">#{preNum},</if>
|
||||
<if test="repairNum != null">#{repairNum},</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="maCode != null">#{maCode},</if>
|
||||
<if test="maId != null">#{maId},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<insert id="insertRepairPartDetailsList">
|
||||
insert into field_part_details (task_id, type_id,ma_id,part_id,part_num,part_price,part_cost,part_type,create_by,create_time,repair_content, remark)
|
||||
values
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(#{item.taskId},#{item.typeId},#{item.maId},#{item.partId},#{item.partNum},#{item.partPrice},#{item.partCost},#{item.partType},#{item.createBy},#{item.createTime},#{item.repairContent},#{item.remark})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<insert id="addRepairCost">
|
||||
insert into repair_cost (task_id, type_id, ma_id, repair_num, costs, part_type, status, repair_type)
|
||||
values
|
||||
(#{taskId},#{typeId},#{maId},#{repairNum},#{costs},#{partType},#{status},#{repairType})
|
||||
</insert>
|
||||
|
||||
<insert id="addStorageNum">
|
||||
update
|
||||
pa_person_storage
|
||||
set part_num = part_num + #{partNum}
|
||||
where part_id = #{partId}
|
||||
and creator = #{createBy}
|
||||
</insert>
|
||||
|
||||
<update id="deleteFieldApplyInfoById" parameterType="java.lang.Integer">
|
||||
UPDATE field_apply_info
|
||||
SET is_valid = 0,
|
||||
update_time = NOW()
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="subtractStorageNum">
|
||||
update
|
||||
pa_person_storage
|
||||
set part_num = part_num - #{partNum}
|
||||
where part_id = #{partId}
|
||||
and creator = #{createBy}
|
||||
</update>
|
||||
<delete id="deleteFieldApplyDetailsById">
|
||||
DELETE
|
||||
FROM field_apply_details
|
||||
WHERE parent_id = #{id}
|
||||
and type_id = #{typeId}
|
||||
</delete>
|
||||
<delete id="deletePartDetails">
|
||||
DELETE
|
||||
FROM field_part_details
|
||||
<where>
|
||||
<if test="taskId != null">
|
||||
and task_id = #{taskId}
|
||||
</if>
|
||||
<if test="typeId != null">
|
||||
and type_id = #{typeId}
|
||||
</if>
|
||||
<if test="maId != null">
|
||||
and ma_id = #{maId}
|
||||
</if>
|
||||
</where>
|
||||
</delete>
|
||||
<delete id="deleteRepairCost">
|
||||
DELETE
|
||||
FROM repair_cost
|
||||
<where>
|
||||
<if test="taskId != null">
|
||||
and task_id = #{taskId}
|
||||
</if>
|
||||
<if test="typeId != null">
|
||||
and type_id = #{typeId}
|
||||
</if>
|
||||
<if test="maId != null">
|
||||
and ma_id = #{maId}
|
||||
</if>
|
||||
</where>
|
||||
</delete>
|
||||
|
||||
<delete id="deleteByTaskId">
|
||||
DELETE
|
||||
FROM field_apply_details
|
||||
WHERE task_id = #{taskId}
|
||||
</delete>
|
||||
|
||||
<select id="selectFieldApplyInfoList" resultType="com.bonus.material.fieldMaintenance.domain.FieldApplyInfo">
|
||||
SELECT
|
||||
fai.id AS id,
|
||||
fai.task_id AS taskId,
|
||||
fai.agreement_id AS agreementId,
|
||||
tta.agreement_id AS agreementId,
|
||||
tt.`code` as code,
|
||||
fai.field_person AS fieldPerson,
|
||||
fai.phone AS phone,
|
||||
|
|
@ -94,7 +158,7 @@
|
|||
bad.parent_id,
|
||||
GROUP_CONCAT(DISTINCT mt2.type_id) AS typeIds,
|
||||
GROUP_CONCAT(DISTINCT mt2.type_name) AS typeNames,
|
||||
SUM(bad.pre_num) AS num
|
||||
SUM(bad.repair_num) AS num
|
||||
FROM field_apply_details bad
|
||||
LEFT JOIN ma_type mt1 ON mt1.type_id = bad.type_id AND mt1.del_flag = '0'
|
||||
LEFT JOIN ma_type mt2 ON mt2.type_id = mt1.parent_id AND mt2.del_flag = '0'
|
||||
|
|
@ -159,13 +223,14 @@
|
|||
fad.id AS id,
|
||||
fad.parent_id AS parentId,
|
||||
fad.type_id AS typeId,
|
||||
fad.task_id AS taskId,
|
||||
mt2.type_name AS materialType,
|
||||
mt.type_name AS typeModel,
|
||||
mt1.type_name AS typeName,
|
||||
mt.unit_name AS unitName,
|
||||
mt.unit_value AS unitValue,
|
||||
mt.manage_type AS manageType,
|
||||
SUM(fad.pre_num) AS preNum,
|
||||
SUM(fad.repair_num) AS repairNum,
|
||||
fad.create_by AS createBy,
|
||||
fad.create_time AS createTime,
|
||||
fad.update_by AS updateBy,
|
||||
|
|
@ -188,5 +253,28 @@
|
|||
GROUP BY fad.type_id,mt.manage_type
|
||||
</select>
|
||||
|
||||
<select id="selectRepairPartDetailsList" resultType="com.bonus.material.repair.domain.RepairPartDetails">
|
||||
SELECT
|
||||
fpd.part_id AS partId,
|
||||
mpt.pa_name AS partName,
|
||||
fpd.part_num AS partNum,
|
||||
fpd.repair_content AS repairContent,
|
||||
mt1.type_name AS typeName,
|
||||
mt.type_name AS typeModelName,
|
||||
mm.ma_code AS maCode,
|
||||
fpd.part_type AS partType
|
||||
FROM
|
||||
field_part_details fpd
|
||||
LEFT JOIN ma_part_type mpt ON fpd.part_id = mpt.pa_id
|
||||
LEFT JOIN ma_type mt ON fpd.type_id = mt.type_id
|
||||
LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id
|
||||
LEFT JOIN ma_machine mm ON fpd.ma_id = mm.ma_id
|
||||
WHERE
|
||||
fpd.task_id = #{taskId}
|
||||
<if test="typeId != null">
|
||||
AND fpd.type_id = #{typeId}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
|
@ -1654,4 +1654,62 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
ORDER BY
|
||||
createTime DESC;
|
||||
</select>
|
||||
|
||||
<select id="getXmList" resultType="com.bonus.material.settlement.domain.SltAgreementInfo">
|
||||
SELECT
|
||||
id AS id,
|
||||
agreement_id AS agreementId,
|
||||
type_id AS typeId,
|
||||
ma_id AS maId,
|
||||
num AS backNum,
|
||||
start_time AS startTime,
|
||||
end_time AS endTime,
|
||||
status AS status,
|
||||
lease_id AS leaseId,
|
||||
lease_type AS leaseType,
|
||||
back_id AS backId,
|
||||
lease_price AS leasePrice,
|
||||
buy_price AS buyPrice,
|
||||
company_id AS companyId
|
||||
FROM
|
||||
slt_agreement_info
|
||||
WHERE
|
||||
status = 0
|
||||
AND source = '2'
|
||||
AND type_id = #{typeId}
|
||||
AND agreement_id = #{agreementId}
|
||||
<if test="maId != null">
|
||||
AND ma_id = #{maId}
|
||||
</if>
|
||||
order by start_time asc
|
||||
</select>
|
||||
|
||||
<select id="getClzList" resultType="com.bonus.material.settlement.domain.SltAgreementInfo">
|
||||
SELECT
|
||||
id AS id,
|
||||
agreement_id AS agreementId,
|
||||
type_id AS typeId,
|
||||
ma_id AS maId,
|
||||
num AS backNum,
|
||||
start_time AS startTime,
|
||||
end_time AS endTime,
|
||||
status AS status,
|
||||
lease_id AS leaseId,
|
||||
lease_type AS leaseType,
|
||||
back_id AS backId,
|
||||
lease_price AS leasePrice,
|
||||
buy_price AS buyPrice,
|
||||
company_id AS companyId
|
||||
FROM
|
||||
clz_slt_agreement_info
|
||||
WHERE
|
||||
status = 0
|
||||
AND source = '2'
|
||||
AND type_id = #{typeId}
|
||||
AND agreement_id = #{agreementId}
|
||||
<if test="maId != null">
|
||||
AND ma_id = #{maId}
|
||||
</if>
|
||||
order by start_time asc
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -613,5 +613,89 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
WHERE
|
||||
u.user_id = #{repairPersonName}
|
||||
</select>
|
||||
<select id="getReportList" resultType="com.bonus.material.basic.domain.report.ReportQuery">
|
||||
SELECT
|
||||
sai.id,
|
||||
sd.dept_id as deptId,
|
||||
sd.dept_name AS impUnitName,
|
||||
df.id as departId,
|
||||
df.project_dept AS departName,
|
||||
bp.pro_id as proId,
|
||||
bp.pro_name as proName,
|
||||
mt2.type_name AS typeName,
|
||||
mt.type_name AS typeModelName,
|
||||
mt.type_id as typeId,
|
||||
mt.unit_name as unit,
|
||||
SUM(sai.num) as num,
|
||||
mm.ma_code as maCode,
|
||||
mm.qr_code as qrCode,
|
||||
LEFT(sai.start_time,10) as leaseTime,
|
||||
mt.qualified_name as qualifiedName,
|
||||
mt.qualified_url as qualifiedUrl,
|
||||
mt.test_report_name as testReportName,
|
||||
mt.test_report_url as testReportUrl,
|
||||
mt.factory_report_name as factoryReportName,
|
||||
mt.factory_report_url as factoryReportUrl,
|
||||
mt.third_report_name as thirdReportName,
|
||||
mt.third_report_url as thirdReportUrl,
|
||||
mt.other_report_name as otherReportName,
|
||||
mt.other_report_url as otherReportUrl,
|
||||
'合格' AS checkResult,
|
||||
mt.rated_load as ratedLoad,
|
||||
mt.test_load as testLoad,
|
||||
mt.holding_time as holdingTime,
|
||||
DATE(sai.start_time) AS testTime,
|
||||
DATE(DATE_SUB(DATE_ADD(sai.start_time, INTERVAL 1 YEAR), INTERVAL 1 DAY)) AS nextTestTime
|
||||
FROM
|
||||
slt_agreement_info sai
|
||||
LEFT JOIN ma_type mt ON mt.type_id = sai.type_id
|
||||
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
|
||||
LEFT JOIN ma_type mt3 ON mt3.type_id = mt2.parent_id
|
||||
LEFT JOIN ma_type mt4 ON mt4.type_id = mt3.parent_id
|
||||
LEFT JOIN bm_agreement_info bai ON sai.agreement_id = bai.agreement_id
|
||||
LEFT JOIN bm_project bp ON bai.project_id = bp.pro_id
|
||||
LEFT JOIN bm_unit bu ON bai.unit_id = bu.unit_id AND bu.del_flag = '0'
|
||||
LEFT JOIN sys_dept sd ON sd.dept_id = bp.imp_unit
|
||||
LEFT JOIN `micro-tool`.bzgl_bz bz ON bp.external_id = bz.project_id AND bz.bzmc = bu.unit_name
|
||||
LEFT JOIN data_center.dx_fb_son df ON bp.external_id = df.id
|
||||
LEFT JOIN ma_machine mm on mm.ma_id=sai.ma_id
|
||||
WHERE
|
||||
sai.`status` = '0'
|
||||
AND sai.end_time IS NULL
|
||||
AND sai.back_id IS NULL
|
||||
AND bu.unit_name is not null
|
||||
AND bp.external_id is not NULL
|
||||
and sd.dept_id not in (342,345,347,348,101,344)
|
||||
and bp.pro_id not in (3414,1192,3321,3595)
|
||||
and bp.pro_center IS NOT NULL
|
||||
<if test="impUnitName != null and impUnitName != ''">
|
||||
AND sd.dept_name = #{impUnitName}
|
||||
</if>
|
||||
<if test="proName != null and proName != ''">
|
||||
AND bp.pro_name = #{proName}
|
||||
</if>
|
||||
<if test="departName != null and departName != ''">
|
||||
AND bp.pro_center LIKE CONCAT('%', #{departName}, '%')
|
||||
</if>
|
||||
<if test="typeName != null and typeName != ''">
|
||||
AND mt2.type_name LIKE CONCAT('%', #{typeName}, '%')
|
||||
</if>
|
||||
<if test="typeModelName != null and typeModelName != ''">
|
||||
AND mt.type_name LIKE CONCAT('%', #{typeModelName}, '%')
|
||||
</if>
|
||||
<if test="projectIdList != null and projectIdList.size() > 0">
|
||||
AND bp.external_id in
|
||||
<foreach item="item" collection="projectIdList" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="impUnit != null and impUnit != ''">
|
||||
AND bp.imp_unit = #{impUnit}
|
||||
</if>
|
||||
<if test="jiJuType != null and jiJuType != ''">
|
||||
AND mt.jiju_type = #{jiJuType}
|
||||
</if>
|
||||
GROUP BY sd.dept_id,df.id,bp.pro_id,sai.type_id,LEFT(sai.start_time,10),sai.ma_id
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -196,8 +196,8 @@
|
|||
</delete>
|
||||
|
||||
<insert id="insStlInfoTwo">
|
||||
insert into clz_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 (#{info.agreementId},#{info.typeId},#{info.maId},#{many},#{info.startTime},#{info.status},#{info.leaseId},#{info.leasePrice},#{info.buyPrice},'0',#{info.companyId},#{info.leaseType},now());
|
||||
insert into clz_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,source)
|
||||
values (#{info.agreementId},#{info.typeId},#{info.maId},#{many},#{info.startTime},#{info.status},#{info.leaseId},#{info.leasePrice},#{info.buyPrice},'0',#{info.companyId},#{info.leaseType},now(),#{info.source});
|
||||
</insert>
|
||||
|
||||
<select id="selectBackApplyInfoList" resultType="com.bonus.material.clz.domain.back.MaterialBackApplyInfo">
|
||||
|
|
@ -942,5 +942,34 @@
|
|||
AND dfs.id = #{externalId}
|
||||
AND su.nick_name = #{createBy}
|
||||
</select>
|
||||
<select id="getClzInfo" resultType="com.bonus.material.settlement.domain.SltAgreementInfo">
|
||||
SELECT
|
||||
id AS id,
|
||||
agreement_id AS agreementId,
|
||||
type_id AS typeId,
|
||||
ma_id AS maId,
|
||||
num AS backNum,
|
||||
start_time AS startTime,
|
||||
end_time AS endTime,
|
||||
status AS status,
|
||||
lease_id AS leaseId,
|
||||
lease_type AS leaseType,
|
||||
back_id AS backId,
|
||||
lease_price AS leasePrice,
|
||||
buy_price AS buyPrice,
|
||||
company_id AS companyId,
|
||||
lease_style AS leaseStyle
|
||||
FROM
|
||||
clz_slt_agreement_info
|
||||
WHERE
|
||||
status = 0
|
||||
and source = '2'
|
||||
AND agreement_id = #{agreementId}
|
||||
AND type_id = #{typeId}
|
||||
<if test="maId != null">
|
||||
AND ma_id = #{maId}
|
||||
</if>
|
||||
order by start_time asc
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -1651,6 +1651,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="departIdList != null and departIdList.size() > 0">
|
||||
AND sp.id in
|
||||
<foreach item="item" collection="departIdList" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="impUnit != null and impUnit != ''">
|
||||
AND bp.imp_unit = #{impUnit}
|
||||
</if>
|
||||
|
|
@ -2017,18 +2023,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
subquery1.externalId AS externalId,
|
||||
subquery1.impUnit AS impUnit,
|
||||
subquery3.idCard AS idCard,
|
||||
CASE
|
||||
WHEN subquery1.typeId = 36 THEN
|
||||
GREATEST(IFNULL(subquery1.usNum, 0) - IFNULL(subquery3.usNum, 0), 0)
|
||||
ELSE
|
||||
0
|
||||
END AS storeNum,
|
||||
CASE
|
||||
WHEN subquery1.typeId = 36 THEN
|
||||
IFNULL(subquery3.usNum, 0)
|
||||
ELSE
|
||||
IFNULL(subquery1.usNum, 0)
|
||||
END AS useNum,
|
||||
GREATEST(IFNULL(subquery1.useNum, 0) - IFNULL(subquery3.useNum, 0), 0) AS storeNum,
|
||||
IFNULL(subquery3.useNum, 0) AS useNum,
|
||||
IFNULL(subquery1.supplyNum, 0) AS supplyNum,
|
||||
IFNULL(subquery1.backNum, 0) AS backNum,
|
||||
subquery1.proCenter AS departName,
|
||||
|
|
@ -2058,7 +2054,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
mt2.type_name AS typeName,
|
||||
mt2.type_id AS thirdTypeId,
|
||||
mt.type_name AS typeModelName,
|
||||
SUM(CASE WHEN sai.`status` = '0' THEN IFNULL(sai.num, 0) ELSE 0 END) AS usNum,
|
||||
SUM(CASE WHEN sai.`status` = '0' THEN IFNULL(sai.num, 0) ELSE 0 END) AS useNum,
|
||||
SUM(CASE WHEN sai.`status` = '1' THEN IFNULL(sai.num, 0) ELSE 0 END) AS backNum,
|
||||
SUM(IFNULL( sai.num, 0 )) AS supplyNum,
|
||||
bp.pro_name as proName,
|
||||
|
|
@ -2068,8 +2064,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
bu.bzz_idcard AS idCard,
|
||||
df.project_dept AS proCenter,
|
||||
sd.dept_name AS departName,
|
||||
GROUP_CONCAT(DISTINCT sai.agreement_id) AS agreementId,
|
||||
bu.type_id AS typeId
|
||||
GROUP_CONCAT(DISTINCT sai.agreement_id) AS agreementId
|
||||
FROM
|
||||
slt_agreement_info sai
|
||||
LEFT JOIN ma_type mt ON mt.type_id = sai.type_id
|
||||
|
|
@ -2137,7 +2132,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
mt2.type_name AS typeName,
|
||||
mt2.type_id AS thirdTypeId,
|
||||
mt.type_name AS typeModelName,
|
||||
SUM(IFNULL( sai.num, 0 )) AS usNum,
|
||||
SUM(IFNULL( sai.num, 0 )) AS useNum,
|
||||
bp.pro_name as proName,
|
||||
bp.pro_id as proId,
|
||||
bp.external_id as externalId,
|
||||
|
|
@ -2210,21 +2205,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
LEFT JOIN ma_type mt4 ON mt4.type_id = mt3.parent_id
|
||||
WHERE mt.`level` = 4 and mt.del_flag = '0'
|
||||
AND subquery1.proName IS NOT NULL
|
||||
AND (
|
||||
IFNULL(subquery1.usNum, 0) > 0
|
||||
OR (
|
||||
CASE
|
||||
WHEN subquery1.typeId = 36 THEN GREATEST(IFNULL(subquery1.usNum, 0) - IFNULL(subquery3.usNum, 0), 0)
|
||||
ELSE IFNULL(subquery3.usNum, 0)
|
||||
END
|
||||
) > 0
|
||||
OR (
|
||||
CASE
|
||||
WHEN subquery1.typeId = 36 THEN IFNULL(subquery3.usNum, 0)
|
||||
ELSE IFNULL(subquery1.usNum, 0)
|
||||
END
|
||||
) > 0
|
||||
)
|
||||
GROUP BY
|
||||
subquery1.proId,
|
||||
mt.type_id
|
||||
|
|
@ -2674,6 +2654,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
LEFT JOIN data_center.dx_fb_son df ON bp.external_id = df.id
|
||||
WHERE
|
||||
sai.is_slt = '0'
|
||||
AND bu.type_id in (32, 33, 36)
|
||||
AND bp.external_id IS NOT NULL
|
||||
AND sd.dept_id not in (342,345,347,348,101,344)
|
||||
AND bp.pro_id not in (3414,1192,3321,3595)
|
||||
<if test="impUnitName != null and impUnitName != ''">
|
||||
AND sd.dept_name = #{impUnitName}
|
||||
</if>
|
||||
|
|
@ -2720,4 +2704,84 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
GROUP BY
|
||||
sai.id
|
||||
</select>
|
||||
|
||||
<select id="getSubNumList" resultType="com.bonus.material.clz.domain.vo.MaterialProvideNumInfo">
|
||||
SELECT
|
||||
mt.type_id AS typeId,
|
||||
mt4.type_name AS constructionType,
|
||||
mt4.type_id AS firstTypeId,
|
||||
mt3.type_name AS materialType,
|
||||
mt3.type_id AS secondTypeId,
|
||||
mt2.type_name AS typeName,
|
||||
mt2.type_id AS thirdTypeId,
|
||||
mt.type_name AS typeModelName,
|
||||
SUM(CASE WHEN sai.`status` = '0' THEN IFNULL(sai.num, 0) ELSE 0 END) AS useNum,
|
||||
SUM(CASE WHEN sai.`status` = '1' THEN IFNULL(sai.num, 0) ELSE 0 END) AS backNum,
|
||||
SUM(IFNULL( sai.num, 0 )) AS supplyNum,
|
||||
bp.pro_name as proName,
|
||||
bp.pro_id as proId,
|
||||
bp.external_id as externalId,
|
||||
bp.imp_unit AS impUnit,
|
||||
bu.bzz_idcard AS idCard,
|
||||
df.project_dept AS proCenter,
|
||||
sd.dept_name AS departName,
|
||||
GROUP_CONCAT(DISTINCT sai.agreement_id) AS agreementId
|
||||
FROM
|
||||
slt_agreement_info sai
|
||||
LEFT JOIN ma_type mt ON mt.type_id = sai.type_id
|
||||
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
|
||||
LEFT JOIN ma_type mt3 ON mt3.type_id = mt2.parent_id
|
||||
LEFT JOIN ma_type mt4 ON mt4.type_id = mt3.parent_id
|
||||
LEFT JOIN bm_agreement_info bai ON sai.agreement_id = bai.agreement_id
|
||||
LEFT JOIN bm_project bp ON bai.project_id = bp.pro_id
|
||||
LEFT JOIN bm_unit bu ON bai.unit_id = bu.unit_id
|
||||
AND bu.del_flag = '0'
|
||||
LEFT JOIN sys_dept sd ON sd.dept_id = bp.imp_unit
|
||||
LEFT JOIN data_center.dx_fb_son df ON bp.external_id = df.id
|
||||
WHERE
|
||||
sai.is_slt = '0'
|
||||
AND bp.external_id IS NOT NULL
|
||||
and bp.pro_id not in (3414,1192,3321,3595)
|
||||
and bp.pro_center IS NOT NULL
|
||||
and bu.type_id in (32,33)
|
||||
<if test="impUnitName != null and impUnitName != ''">
|
||||
AND sd.dept_name = #{impUnitName}
|
||||
</if>
|
||||
<if test="proName != null and proName != ''">
|
||||
AND bp.pro_name = #{proName}
|
||||
</if>
|
||||
<if test="departName != null and departName != ''">
|
||||
AND bp.pro_center = #{departName}
|
||||
</if>
|
||||
<if test="typeName != null and typeName != ''">
|
||||
AND mt2.type_name = #{typeName}
|
||||
</if>
|
||||
<if test="typeModelName != null and typeModelName != ''">
|
||||
AND mt.type_name = #{typeModelName}
|
||||
</if>
|
||||
<if test="projectIdList != null and projectIdList.size() > 0">
|
||||
AND bp.external_id in
|
||||
<foreach item="item" collection="projectIdList" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="impUnit != null and impUnit != ''">
|
||||
AND bp.imp_unit = #{impUnit}
|
||||
</if>
|
||||
<if test="jiJuType != null and jiJuType != ''">
|
||||
AND mt.jiju_type = #{jiJuType}
|
||||
</if>
|
||||
<if test="keyWord != null and keyWord != ''">
|
||||
AND (
|
||||
mt2.type_name like concat('%', #{keyWord}, '%') or
|
||||
mt.type_name like concat('%', #{keyWord}, '%') or
|
||||
bp.pro_name like concat('%', #{keyWord}, '%')
|
||||
)
|
||||
</if>
|
||||
<if test="unitValue != null and unitValue != ''">
|
||||
AND mt.unit_value = #{unitValue}
|
||||
</if>
|
||||
GROUP BY mt.type_id,
|
||||
bp.pro_id
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -1291,4 +1291,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
WHERE
|
||||
lai.id = #{leaseId}
|
||||
</select>
|
||||
|
||||
<select id="selectProjectUnitAgreementIdByTeamAndProject" resultType="java.lang.Long">
|
||||
SELECT
|
||||
baii.agreement_id AS projectUnitAgreementId
|
||||
FROM
|
||||
bm_agreement_info bai
|
||||
LEFT JOIN bm_agreement_info baii ON baii.unit_id = bai.project_unit_id AND baii.project_id = #{projectId}
|
||||
AND baii.status = '1'
|
||||
WHERE
|
||||
bai.unit_id = #{teamId} AND bai.project_id = #{projectId}
|
||||
LIMIT 1
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -447,7 +447,7 @@
|
|||
rad.level as level
|
||||
from repair_apply_details rad
|
||||
left join tm_task tt on rad.task_id = tt.task_id
|
||||
where rad.task_id = #{taskId}
|
||||
where rad.task_id = #{taskId} and tt.task_status = 0
|
||||
and rad.is_ds = 1
|
||||
</select>
|
||||
|
||||
|
|
|
|||
|
|
@ -177,7 +177,9 @@
|
|||
dai.lease_man AS leaseMan,
|
||||
dai.lease_phone AS leasePhone,
|
||||
dai.dir_url AS dirUrl,
|
||||
dai.`status`
|
||||
dai.`status`,
|
||||
bpl.external_id AS backExternalId,
|
||||
bpl1.external_id AS leaseExternalId
|
||||
FROM
|
||||
direct_apply_info dai
|
||||
LEFT JOIN direct_apply_details dad ON dai.id = dad.direct_id
|
||||
|
|
@ -407,4 +409,23 @@
|
|||
GROUP BY
|
||||
da.back_agreement_id, dad.type_id, dad.ma_id, da.id;
|
||||
</select>
|
||||
|
||||
<select id="getDeptInfo" resultType="com.bonus.material.ma.domain.DirectApplyInfo">
|
||||
SELECT DISTINCT
|
||||
df.project_dept AS leaseDepartName,
|
||||
sd.dept_name AS leaseImpUnitName
|
||||
FROM
|
||||
bm_project bp
|
||||
LEFT JOIN sys_dept sd ON sd.dept_id = bp.imp_unit
|
||||
LEFT JOIN data_center.dx_fb_son df ON bp.external_id = df.id
|
||||
WHERE
|
||||
bp.pro_center IS NOT NULL
|
||||
AND bp.external_id IS NOT NULL
|
||||
AND bp.pro_id NOT IN ( 3414, 1192, 3321, 3595 )
|
||||
AND bp.external_id = #{leaseExternalId}
|
||||
AND bp.del_flag = '0'
|
||||
GROUP BY
|
||||
bp.pro_name
|
||||
LIMIT 1
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -341,6 +341,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="keeperUserId != null">keep_user_id = #{keeperUserId},</if>
|
||||
<if test="isCheck != null and isCheck != ''">is_check = #{isCheck},</if>
|
||||
<if test="jiJuType != null and jiJuType != ''">jiJu_type = #{jiJuType},</if>
|
||||
<if test="qualifiedName != null and qualifiedName != ''">qualified_name = #{qualifiedName},</if>
|
||||
<if test="qualifiedUrl != null and qualifiedUrl != ''">qualified_url = #{qualifiedUrl},</if>
|
||||
<if test="testReportName != null and testReportName != ''">test_report_name = #{testReportName},</if>
|
||||
<if test="testReportUrl != null and testReportUrl != ''">test_report_url = #{testReportUrl},</if>
|
||||
<if test="factoryReportName != null and factoryReportName != ''">factory_report_name = #{factoryReportName},</if>
|
||||
<if test="factoryReportUrl != null and factoryReportUrl != ''">factory_report_url = #{factoryReportUrl},</if>
|
||||
<if test="thirdReportName != null and thirdReportName != ''">third_report_name = #{thirdReportName},</if>
|
||||
<if test="thirdReportUrl != null and thirdReportUrl != ''">third_report_url = #{thirdReportUrl},</if>
|
||||
<if test="otherReportName != null and otherReportName != ''">other_report_name = #{otherReportName},</if>
|
||||
<if test="otherReportUrl != null and otherReportUrl != ''">other_report_url = #{otherReportUrl},</if>
|
||||
</trim>
|
||||
where type_id = #{typeId}
|
||||
</update>
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
LEFT JOIN slt_agreement_apply saa ON saa.agreement_id = bma.agreement_id AND saa.`status` = '2' AND saa.settlement_type = 1
|
||||
LEFT JOIN slt_agreement_apply saas ON saas.agreement_id = bma.agreement_id AND saas.`status` = '2' AND saas.settlement_type = 2
|
||||
<where>
|
||||
bp.external_id is not null and bu.unit_id not in (117,4055)
|
||||
<if test="agreementCode != null and agreementCode != ''">
|
||||
AND bma.agreement_code LIKE CONCAT('%',#{agreementCode},'%')
|
||||
</if>
|
||||
|
|
|
|||
|
|
@ -126,6 +126,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
month(create_time) = #{month} and year(create_time) = #{year}
|
||||
<if test="taskType != null and taskType !=''">
|
||||
and task_type = #{taskType}
|
||||
<if test="taskType == 2">
|
||||
and `code` NOT LIKE concat('%', 'ZL', '%')
|
||||
</if>
|
||||
<if test="taskType == 3">
|
||||
and `code` NOT LIKE concat('%', 'ZT', '%')
|
||||
</if>
|
||||
</if>
|
||||
</select>
|
||||
|
||||
|
|
@ -334,5 +340,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
GROUP BY
|
||||
type_id
|
||||
</select>
|
||||
<select id="getMonthMaxOrderByDateTwo" resultType="java.lang.Integer">
|
||||
select COALESCE(max(month_order), 0) from tm_task
|
||||
where
|
||||
month(create_time) = #{month} and year(create_time) = #{year}
|
||||
<if test="taskType != null and taskType !=''">
|
||||
and task_type = #{taskType}
|
||||
<if test="taskType == 2">
|
||||
and `code` LIKE concat('%', 'ZL', '%')
|
||||
</if>
|
||||
<if test="taskType == 3">
|
||||
and `code` LIKE concat('%', 'ZT', '%')
|
||||
</if>
|
||||
</if>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
|
|||
Binary file not shown.
|
After Width: | Height: | Size: 33 KiB |
Loading…
Reference in New Issue