diff --git a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/controller/BackReceiveController.java b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/controller/BackReceiveController.java index 4fa5a064..615bd1f0 100644 --- a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/controller/BackReceiveController.java +++ b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/controller/BackReceiveController.java @@ -1,7 +1,9 @@ package com.bonus.sgzb.app.controller; import com.bonus.sgzb.app.domain.BackApplyInfo; +import com.bonus.sgzb.app.domain.TmTask; import com.bonus.sgzb.app.service.*; +import com.bonus.sgzb.common.core.utils.poi.ExcelUtil; import com.bonus.sgzb.common.core.web.controller.BaseController; import com.bonus.sgzb.common.core.web.domain.AjaxResult; import com.bonus.sgzb.common.log.annotation.Log; @@ -9,6 +11,7 @@ import com.bonus.sgzb.common.log.enums.BusinessType; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; import java.util.List; /** @@ -46,6 +49,19 @@ public class BackReceiveController extends BaseController { } } + /** + * 导出 + * + * @param record 查询条件 + * @return + */ + @PostMapping("export") + public void export(HttpServletResponse response, BackApplyInfo record) { + List list = backReceiveService.getbackReceiveList(record); + ExcelUtil util = new ExcelUtil(BackApplyInfo.class); + util.exportExcel(response, list, "领料接收数据"); + } + /** * 退料接收明细 @@ -197,7 +213,33 @@ public class BackReceiveController extends BaseController { } } - @Log(title = "退料接收记录", businessType = BusinessType.INSERT) + @Log(title = "编码接收机具查询-web", businessType = BusinessType.INSERT) + @GetMapping("getBackMachine") + public AjaxResult getBackMachine(TmTask task) { + try { + startPage(); + List list = backReceiveService.getBackMachine(task); + return AjaxResult.success(getDataTable(list)); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + @Log(title = "查询退料接收记录-web", businessType = BusinessType.INSERT) + @GetMapping("getRecord") + public AjaxResult getRecord(TmTask task) { + try { + List list = backReceiveService.getRecord(task); + if (list.size() == 0) { + return AjaxResult.error("您还未退料数据"); + } + return AjaxResult.success(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + @Log(title = "退料接收记录-app", businessType = BusinessType.INSERT) @PostMapping("backReceiveRecord") public AjaxResult backReceiveRecord(@RequestBody BackApplyInfo record) { try { @@ -207,4 +249,16 @@ public class BackReceiveController extends BaseController { throw new RuntimeException(e); } } + + @Log(title = "退料接收记录-web", businessType = BusinessType.INSERT) + @PostMapping("backReceiveRecordWeb") + public AjaxResult backReceiveRecordWeb(@RequestBody BackApplyInfo record) { + try { + startPage(); + List list = backReceiveService.backReceiveRecord(record); + return AjaxResult.success(getDataTable(list)); + } catch (Exception e) { + throw new RuntimeException(e); + } + } } diff --git a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/domain/BackApplyInfo.java b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/domain/BackApplyInfo.java index a263104f..372e5823 100644 --- a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/domain/BackApplyInfo.java +++ b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/domain/BackApplyInfo.java @@ -1,5 +1,6 @@ package com.bonus.sgzb.app.domain; +import com.bonus.sgzb.common.core.annotation.Excel; import io.swagger.models.auth.In; import lombok.Data; @@ -19,17 +20,24 @@ public class BackApplyInfo { * 退料人 */ private String userName; + private String badId; + + @Excel(name = "退料状态",sort = 9) + private String taskName; /** * 联系人 */ + @Excel(name = "联系电话",sort = 6) private String phone; /** * 工程名称 */ + @Excel(name = "退料工程",sort = 3) private String lotName; /** * 单位名称 */ + @Excel(name = "退料单位",sort = 2) private String unitName; /** * 开始时间 @@ -51,10 +59,12 @@ public class BackApplyInfo { /** * 类型名称 */ + @Excel(name = "退料机具",sort = 4) private String typeName; /** * 协议号 */ + @Excel(name = "协议号",sort = 8) private String agreementCode; /** * 规格编号 @@ -90,10 +100,13 @@ public class BackApplyInfo { * 审核备注 */ private String directAuditRemark; + @Excel(name = "退料单号",sort = 1) private String code; + @Excel(name = "退料人员",sort = 5) private String backPerson; private String lotId; private String unitId; + @Excel(name = "申请时间",sort = 7) private String backTime; private Integer maId; /** diff --git a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/domain/LeaseApplyInfo.java b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/domain/LeaseApplyInfo.java index a5a91562..48d887f4 100644 --- a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/domain/LeaseApplyInfo.java +++ b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/domain/LeaseApplyInfo.java @@ -1,6 +1,7 @@ package com.bonus.sgzb.app.domain; import com.alibaba.fastjson2.annotation.JSONField; +import com.bonus.sgzb.common.core.annotation.Excel; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; diff --git a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/domain/TmTaskVo.java b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/domain/TmTaskVo.java index f33168af..57692667 100644 --- a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/domain/TmTaskVo.java +++ b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/domain/TmTaskVo.java @@ -24,194 +24,200 @@ public class TmTaskVo implements Serializable { /** * 任务ID */ - @ApiModelProperty(value="任务ID") + @ApiModelProperty(value = "任务ID") private Long taskId; /** * 任务类型(定义数据字典) */ - @ApiModelProperty(value="任务类型(数据字典)") + @ApiModelProperty(value = "任务类型(数据字典)") private Integer taskType; /** * 任务状态(定义数据字典) */ - @ApiModelProperty(value="任务状态(数据字典)") + @ApiModelProperty(value = "任务状态(数据字典)") private Integer taskStatus; /** * 预领料合计数 */ - @ApiModelProperty(value="预领料合计数") + @ApiModelProperty(value = "预领料合计数") private int preCountNum; /** * 编号 */ - @ApiModelProperty(value="编号") - @Excel(name = "领料单号",sort = 1) + @ApiModelProperty(value = "编号") + @Excel(name = "领料单号", sort = 1) private String code; /** * 创建者 */ - @ApiModelProperty(value="创建者") + @ApiModelProperty(value = "创建者") private String createBy; /** * 申请人手机号码 */ - @ApiModelProperty(value="手机号") + @ApiModelProperty(value = "手机号") private String phoneNumber; /** * 部门名称 单位名称 */ - @ApiModelProperty(value="部门/单位名称") + @ApiModelProperty(value = "部门/单位名称") private String deptName; + /** + * 领用类型 + */ + @ApiModelProperty(value = "领料类型") + @Excel(name = "领料类型", sort = 12, readConverterExp = "0=短期租赁,1=长期租赁") + private String leaseType; /** * 工程名称 */ - @ApiModelProperty(value="工程名称") - @Excel(name = "领料工程",sort = 3) + @ApiModelProperty(value = "工程名称") + @Excel(name = "领料工程", sort = 3) private String proName; /** * 创建时间 */ - @ApiModelProperty(value="创建时间") - @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "创建时间") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") private Date createTime; /** * 更新者 */ - @ApiModelProperty(value="更新者") + @ApiModelProperty(value = "更新者") private String updateBy; /** * 更新时间 */ - @ApiModelProperty(value="更新时间") - @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "更新时间") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") private Date updateTime; /** * 备注 */ - @ApiModelProperty(value="备注") - @Excel(name = "备注",sort = 11) + @ApiModelProperty(value = "备注") + @Excel(name = "备注", sort = 11) private String remark; /** * 数据所属组织 */ - @ApiModelProperty(value="数据所属组织") + @ApiModelProperty(value = "数据所属组织") private Integer companyId; /** * 领料任务实体 */ - @ApiModelProperty(value="领料任务实体") + @ApiModelProperty(value = "领料任务实体") private LeaseApplyInfo leaseApplyInfo; /** * 领料任务实体集合 */ - @ApiModelProperty(value="领料任务实体集合") + @ApiModelProperty(value = "领料任务实体集合") private List leaseApplyInfoList; /** * 领料任务详情集合 */ - @ApiModelProperty(value="领料任务详情集合") - private List leaseApplyDetails; + @ApiModelProperty(value = "领料任务详情集合") + private List leaseApplyDetails; - @ApiModelProperty(value="协议id") + @ApiModelProperty(value = "协议id") private Integer agreementId; - @ApiModelProperty(value="退料人") + @ApiModelProperty(value = "退料人") private String backPerson; - @ApiModelProperty(value="退料人联系电话") + @ApiModelProperty(value = "退料人联系电话") private String phone; - @ApiModelProperty(value="退料申请时间") + @ApiModelProperty(value = "退料申请时间") private String backTime; - @ApiModelProperty(value="退料审核人 机具分公司审批人") + @ApiModelProperty(value = "退料审核人 机具分公司审批人") private String directAuditBy; - @ApiModelProperty(value="退料审核时间 机具分公司审批时间") + @ApiModelProperty(value = "退料审核时间 机具分公司审批时间") private String directAuditTime; - @ApiModelProperty(value="退料审核备注 机具分公司审批备注") + @ApiModelProperty(value = "退料审核备注 机具分公司审批备注") private String directAuditRemark; - @ApiModelProperty(value="往来单位id") + @ApiModelProperty(value = "往来单位id") private Long unitId; - @ApiModelProperty(value="往来单位") - @Excel(name = "领料单位",sort = 2) + @ApiModelProperty(value = "往来单位") + @Excel(name = "领料单位", sort = 2) private String unitName; - @ApiModelProperty(value="工程id") + @ApiModelProperty(value = "工程id") private Long projectId; - @ApiModelProperty(value="关键字") + @ApiModelProperty(value = "关键字") private String keyWord; - @ApiModelProperty(value="开始时间") + @ApiModelProperty(value = "开始时间") private String startTime; - @ApiModelProperty(value="结束时间") + @ApiModelProperty(value = "结束时间") private String endTime; - @ApiModelProperty(value="类型") + @ApiModelProperty(value = "类型") private Integer types; - @ApiModelProperty(value="协议编号") - @Excel(name = "协议号",sort = 4) + @ApiModelProperty(value = "协议编号") + @Excel(name = "协议号", sort = 4) private String agreementCode; - @ApiModelProperty(value="领料人") - @Excel(name = "领料人",sort = 5) + @ApiModelProperty(value = "领料人") + @Excel(name = "领料人", sort = 5) private String leasePerson; - @ApiModelProperty(value="领料人手机号") - @Excel(name = "联系电话",sort = 6) + @ApiModelProperty(value = "领料人手机号") + @Excel(name = "联系电话", sort = 6) private String leasePhone; - @ApiModelProperty(value="申请人") - @Excel(name = "申请人",sort = 7) + @ApiModelProperty(value = "申请人") + @Excel(name = "申请人", sort = 7) private String applyFor; - @ApiModelProperty(value="任务状态") - @Excel(name = "任务状态",sort = 9) + @ApiModelProperty(value = "任务状态") + @Excel(name = "任务状态", sort = 9) private String taskName; - @ApiModelProperty(value="审批状态id") + @ApiModelProperty(value = "审批状态id") private String examineStatusId; - @ApiModelProperty(value="审批状态的备注") + @ApiModelProperty(value = "审批状态的备注") private String examineStatus; - @ApiModelProperty(value="创建时间") - @Excel(name = "申请时间",sort = 8) + @ApiModelProperty(value = "创建时间") + @Excel(name = "申请时间", sort = 8) private String createTimes; - @ApiModelProperty(value="更新时间") + @ApiModelProperty(value = "更新时间") private String updateTimes; - @ApiModelProperty(value="公司审批人") + @ApiModelProperty(value = "公司审批人") private String companyAuditBy; - @ApiModelProperty(value="公司审批时间") + @ApiModelProperty(value = "公司审批时间") private String companyAuditTime; - @ApiModelProperty(value="公司审批备注") + @ApiModelProperty(value = "公司审批备注") private String companyAuditRemark; - @ApiModelProperty(value="分管审批人") + @ApiModelProperty(value = "分管审批人") private String deptAuditBy; - @ApiModelProperty(value="分管审批时间") + @ApiModelProperty(value = "分管审批时间") private String deptAuditTime; - @ApiModelProperty(value="分管审批备注") + @ApiModelProperty(value = "分管审批备注") private String deptAuditRemark; } diff --git a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/mapper/BackReceiveMapper.java b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/mapper/BackReceiveMapper.java index 98b5eef4..3856fff4 100644 --- a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/mapper/BackReceiveMapper.java +++ b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/mapper/BackReceiveMapper.java @@ -1,6 +1,7 @@ package com.bonus.sgzb.app.mapper; import com.bonus.sgzb.app.domain.BackApplyInfo; +import com.bonus.sgzb.app.domain.TmTask; import com.bonus.sgzb.base.api.domain.SltAgreementInfo; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -185,4 +186,8 @@ public interface BackReceiveMapper { int insStlInfoTwo(@Param("info")SltAgreementInfo info, @Param("many")Double many); List getAllList(BackApplyInfo record); + + List getBackMachine(TmTask task); + + List getRecord(TmTask task); } \ No newline at end of file diff --git a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/BackReceiveService.java b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/BackReceiveService.java index 29c68c56..adeeef75 100644 --- a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/BackReceiveService.java +++ b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/BackReceiveService.java @@ -1,6 +1,7 @@ package com.bonus.sgzb.app.service; import com.bonus.sgzb.app.domain.BackApplyInfo; +import com.bonus.sgzb.app.domain.TmTask; import java.util.List; @@ -88,4 +89,8 @@ public interface BackReceiveService { * @return int */ int setRfidCodeBack(BackApplyInfo record); + + List getBackMachine(TmTask task); + + List getRecord(TmTask task); } diff --git a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/impl/BackReceiveServiceImpl.java b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/impl/BackReceiveServiceImpl.java index 8c9001b0..ac680056 100644 --- a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/impl/BackReceiveServiceImpl.java +++ b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/impl/BackReceiveServiceImpl.java @@ -1,6 +1,7 @@ package com.bonus.sgzb.app.service.impl; import com.bonus.sgzb.app.domain.BackApplyInfo; +import com.bonus.sgzb.app.domain.TmTask; import com.bonus.sgzb.app.mapper.BackReceiveMapper; import com.bonus.sgzb.app.service.BackReceiveService; import com.bonus.sgzb.base.api.domain.SltAgreementInfo; @@ -16,10 +17,10 @@ import java.util.Date; import java.util.List; /** -* @description 退料申请--app -* @author hay -* @date 2024/1/22 11:16 -*/ + * @author hay + * @description 退料申请--app + * @date 2024/1/22 11:16 + */ @Service public class BackReceiveServiceImpl implements BackReceiveService { @@ -42,16 +43,20 @@ public class BackReceiveServiceImpl implements BackReceiveService { @Transactional(rollbackFor = Exception.class) public int setNumBack(BackApplyInfo record) { int res; - try{ + try { int taskId = record.getTaskId(); //修改任务状态 - res= updateTaskStatus(taskId,39); + res = updateTaskStatus(taskId, 39); //插入back_check_details - res = insertBcd(record); - if(res == 0) { - throw new RuntimeException("插入back_check_details异常"); - } - }catch (Exception e){ + res = insertBcd(record); + if (res == 0) { + throw new RuntimeException("插入back_check_details异常"); + } + /* int insSltInfoNum = insSltInfo(lTask.getAgreementId().toString(), leaseOutDetail); + if (insSltInfoNum < 1) { + return res; + }*/ + } catch (Exception e) { throw new RuntimeException(e.getMessage()); } @@ -60,41 +65,41 @@ public class BackReceiveServiceImpl implements BackReceiveService { private int updateTaskStatus(int taskId, int i) { int res; - res=backReceiveMapper.updateTaskStatus(taskId,i); + res = backReceiveMapper.updateTaskStatus(taskId, i); return res; } @Override @Transactional(rollbackFor = Exception.class) public int setCodeBack(BackApplyInfo record) { - int res=0; - try{ + int res = 0; + try { BackApplyInfo[] arr = record.getArr(); - if (arr.length>0){ - for (int i=0;i< arr.length;i++){ + if (arr.length > 0) { + for (int i = 0; i < arr.length; i++) { //根据maId和taskId查询是否已接收 - int re = backReceiveMapper.selectCodeByMaIdAndTaskId(arr[i].getMaId(),record.getTaskId()); - if (re>0){ - res=-1; + int re = backReceiveMapper.selectCodeByMaIdAndTaskId(arr[i].getMaId(), record.getTaskId()); + if (re > 0) { + res = -1; break; } } - if (res==-1){ + if (res == -1) { return res; } } int taskId = record.getTaskId(); //修改任务状态 - res= updateTaskStatus(taskId,39); - if(res == 0) { + res = updateTaskStatus(taskId, 39); + if (res == 0) { throw new RuntimeException("插入back_check_details异常"); } //插入back_check_details res = insertBcd(record); - if(res == 0) { + if (res == 0) { throw new RuntimeException("插入back_check_details异常"); } - }catch (Exception e){ + } catch (Exception e) { throw new RuntimeException(e.getMessage()); } return res; @@ -104,87 +109,87 @@ public class BackReceiveServiceImpl implements BackReceiveService { @Transactional(rollbackFor = Exception.class) public int endBack(BackApplyInfo record) { int res; - try{ + try { int taskId = record.getTaskId(); //修改任务状态 - res= updateTaskStatus(taskId,40); - if(res == 0) { + res = updateTaskStatus(taskId, 40); + if (res == 0) { throw new RuntimeException("tm_task修改状态"); } //更加退料接收的数据创建下一步流程 //合格的插入入库记录input_apply_details,修改库存ma_type,修改机具状态 List hgList = backReceiveMapper.getHgList(record); - if(hgList!=null && hgList.size()>0){ + if (hgList != null && hgList.size() > 0) { res = insertIad(hgList); - if(res == 0) { + if (res == 0) { throw new RuntimeException("input_apply_details"); } res = updateMt(hgList); - if(res == 0) { + if (res == 0) { throw new RuntimeException("ma_type"); } res = updateMaStatus(hgList); - if(res == 0) { + if (res == 0) { throw new RuntimeException("ma_machines"); } } //维修的创建维修任务,插入任务协议表 List wxList = backReceiveMapper.getWxList(record); - if(wxList!=null && wxList.size()>0){ + if (wxList != null && wxList.size() > 0) { //插入任务表tm_task - int newTaskId = insertTt(wxList,41,record.getCreateBy()); + int newTaskId = insertTt(wxList, 41, record.getCreateBy()); //插入协议任务表tm_task_agreement - res = insertTta(newTaskId,wxList); + res = insertTta(newTaskId, wxList); //插入维修记录表repair_apply_details - res = insertRad(newTaskId,wxList); + res = insertRad(newTaskId, wxList); } //待报废的创建报废任务,插入任务协议表 List bfList = backReceiveMapper.getBfList(record); - if(bfList!=null && bfList.size()>0){ + if (bfList != null && bfList.size() > 0) { //插入任务表tm_task - int newTaskId = insertTt(bfList,57,record.getCreateBy()); + int newTaskId = insertTt(bfList, 57, record.getCreateBy()); //插入协议任务表tm_task_agreement - res = insertTta(newTaskId,bfList); + res = insertTta(newTaskId, bfList); //插入维修记录表scrap_apply_details - res = insertSad(newTaskId,bfList); + res = insertSad(newTaskId, bfList); } List allList = backReceiveMapper.getAllList(record); - if(allList!=null && allList.size()>0){ - res = updateSlt(record,allList); - if(res == 0) { + if (allList != null && allList.size() > 0) { + res = updateSlt(record, allList); + if (res == 0) { throw new RuntimeException("slt_agreement_info"); } } - }catch (Exception e){ + } catch (Exception e) { throw new RuntimeException(e.getMessage()); } return res; } private int updateSlt(BackApplyInfo record, List hgList) { - for (BackApplyInfo bean : hgList){ + for (BackApplyInfo bean : hgList) { List infoList = backReceiveMapper.getStlInfo(bean); - if (infoList.size() > 0){ + if (infoList.size() > 0) { Double backNum = Double.valueOf(bean.getBackNum()); - for (SltAgreementInfo info : infoList){ + for (SltAgreementInfo info : infoList) { Double num = Double.valueOf(info.getNum()); - if (backNum.equals(num)){ - backReceiveMapper.updateStlInfo(info,record); + if (backNum.equals(num)) { + backReceiveMapper.updateStlInfo(info, record); break; } else if (backNum > num) { backNum = backNum - num; - backReceiveMapper.updateStlInfo(info,record); + backReceiveMapper.updateStlInfo(info, record); } else if (backNum < num) { Double many = num - backNum; - backReceiveMapper.updateStlInfoTwo(info,record,backNum); - backReceiveMapper.insStlInfoTwo(info,many); + backReceiveMapper.updateStlInfoTwo(info, record, backNum); + backReceiveMapper.insStlInfoTwo(info, many); break; } } - }else { + } else { return 0; } } @@ -213,43 +218,53 @@ public class BackReceiveServiceImpl implements BackReceiveService { @Override public int setRfidCodeBack(BackApplyInfo record) { - int res=0; - try{ + int res = 0; + try { BackApplyInfo[] arr = record.getArr(); - if (arr.length>0){ - for (int i=0;i< arr.length;i++){ + if (arr.length > 0) { + for (int i = 0; i < arr.length; i++) { //根据maId和taskId查询是否已接收 - int re = backReceiveMapper.selectCodeByMaIdAndTaskId(arr[i].getMaId(),record.getTaskId()); - if (re>0){ - res=-1; + int re = backReceiveMapper.selectCodeByMaIdAndTaskId(arr[i].getMaId(), record.getTaskId()); + if (re > 0) { + res = -1; break; } } - if (res==-1){ + if (res == -1) { return res; } } int taskId = record.getTaskId(); //修改任务状态 - res= updateTaskStatus(taskId,39); - if(res == 0) { + res = updateTaskStatus(taskId, 39); + if (res == 0) { throw new RuntimeException("插入back_check_details异常"); } //插入back_check_details res = insertBcd(record); - if(res == 0) { + if (res == 0) { throw new RuntimeException("插入back_check_details异常"); } - }catch (Exception e){ + } catch (Exception e) { throw new RuntimeException(e.getMessage()); } return res; } + @Override + public List getBackMachine(TmTask task) { + return backReceiveMapper.getBackMachine(task); + } + + @Override + public List getRecord(TmTask task) { + return backReceiveMapper.getRecord(task); + } + private int insertRad(int taskId, List wxList) { int result = 0; - if(wxList !=null){ - for( BackApplyInfo wx : wxList ){ + if (wxList != null) { + for (BackApplyInfo wx : wxList) { wx.setTaskId(taskId); result = backReceiveMapper.insertRad(wx); } @@ -259,8 +274,8 @@ public class BackReceiveServiceImpl implements BackReceiveService { private int insertSad(int taskId, List list) { int result = 0; - if(list !=null){ - for( BackApplyInfo bf : list ){ + if (list != null) { + for (BackApplyInfo bf : list) { bf.setTaskId(taskId); result = backReceiveMapper.insertSad(bf); } @@ -271,44 +286,44 @@ public class BackReceiveServiceImpl implements BackReceiveService { private int insertTta(int taskId, List list) { int res; String agreementId = list.get(0).getAgreementId(); - res = backReceiveMapper.insertTta(taskId,agreementId); + res = backReceiveMapper.insertTta(taskId, agreementId); return res; } - private int insertTt(List hgList, int taskType,String createBy) { + private int insertTt(List hgList, int taskType, String createBy) { int newTask; //生成单号 - String code = genCodeRule(taskType); + String code = genCodeRule(taskType); BackApplyInfo applyInfo = new BackApplyInfo(); applyInfo.setTaskType(taskType); - String taskStatus=""; - if(GlobalConstants.INT_41 == taskType){ + String taskStatus = ""; + if (GlobalConstants.INT_41 == taskType) { taskStatus = "43"; } - if(GlobalConstants.INT_57 == taskType){ + if (GlobalConstants.INT_57 == taskType) { taskStatus = "58"; } applyInfo.setTaskStatus(taskStatus); applyInfo.setCode(code); //创建人 applyInfo.setCreateBy(createBy); - newTask = backReceiveMapper.insertTt(applyInfo); - if (newTask>0 && applyInfo.getTaskId()>0){ - newTask=applyInfo.getTaskId(); + newTask = backReceiveMapper.insertTt(applyInfo); + if (newTask > 0 && applyInfo.getTaskId() > 0) { + newTask = applyInfo.getTaskId(); } return newTask; } private int updateMaStatus(List hgList) { - int res =0; - if(hgList!=null && hgList.size()>0){ - for(BackApplyInfo bi : hgList){ + int res = 0; + if (hgList != null && hgList.size() > 0) { + for (BackApplyInfo bi : hgList) { Integer maId = bi.getMaId(); - if(maId == null){ - res=1; - }else{ - res = backReceiveMapper.updateMaStatus(maId,"15"); + if (maId == null) { + res = 1; + } else { + res = backReceiveMapper.updateMaStatus(maId, "15"); } } } @@ -316,9 +331,9 @@ public class BackReceiveServiceImpl implements BackReceiveService { } private int updateMt(List hgList) { - int res =0; - if(hgList!=null && hgList.size()>0){ - for(BackApplyInfo bi : hgList){ + int res = 0; + if (hgList != null && hgList.size() > 0) { + for (BackApplyInfo bi : hgList) { res = backReceiveMapper.updateMt(bi); } } @@ -326,9 +341,9 @@ public class BackReceiveServiceImpl implements BackReceiveService { } private int insertIad(List hgList) { - int res =0; - if(hgList!=null && hgList.size()>0){ - for(BackApplyInfo bi : hgList){ + int res = 0; + if (hgList != null && hgList.size() > 0) { + for (BackApplyInfo bi : hgList) { res = backReceiveMapper.insertIad(bi); } } @@ -336,26 +351,26 @@ public class BackReceiveServiceImpl implements BackReceiveService { } private int insertBcd(BackApplyInfo record) { - int res =0; + int res = 0; BackApplyInfo[] arr = record.getArr(); - if(arr.length>0){ - for(int i=0 ; i< arr.length;i++){ - res = backReceiveMapper.insertCheckDetails(arr[i]); + if (arr.length > 0) { + for (int i = 0; i < arr.length; i++) { + res = backReceiveMapper.insertCheckDetails(arr[i]); String manageType = arr[i].getManageType(); - if("0".equals(manageType)){ + if ("0".equals(manageType)) { String backStatus = arr[i].getBackStatus(); - int maId = arr[i].getMaId(); - if("1".equals(backStatus)){ + int maId = arr[i].getMaId(); + if ("1".equals(backStatus)) { //退料合格状态变为退料带入库84 - backReceiveMapper.updateMaStatus(maId,"84"); + backReceiveMapper.updateMaStatus(maId, "84"); } - if("2".equals(backStatus)){ + if ("2".equals(backStatus)) { //退料维修状态变为退料待检修17 - backReceiveMapper.updateMaStatus(maId,"17"); + backReceiveMapper.updateMaStatus(maId, "17"); } - if("3".equals(backStatus)){ + if ("3".equals(backStatus)) { //退料待报废状态变为退料待报废20 - backReceiveMapper.updateMaStatus(maId,"20"); + backReceiveMapper.updateMaStatus(maId, "20"); } } } @@ -371,20 +386,20 @@ public class BackReceiveServiceImpl implements BackReceiveService { SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd"); Date nowDate = DateUtils.getNowDate(); String format = dateFormat.format(nowDate); - int taskNum = backReceiveMapper.selectTaskNumByMonthWx(nowDate,taskType) + 1; - String code=""; - if(GlobalConstants.INT_41 == taskType){ + int taskNum = backReceiveMapper.selectTaskNumByMonthWx(nowDate, taskType) + 1; + String code = ""; + if (GlobalConstants.INT_41 == taskType) { code = "WX"; } - if(GlobalConstants.INT_57 == taskType){ + if (GlobalConstants.INT_57 == taskType) { code = "BF"; } - if (taskNum>GlobalConstants.INT_9 && taskNum GlobalConstants.INT_9 && taskNum < GlobalConstants.INT_100) { code = code + format + "-00" + taskNum; - }else if (taskNum>GlobalConstants.INT_99 && taskNum GlobalConstants.INT_99 && taskNum < GlobalConstants.INT_1000) { + code = code + format + "-0" + taskNum; + } else { + code = code + format + "-000" + taskNum; } return code; } diff --git a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/impl/TmTaskServiceImpl.java b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/impl/TmTaskServiceImpl.java index e99a415e..20909c46 100644 --- a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/impl/TmTaskServiceImpl.java +++ b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/impl/TmTaskServiceImpl.java @@ -432,6 +432,7 @@ public class TmTaskServiceImpl implements TmTaskService { } // 存入领料任务实体集合 tmTask.setLeaseApplyInfoList(auditListByLeaseInfo); + tmTask.setRemark(auditListByLeaseInfo.get(0).getRemark()); } // 塞入预领的合计数量 tmTask.setPreCountNum(count); @@ -474,6 +475,7 @@ public class TmTaskServiceImpl implements TmTaskService { } // 存入领料任务实体集合 tmTask.setLeaseApplyInfoList(auditListByLeaseInfo); + tmTask.setRemark(auditListByLeaseInfo.get(0).getRemark()); } // 塞入预领的合计数量 tmTask.setPreCountNum(count); @@ -505,6 +507,7 @@ public class TmTaskServiceImpl implements TmTaskService { } // 塞入领料任务详情的集合中 leaseApplyInfo.setLeaseApplyDetails(leaseApplyDetails); + tmTask.setRemark(collect.get(0).getRemark()); } } } @@ -622,6 +625,7 @@ public class TmTaskServiceImpl implements TmTaskService { } // 存入领料任务实体集合 tmTask.setLeaseApplyInfoList(collect); + tmTask.setRemark(collect.get(0).getRemark()); } //施管部只能看到机具分公司(101)的数据 if ((roles.contains("jjfgs") || roles.contains("sgb")) && companyId != null) { @@ -646,6 +650,7 @@ public class TmTaskServiceImpl implements TmTaskService { } // 存入领料任务实体集合 tmTask.setLeaseApplyInfoList(auditListByLeaseInfo); + tmTask.setRemark(collect.get(0).getRemark()); } } //安监部只能看到设备分公司(102)的数据 @@ -671,6 +676,7 @@ public class TmTaskServiceImpl implements TmTaskService { } // 存入领料任务实体集合 tmTask.setLeaseApplyInfoList(auditListByLeaseInfo); + tmTask.setRemark(collect.get(0).getRemark()); } } // 塞入预领的合计数量 @@ -1059,6 +1065,8 @@ public class TmTaskServiceImpl implements TmTaskService { leaseApplyInfo.setRemark(remark); leaseApplyInfo.setType(task.getLeaseApplyInfoList().get(0).getType()); leaseApplyInfo.setCompanyId(leaseApplyDetail.getCompanyId()); + leaseApplyInfo.setEstimateLeaseTime(task.getEstimateLeaseTime()); + leaseApplyInfo.setLeaseType(task.getLeaseType()); res = leaseApplyInfoMapper.insert(leaseApplyInfo); } } diff --git a/sgzb-modules/sgzb-base/src/main/resources/mapper/app/BackReceiveMapper.xml b/sgzb-modules/sgzb-base/src/main/resources/mapper/app/BackReceiveMapper.xml index 7968c013..c339635e 100644 --- a/sgzb-modules/sgzb-base/src/main/resources/mapper/app/BackReceiveMapper.xml +++ b/sgzb-modules/sgzb-base/src/main/resources/mapper/app/BackReceiveMapper.xml @@ -596,6 +596,7 @@ sd.`name` AS taskName, tta.agreement_id AS agreementId, GROUP_CONCAT( DISTINCT bad.type_id ) AS typeId, + GROUP_CONCAT(bad.id) as badId, GROUP_CONCAT( mt2.type_name, '' ) AS typeName FROM back_apply_info bai @@ -658,7 +659,9 @@ mt.type_name as typeCode, mt.unit_name as unitName, mt2.type_name AS typeName, - IFNULL(bad.audit_num,0)-(IFNULL(aa.back_num,0)) as num, + bad.pre_num as preNum, + bad.status as status, + IFNULL(bad.audit_num,0)-IFNULL(aa.back_num,0) as num, mt.manage_type as manageType, CONCAT('NSJJ',mt.`code`,mt.model_code) as `code` FROM @@ -786,18 +789,23 @@ @@ -872,7 +880,44 @@ LEFT JOIN tm_task_agreement tta ON tta.task_id = bai.task_id WHERE parent_id = #{parentId} - GROUP BY bcd.type_id,bcd.ma_id + GROUP By bcd.type_id,bcd.ma_id + + + diff --git a/sgzb-modules/sgzb-base/src/main/resources/mapper/app/LeaseApplyInfoMapper.xml b/sgzb-modules/sgzb-base/src/main/resources/mapper/app/LeaseApplyInfoMapper.xml index 4df5d8f8..715c5070 100644 --- a/sgzb-modules/sgzb-base/src/main/resources/mapper/app/LeaseApplyInfoMapper.xml +++ b/sgzb-modules/sgzb-base/src/main/resources/mapper/app/LeaseApplyInfoMapper.xml @@ -58,13 +58,13 @@ company_audit_remark, dept_audit_by, dept_audit_time, dept_audit_remark, create_by, create_time, update_by, update_time, remark, - company_id) + company_id,estimate_lease_time,lease_type) values (#{code,jdbcType=VARCHAR}, #{taskId,jdbcType=INTEGER}, #{leasePerson,jdbcType=VARCHAR}, #{phone,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR}, #{companyAuditBy,jdbcType=INTEGER}, #{companyAuditTime,jdbcType=VARCHAR}, #{companyAuditRemark,jdbcType=VARCHAR}, #{deptAuditBy,jdbcType=INTEGER}, #{deptAuditTime,jdbcType=VARCHAR}, #{deptAuditRemark,jdbcType=VARCHAR}, #{createBy,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{updateBy,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP}, #{remark,jdbcType=VARCHAR}, - #{companyId,jdbcType=INTEGER}) + #{companyId,jdbcType=INTEGER}, #{estimateLeaseTime,jdbcType=TIMESTAMP},#{leaseType,jdbcType=VARCHAR}) diff --git a/sgzb-modules/sgzb-base/src/main/resources/mapper/app/TmTaskMapper.xml b/sgzb-modules/sgzb-base/src/main/resources/mapper/app/TmTaskMapper.xml index f098f09b..efc7f17d 100644 --- a/sgzb-modules/sgzb-base/src/main/resources/mapper/app/TmTaskMapper.xml +++ b/sgzb-modules/sgzb-base/src/main/resources/mapper/app/TmTaskMapper.xml @@ -459,9 +459,9 @@ bpl.lot_id as proId,bpl.lot_name as proName, bui.unit_id as unitId,bui.unit_name as unitName, lai.lease_person as leasePerson, lai.phone as leasePhone, tt.create_by as applyFor,d.`name` as taskName,lai.lease_type as leaseType,lai.estimate_lease_time as estimateLeaseTime, - case when d.id = '30' then lai.company_audit_remark - when d.id = '31' then lai.dept_audit_remark - when d.id = '32' then lai.direct_audit_remark + case when d.id = '31' then lai.company_audit_remark + when d.id = '32' then lai.dept_audit_remark + when d.id = '33' then lai.direct_audit_remark when d.id = '98' then lai.company_audit_remark when d.id = '99' then lai.dept_audit_remark when d.id = '100' then lai.direct_audit_remark @@ -510,13 +510,13 @@ bpl.lot_id as proId,bpl.lot_name as proName, bui.unit_id as unitId,bui.unit_name as unitName, lai.lease_person as leasePerson, lai.phone as leasePhone,lai.lease_type as leaseType, lai.estimate_lease_time as estimateLeaseTime,tt.create_by as applyFor,d.`name` as taskName, - case when d.id = '30' then lai.company_audit_remark - when d.id = '31' then lai.dept_audit_remark - when d.id = '32' then lai.direct_audit_remark + case when d.id = '31' then lai.company_audit_remark + when d.id = '32' then lai.dept_audit_remark + when d.id = '33' then lai.direct_audit_remark when d.id = '98' then lai.company_audit_remark when d.id = '99' then lai.dept_audit_remark when d.id = '100' then lai.direct_audit_remark - end examineStatus , + end examineStatus, d.id as examineStatusId, bai.agreement_code as agreementCode, tt.create_time as createTimes, tt.update_time as updateTimes @@ -812,9 +812,9 @@ bpl.lot_id as proId,bpl.lot_name as proName, bui.unit_id as unitId,bui.unit_name as unitName, lai.lease_person as leasePerson, lai.phone as leasePhone, tt.create_by as applyFor,d.`name` as taskName,lai.lease_type as leaseType,lai.estimate_lease_time as estimateLeaseTime, - case when d.id = '30' then lai.company_audit_remark - when d.id = '31' then lai.dept_audit_remark - when d.id = '32' then lai.direct_audit_remark + case when d.id = '31' then lai.company_audit_remark + when d.id = '32' then lai.dept_audit_remark + when d.id = '33' then lai.direct_audit_remark when d.id = '98' then lai.company_audit_remark when d.id = '99' then lai.dept_audit_remark when d.id = '100' then lai.direct_audit_remark diff --git a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/controller/AgreementInfoController.java b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/controller/AgreementInfoController.java index ec77eeb0..789da26a 100644 --- a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/controller/AgreementInfoController.java +++ b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/controller/AgreementInfoController.java @@ -43,8 +43,7 @@ public class AgreementInfoController extends BaseController { */ @ApiOperation(value = "获取协议管理列单个信息") @GetMapping(value = "/getAgreementInfoId") - public AjaxResult getAgreementInfoId(AgreementInfo bean) - { + public AjaxResult getAgreementInfoId(AgreementInfo bean) { AgreementInfo agreementInfo = agreementInfoService.getAgreementInfoId(bean); return success(agreementInfo); } @@ -54,7 +53,7 @@ public class AgreementInfoController extends BaseController { */ @ApiOperation(value = "往来单位") @GetMapping("/getUnitList") - public AjaxResult getUnitList(){ + public AjaxResult getUnitList() { List list = agreementInfoService.getUnitList(); return AjaxResult.success(list); } @@ -64,27 +63,25 @@ public class AgreementInfoController extends BaseController { */ @ApiOperation(value = "工程名称") @GetMapping("/getProjectList") - public AjaxResult getProjectList(){ + public AjaxResult getProjectList() { List list = agreementInfoService.getProjectList(); return AjaxResult.success(list); } @ApiOperation("协议管理-保存") @PostMapping("/add") - public AjaxResult add(@Validated @RequestBody AgreementInfo bean) - { + public AjaxResult add(@Validated @RequestBody AgreementInfo bean) { int i = agreementInfoService.add(bean); - if(i==-1){ + if (i == -1) { return AjaxResult.error("已存在重复数据"); - }else{ + } else { return toAjax(i); } } @ApiOperation("协议管理-修改") @PostMapping("/update") - public AjaxResult update(@Validated @RequestBody AgreementInfo bean) - { + public AjaxResult update(@Validated @RequestBody AgreementInfo bean) { return toAjax(agreementInfoService.update(bean)); } @@ -94,8 +91,7 @@ public class AgreementInfoController extends BaseController { */ @ApiOperation(value = "协议管理-删除") @PostMapping("/remove") - public AjaxResult deleteByIds(@Validated @RequestBody AgreementInfo bean) - { + public AjaxResult deleteByIds(@Validated @RequestBody AgreementInfo bean) { return agreementInfoService.deleteByIds(bean); } @@ -106,8 +102,7 @@ public class AgreementInfoController extends BaseController { @ApiOperation("协议管理导出") @Log(title = "协议管理导出", businessType = BusinessType.EXPORT) @PostMapping("/export") - public void export(HttpServletResponse response, AgreementInfo agreementInfo) - { + public void export(HttpServletResponse response, AgreementInfo agreementInfo) { List list = agreementInfoService.exportList(agreementInfo); ExcelUtil util = new ExcelUtil(AgreementInfo.class); util.exportExcel(response, list, "协议管理数据"); diff --git a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/domain/AgreementInfo.java b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/domain/AgreementInfo.java index 489aa7c4..dc6bf9cb 100644 --- a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/domain/AgreementInfo.java +++ b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/domain/AgreementInfo.java @@ -15,65 +15,91 @@ import java.util.Date; public class AgreementInfo extends BaseEntity { private static final long serialVersionUID = 1L; - /** 协议ID */ + /** + * 协议ID + */ @ApiModelProperty(value = "协议ID") private Long agreementId; - /** 协议编号 */ + /** + * 协议编号 + */ @Excel(name = "协议编号") @ApiModelProperty(value = "协议编号") private String agreementCode; - /** 合同 */ + /** + * 合同 + */ @Excel(name = "合同编号") @ApiModelProperty(value = "合同") private String contractCode; - /** 签订日期 */ + /** + * 签订日期 + */ @Excel(name = "签订日期") @ApiModelProperty(value = "签订日期") private String signTime; - /** 往来单位id */ + /** + * 往来单位id + */ @ApiModelProperty(value = "往来单位id") private Long unitId; - /** 往来单位 */ + /** + * 往来单位 + */ @Excel(name = "往来单位") @ApiModelProperty(value = "往来单位") private String unitName; - /** 工程标段ID */ + /** + * 工程标段ID + */ @ApiModelProperty(value = "工程标段ID") private Long projectId; - /** 工程标段 */ + /** + * 工程标段 + */ @Excel(name = "工程名称") @ApiModelProperty(value = "工程标段") private String projectName; - /** 计划开始时间 */ + /** + * 计划开始时间 + */ @JsonFormat(pattern = "yyyy-MM-dd") @Excel(name = "开始日期", width = 30, dateFormat = "yyyy-MM-dd") @ApiModelProperty(value = "计划开始时间") private Date planStartTime; - /** 租赁天数 */ + /** + * 租赁天数 + */ @Excel(name = "租赁期限(天)") @ApiModelProperty(value = "租赁天数") private Long leaseDay; - /** 授权人 */ + /** + * 授权人 + */ @Excel(name = "授权人") @ApiModelProperty(value = "授权人") private String authPerson; - /** 联系方式 */ + /** + * 联系方式 + */ @Excel(name = "联系方式") @ApiModelProperty(value = "联系方式") private String phone; - /** 数据所属组织 */ + /** + * 数据所属组织 + */ @ApiModelProperty(value = "数据所属组织") private Long companyId; @@ -86,13 +112,17 @@ public class AgreementInfo extends BaseEntity { @ApiModelProperty(value = "关键字") private String keyWord; - /** 备注 */ + /** + * 备注 + */ @Excel(name = "备注") @ApiModelProperty(value = "备注") private String remark; - /** 协议类型 */ - @Excel(name = "协议类型") + /** + * 协议类型 + */ + @Excel(name = "协议类型", readConverterExp = "1=内部单位,2=外部单位") @ApiModelProperty(value = "协议类型(1内部单位 2外部单位)") private Integer protocol; @ApiModelProperty(value = "结算总费用") diff --git a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/domain/BackApplyInfo.java b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/domain/BackApplyInfo.java index ded459e7..b505487b 100644 --- a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/domain/BackApplyInfo.java +++ b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/domain/BackApplyInfo.java @@ -28,6 +28,8 @@ public class BackApplyInfo extends BaseEntity { * 任务ID */ private Integer parentId; + private String badId; + private String[] split; /** * 工程名称 diff --git a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/service/impl/BackApplyServiceImpl.java b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/service/impl/BackApplyServiceImpl.java index 1779a02e..3d277418 100644 --- a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/service/impl/BackApplyServiceImpl.java +++ b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/service/impl/BackApplyServiceImpl.java @@ -131,6 +131,9 @@ public class BackApplyServiceImpl implements BackApplyService { @Override public List getView(BackApplyInfo bean) { Long companyId = SecurityUtils.getLoginUser().getSysUser().getCompanyId(); + String badId = bean.getBadId(); + String[] split = badId.split(","); + bean.setSplit(split); if (companyId != null) { bean.setCompanyId(companyId.toString()); return backApplyMapper.getView(bean); @@ -203,7 +206,7 @@ public class BackApplyServiceImpl implements BackApplyService { } catch (NullPointerException e) { e.printStackTrace(); return AjaxResult.error("获取用户信息失败:{}", e); - } catch (Exception e) { + } catch (Exception e) { e.printStackTrace(); } int num = 0; @@ -216,8 +219,8 @@ public class BackApplyServiceImpl implements BackApplyService { bean.setCreateBy(userid.toString()); } bean.setStatus("1"); - int re = backApplyMapper.audit(bean); - if (re < 1) { + int i = auditDetails(bean); + if (i == 0) { return AjaxResult.error("审核失败"); } } @@ -229,8 +232,8 @@ public class BackApplyServiceImpl implements BackApplyService { bean.setCreateBy(userid.toString()); } bean.setStatus("1"); - int re = backApplyMapper.audit(bean); - if (re < 1) { + int i = auditDetails(bean); + if (i == 0) { return AjaxResult.error("审核失败"); } } @@ -242,8 +245,8 @@ public class BackApplyServiceImpl implements BackApplyService { bean.setCreateBy(userid.toString()); } bean.setStatus("3"); - int re = backApplyMapper.audit(bean); - if (re < 1) { + int i = auditDetails(bean); + if (i == 0) { return AjaxResult.error("审核失败"); } } @@ -266,6 +269,18 @@ public class BackApplyServiceImpl implements BackApplyService { } } + private int auditDetails(BackApplyInfo bean) { + int re = 0; + if (CollUtil.isNotEmpty(bean.getBackApplyDetails())) { + List backApplyDetails = bean.getBackApplyDetails(); + for (BackApplyInfo backApplyDetail : backApplyDetails) { + bean.setAuditNum(backApplyDetail.getNum()); + re = backApplyMapper.audit(bean); + } + } + return re; + } + @Override public AjaxResult refuse(BackApplyInfo bean) { if (SecurityUtils.getLoginUser() != null) { diff --git a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/service/impl/RepairTestInputServiceImpl.java b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/service/impl/RepairTestInputServiceImpl.java index ff1508af..e99d07f6 100644 --- a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/service/impl/RepairTestInputServiceImpl.java +++ b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/service/impl/RepairTestInputServiceImpl.java @@ -60,7 +60,7 @@ public class RepairTestInputServiceImpl implements RepairTestInputService { return AjaxResult.error(HttpStatus.ERROR, "参数不正确"); } List list = JSONObject.parseArray(repairTestInputDto.getParams(), RepairTestWarehousingDto.class); - if(CollectionUtils.isEmpty(list)){ + if (CollectionUtils.isEmpty(list)) { return AjaxResult.error(HttpStatus.ERROR, "参数不正确"); } List auditDetails = new ArrayList<>(); @@ -69,7 +69,9 @@ public class RepairTestInputServiceImpl implements RepairTestInputService { String updateTime = DateTimeHelper.getNowTime(); String updateBy = SecurityUtils.getLoginUser().getUsername(); for (RepairTestWarehousingDto dto : list) { - dto.setCompanyId(companyId); + if (companyId != null) { + dto.setCompanyId(companyId); + } dto.setUpdateTime(updateTime); dto.setUpdateBy(updateBy); if (Objects.equals("2", dto.getCheckType())) { @@ -98,11 +100,11 @@ public class RepairTestInputServiceImpl implements RepairTestInputService { // 更新机具类型-库存 String repairNum = StringUtils.isNotEmpty(dto.getRepairNum()) ? dto.getRepairNum() : "0"; double num = countNum(map.get("num"), repairNum); - mapper.updateMaTypeNum(dto.getTypeId(),num); - if(Objects.equals("0", dto.getType())){ + mapper.updateMaTypeNum(dto.getTypeId(), num); + if (Objects.equals("0", dto.getType())) { // 查询机具状态-在库的id、管理方式为编号的需更新机具设备的机具状态 - int dicId = mapper.getDicByMaStatusId("ma_status","在库"); - mapper.updateMaMachineStatus(dicId,dto.getMaId()); + int dicId = mapper.getDicByMaStatusId("ma_status", "在库"); + mapper.updateMaMachineStatus(dicId, dto.getMaId()); } } } @@ -115,16 +117,16 @@ public class RepairTestInputServiceImpl implements RepairTestInputService { int noCheckNum = Integer.parseInt(String.valueOf(numMap.get("noCheckNum"))); int passNum = Integer.parseInt(String.valueOf(numMap.get("passNum"))); int noPassNum = Integer.parseInt(String.valueOf(numMap.get("noPassNum"))); - if(passNum == totalNum){ - int dicId = mapper.getDicByMaStatusId("rk_task","入库完成"); - mapper.updateTmTaskStatus(dto,dicId); - }else if(noPassNum > 0 && noCheckNum == 0){ - int dicId = mapper.getDicByMaStatusId("rk_task","入库驳回"); - mapper.updateTmTaskStatus(dto,dicId); + if (passNum == totalNum) { + int dicId = mapper.getDicByMaStatusId("rk_task", "入库完成"); + mapper.updateTmTaskStatus(dto, dicId); + } else if (noPassNum > 0 && noCheckNum == 0) { + int dicId = mapper.getDicByMaStatusId("rk_task", "入库驳回"); + mapper.updateTmTaskStatus(dto, dicId); } - if (auditDetails.size() > 0){ - int i = reject(auditDetails,tmTaskAgreement); - if (i != auditDetails.size()){ + if (auditDetails.size() > 0) { + int i = reject(auditDetails, tmTaskAgreement); + if (i != auditDetails.size()) { throw new ServiceException("驳回出错"); } } @@ -138,7 +140,7 @@ public class RepairTestInputServiceImpl implements RepairTestInputService { return AjaxResult.success(); } - public int reject(List auditDetails,TmTaskAgreement tmTaskAgreement){ + public int reject(List auditDetails, TmTaskAgreement tmTaskAgreement) { String taskCode = ""; int taskStatus = 0; int taskType = 0; diff --git a/sgzb-modules/sgzb-material/src/main/resources/mapper/material/AgreementInfoMapper.xml b/sgzb-modules/sgzb-material/src/main/resources/mapper/material/AgreementInfoMapper.xml index c21e5675..3c4ca5f4 100644 --- a/sgzb-modules/sgzb-material/src/main/resources/mapper/material/AgreementInfoMapper.xml +++ b/sgzb-modules/sgzb-material/src/main/resources/mapper/material/AgreementInfoMapper.xml @@ -79,7 +79,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" unit_id = #{unitId}, project_id = #{projectId}, create_by = #{createBy}, - lease_day = #{leaseDay}, + lease_day = #{leaseDay}, plan_start_time = #{planStartTime}, contract_code = #{contractCode}, auth_person = #{authPerson}, diff --git a/sgzb-modules/sgzb-material/src/main/resources/mapper/material/BackApplyMapper.xml b/sgzb-modules/sgzb-material/src/main/resources/mapper/material/BackApplyMapper.xml index 7e8ba3fa..9a22ac74 100644 --- a/sgzb-modules/sgzb-material/src/main/resources/mapper/material/BackApplyMapper.xml +++ b/sgzb-modules/sgzb-material/src/main/resources/mapper/material/BackApplyMapper.xml @@ -310,7 +310,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" UPDATE tm_task tt LEFT JOIN back_apply_info bai ON bai.task_id = tt.task_id LEFT JOIN back_apply_details bad on bad.parent_id=bai.id - SET bad.audit_num=bad.pre_num,bai.direct_audit_by=#{createBy},bai.status=#{status},bai.direct_audit_time=NOW() + SET bad.audit_num=#{auditNum},bai.direct_audit_by=#{createBy},bai.status=#{status},bai.direct_audit_time=NOW() WHERE bai.id = #{id} @@ -516,7 +516,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" mt.type_name typeCode, mt2.type_name AS typeName, bagi.agreement_code as agreementCode, - bad.pre_num AS num + bad.audit_num AS num FROM back_apply_details bad LEFT JOIN back_apply_info bai ON bai.id = bad.parent_id @@ -532,6 +532,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" LEFT JOIN ma_type mt4 ON mt4.type_id = mt3.parent_id WHERE bai.task_id = #{taskId} + and bad.id in + + #{split} + and bai.company_id = #{companyId} @@ -637,6 +641,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" tt.task_status as taskStatus, tta.agreement_id as agreementId, GROUP_CONCAT(bai.company_id) as companyId, + GROUP_CONCAT(bad.id) as badId, GROUP_CONCAT(DISTINCT bad.type_id) as typeId, GROUP_CONCAT(mt2.type_name) AS typeName, GROUP_CONCAT(bad.status) AS status @@ -758,7 +763,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" tt.task_status as taskStatus, tta.agreement_id as agreementId, GROUP_CONCAT(bai.company_id) as companyId, - GROUP_CONCAT(DISTINCT bad.type_id) as typeId, + GROUP_CONCAT(DISTINCT mt2.type_id) as typeId, GROUP_CONCAT(mt2.type_name) AS typeName, GROUP_CONCAT(bad.status) AS status FROM @@ -798,6 +803,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and bai.back_time =#{time} GROUP BY bai.task_id, us.user_name, bai.phone, bpl.lot_name, bui.unit_name, bagi.plan_start_time + + HAVING FIND_IN_SET(#{typeId}, typeId) > 0 + ORDER BY bai.create_time desc