Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
dba1d641d8
|
|
@ -41,7 +41,7 @@ public class BackApplyInfoController extends BaseController {
|
|||
* 查询退料任务列表
|
||||
*/
|
||||
@ApiOperation(value = "查询退料任务列表")
|
||||
//@RequiresPermissions("back:info:list")
|
||||
@RequiresPermissions("back:info:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(BackApplyInfo backApplyInfo) {
|
||||
startPage();
|
||||
|
|
@ -65,6 +65,7 @@ public class BackApplyInfoController extends BaseController {
|
|||
@SysLog(title = "退料任务", businessType = OperaType.EXPORT, logType = 1,module = "仓储管理->导出退料任务")
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, BackApplyInfo backApplyInfo) {
|
||||
backApplyInfo.setIsExport(true);
|
||||
List<BackApplyInfo> list = backApplyInfoService.selectBackApplyInfoList(backApplyInfo);
|
||||
ExcelUtil<BackApplyInfo> util = new ExcelUtil<BackApplyInfo>(BackApplyInfo.class);
|
||||
util.exportExcel(response, list, "退料任务数据");
|
||||
|
|
@ -74,7 +75,7 @@ public class BackApplyInfoController extends BaseController {
|
|||
* 获取退料任务详细信息
|
||||
*/
|
||||
@ApiOperation(value = "获取退料任务详细信息")
|
||||
//@RequiresPermissions("back:info:query")
|
||||
@RequiresPermissions("back:info:query")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id) {
|
||||
return success(backApplyInfoService.selectBackApplyInfoById(id));
|
||||
|
|
@ -112,12 +113,28 @@ public class BackApplyInfoController extends BaseController {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 退料申请提交
|
||||
*/
|
||||
@ApiOperation(value = "退料申请提交")
|
||||
//@PreventRepeatSubmit
|
||||
//@RequiresPermissions("back:info:submit")
|
||||
@SysLog(title = "退料任务", businessType = OperaType.UPDATE, logType = 1,module = "仓储管理->退料申请提交")
|
||||
@PostMapping("/submitBackApply")
|
||||
public AjaxResult submitBackApply(@RequestBody BackApplyInfo backApplyInfo) {
|
||||
try {
|
||||
return backApplyInfoService.submitBackApply(backApplyInfo);
|
||||
} catch (Exception e) {
|
||||
return error("系统错误, " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除退料任务
|
||||
*/
|
||||
@ApiOperation(value = "删除退料任务")
|
||||
//@PreventRepeatSubmit
|
||||
//@RequiresPermissions("back:info:remove")
|
||||
@PreventRepeatSubmit
|
||||
@RequiresPermissions("back:info:remove")
|
||||
@SysLog(title = "退料任务", businessType = OperaType.DELETE, logType = 1,module = "仓储管理->删除退料任务")
|
||||
@DeleteMapping("/{id}")
|
||||
public AjaxResult remove(@PathVariable Long id) {
|
||||
|
|
|
|||
|
|
@ -82,6 +82,12 @@ public class BackApplyDetails extends BaseEntity {
|
|||
@ApiModelProperty(value = "机具外观判断")
|
||||
private String apDetection;
|
||||
|
||||
@ApiModelProperty(value = "退料状态")
|
||||
private String backStatus;
|
||||
|
||||
@ApiModelProperty(value = "是否完成 (0:未完成退料,可以撤回 1:已完成退料,不能撤回)")
|
||||
private Integer isFinished;
|
||||
|
||||
/** 数据所属组织 */
|
||||
@ApiModelProperty(value = "数据所属组织")
|
||||
private Long companyId;
|
||||
|
|
|
|||
|
|
@ -21,6 +21,8 @@ import com.bonus.common.core.web.domain.BaseEntity;
|
|||
public class BackApplyInfo {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Boolean isExport;
|
||||
|
||||
/** ID */
|
||||
private Long id;
|
||||
|
||||
|
|
@ -57,7 +59,6 @@ public class BackApplyInfo {
|
|||
private String typeName;
|
||||
|
||||
/** 任务ID */
|
||||
@Excel(name = "任务ID")
|
||||
@ApiModelProperty(value = "任务ID")
|
||||
private Long taskId;
|
||||
|
||||
|
|
@ -66,29 +67,30 @@ public class BackApplyInfo {
|
|||
@ApiModelProperty(value = "退料人")
|
||||
private String backPerson;
|
||||
|
||||
/**
|
||||
* 退料数量
|
||||
*/
|
||||
private Integer backNum;
|
||||
|
||||
/** 联系方式 */
|
||||
@Excel(name = "退料人电话")
|
||||
@ApiModelProperty(value = "联系方式")
|
||||
private String phone;
|
||||
|
||||
/** 机具公司审批人 */
|
||||
@Excel(name = "机具公司审批人")
|
||||
@ApiModelProperty(value = "机具公司审批人")
|
||||
private Long directAuditBy;
|
||||
|
||||
/** 机具公司审批时间 */
|
||||
@ApiModelProperty(value = "机具公司审批时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "机具公司审批时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date directAuditTime;
|
||||
|
||||
/** 机具公司审批备注 */
|
||||
@Excel(name = "机具公司审批备注")
|
||||
@ApiModelProperty(value = "机具公司审批备注")
|
||||
private String directAuditRemark;
|
||||
|
||||
/** 数据所属组织 */
|
||||
@Excel(name = "数据所属组织")
|
||||
@ApiModelProperty(value = "数据所属组织")
|
||||
private Long companyId;
|
||||
|
||||
|
|
@ -124,6 +126,13 @@ public class BackApplyInfo {
|
|||
@Excel(name = "备注")
|
||||
private String remark;
|
||||
|
||||
@ApiModelProperty(value = "机具id")
|
||||
private Long maId;
|
||||
|
||||
/** 任务ID */
|
||||
@ApiModelProperty(value = "任务ID")
|
||||
private Long parentId;
|
||||
|
||||
/** 直转id */
|
||||
@ApiModelProperty(value = "直转id")
|
||||
private Long directId;
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import java.util.List;
|
|||
import com.bonus.material.back.domain.BackApplyDetails;
|
||||
import com.bonus.material.back.domain.BackApplyInfo;
|
||||
import com.bonus.material.back.domain.vo.MaCodeVo;
|
||||
import com.bonus.material.settlement.domain.SltAgreementInfo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
|
|
@ -155,4 +156,88 @@ public interface BackApplyInfoMapper {
|
|||
*/
|
||||
int deleteCheckDetails(Long id);
|
||||
|
||||
/**
|
||||
* 查询详情
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
List<BackApplyInfo> selectBackDetails(Long id);
|
||||
|
||||
/**
|
||||
* 更新任务状态
|
||||
* @param backApplyInfo
|
||||
* @return
|
||||
*/
|
||||
int updateTaskStatus(BackApplyInfo backApplyInfo);
|
||||
|
||||
/**
|
||||
* 更新退料单
|
||||
* @param backApplyInfo
|
||||
* @return
|
||||
*/
|
||||
int updateBack(BackApplyInfo backApplyInfo);
|
||||
|
||||
/**
|
||||
* 更新详情
|
||||
* @param backApplyInfo
|
||||
* @return
|
||||
*/
|
||||
int updateBackDetails(BackApplyInfo backApplyInfo);
|
||||
|
||||
/**
|
||||
* 更新机具退料详情
|
||||
* @param backApplyInfo
|
||||
* @return
|
||||
*/
|
||||
int updateCheckDetails(BackApplyInfo backApplyInfo);
|
||||
|
||||
/**
|
||||
* 查询维修列表
|
||||
* @param backApplyInfo
|
||||
* @return
|
||||
*/
|
||||
List<BackApplyInfo> getWxList(BackApplyInfo backApplyInfo);
|
||||
|
||||
/**
|
||||
* 查询维修单号
|
||||
* @param nowDate
|
||||
* @return
|
||||
*/
|
||||
Integer selectTaskNumByMonthWx(@Param("date") Date nowDate);
|
||||
|
||||
/**
|
||||
* 新增维修单
|
||||
* @param wx
|
||||
* @return
|
||||
*/
|
||||
int insertRad(BackApplyInfo wx);
|
||||
|
||||
/**
|
||||
* 查询结算信息
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
List<SltAgreementInfo> getStlInfo(BackApplyInfo bean);
|
||||
|
||||
/**
|
||||
* 更新结算信息
|
||||
* @param info
|
||||
* @param record
|
||||
*/
|
||||
void updateStlInfo(@Param("info") SltAgreementInfo info, @Param("record") BackApplyInfo record);
|
||||
|
||||
/**
|
||||
* 更新结算信息2
|
||||
* @param info
|
||||
* @param record
|
||||
* @param backNum
|
||||
*/
|
||||
void updateStlInfoTwo(@Param("info") SltAgreementInfo info,@Param("record") BackApplyInfo record, @Param("backNum") Integer backNum);
|
||||
|
||||
/**
|
||||
* 新增结算信息
|
||||
* @param info
|
||||
* @param many
|
||||
*/
|
||||
void insStlInfoTwo(@Param("info")SltAgreementInfo info, @Param("many")Integer many);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,4 +67,11 @@ public interface IBackApplyInfoService {
|
|||
* @return
|
||||
*/
|
||||
AjaxResult getMachineById(BackApplyInfo dto);
|
||||
|
||||
/**
|
||||
* 提交退料申请
|
||||
* @param backApplyInfo
|
||||
* @return
|
||||
*/
|
||||
AjaxResult submitBackApply(BackApplyInfo backApplyInfo);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ import com.bonus.material.back.domain.vo.BackApplyRequestVo;
|
|||
import com.bonus.material.back.domain.vo.MaCodeVo;
|
||||
import com.bonus.material.basic.domain.BmFileInfo;
|
||||
import com.bonus.material.basic.mapper.BmFileInfoMapper;
|
||||
import com.bonus.material.settlement.domain.SltAgreementInfo;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.bonus.material.back.mapper.BackApplyInfoMapper;
|
||||
|
|
@ -167,7 +168,31 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService {
|
|||
*/
|
||||
@Override
|
||||
public List<BackApplyInfo> selectBackApplyInfoList(BackApplyInfo backApplyInfo) {
|
||||
return backApplyInfoMapper.selectBackApplyInfoList(backApplyInfo);
|
||||
List<BackApplyInfo> list = backApplyInfoMapper.selectBackApplyInfoList(backApplyInfo);
|
||||
// 如果列表为空,直接返回空列表
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
// 如果需要导出
|
||||
if (backApplyInfo.getIsExport()) {
|
||||
for (BackApplyInfo applyInfo : list) {
|
||||
applyInfo.setPrintStatus("0".equals(applyInfo.getPrintStatus()) ? "未打印" : "已打印");
|
||||
switch (applyInfo.getStatus()) {
|
||||
case "0":
|
||||
applyInfo.setStatus("退料未完成");
|
||||
break;
|
||||
case "1":
|
||||
applyInfo.setStatus("维修驳回");
|
||||
break;
|
||||
case "2":
|
||||
applyInfo.setStatus("退料已完成");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -186,6 +211,14 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService {
|
|||
if (StringUtils.isNotBlank(dto.getBackApplyInfo().getPhone()) && !PhoneUtil.isMobile(dto.getBackApplyInfo().getPhone())) {
|
||||
return AjaxResult.error("手机号格式不正确,请重新填写!");
|
||||
}
|
||||
//对提交的退料详情树木进行校验
|
||||
for (BackApplyDetails backApplyDetails : dto.getBackApplyDetailsList()) {
|
||||
if (backApplyDetails.getNum() != null && backApplyDetails.getPreNum() != null) {
|
||||
if (backApplyDetails.getNum() < backApplyDetails.getPreNum()) {
|
||||
return AjaxResult.error("退料数量不能大于预退数量,请重新填写!");
|
||||
}
|
||||
}
|
||||
}
|
||||
//生成退料单号
|
||||
String code = getString();
|
||||
if (StringUtils.isBlank(code)) {
|
||||
|
|
@ -271,13 +304,14 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService {
|
|||
* @return
|
||||
*/
|
||||
private int saveMaCodeBmFileInfo(BackApplyDetails details, Long id, int result) {
|
||||
// 设置公共字段
|
||||
setCommonFields(details, id);
|
||||
if (CollectionUtils.isNotEmpty(details.getMaCodeList())) {
|
||||
for (MaCodeDto maCodeDto : details.getMaCodeList()) {
|
||||
// 设置每个 MaCodeDto 的独立属性
|
||||
details.setMaId(maCodeDto.getMaId());
|
||||
details.setParentId(id);
|
||||
details.setCreateBy(SecurityUtils.getUsername());
|
||||
details.setCreateTime(DateUtils.getNowDate());
|
||||
details.setStatus("0");
|
||||
details.setPreNum(1);
|
||||
// 插入 CheckDetails
|
||||
result += backApplyInfoMapper.insertCheckDetails(details);
|
||||
if (CollectionUtils.isNotEmpty(maCodeDto.getBmFileInfos())) {
|
||||
for (BmFileInfo bmFileInfo : maCodeDto.getBmFileInfos()) {
|
||||
|
|
@ -290,10 +324,29 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService {
|
|||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// 如果 MaCodeList 为空,只插入 CheckDetails
|
||||
result += backApplyInfoMapper.insertCheckDetails(details);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置公共字段
|
||||
* @param details
|
||||
* @param id
|
||||
*/
|
||||
private void setCommonFields(BackApplyDetails details, Long id) {
|
||||
details.setParentId(id);
|
||||
details.setCreateBy(SecurityUtils.getUsername());
|
||||
details.setCreateTime(DateUtils.getNowDate());
|
||||
details.setStatus("0");
|
||||
// 默认为 0,表示未完成
|
||||
details.setIsFinished(0);
|
||||
// 默认返回状态 1
|
||||
details.setBackStatus("1");
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成退料单号
|
||||
* @return
|
||||
|
|
@ -325,6 +378,17 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService {
|
|||
*/
|
||||
@Override
|
||||
public AjaxResult updateBackApplyInfo(BackApplyRequestVo dto) {
|
||||
if (dto == null || dto.getBackApplyInfo() == null || CollectionUtils.isEmpty(dto.getBackApplyDetailsList())) {
|
||||
return AjaxResult.error("参数为空,请重新选择后上传!");
|
||||
}
|
||||
//对提交的退料详情树木进行校验
|
||||
for (BackApplyDetails backApplyDetails : dto.getBackApplyDetailsList()) {
|
||||
if (backApplyDetails.getNum() != null && backApplyDetails.getPreNum() != null) {
|
||||
if (backApplyDetails.getNum() < backApplyDetails.getPreNum()) {
|
||||
return AjaxResult.error("退料数量不能大于预退数量,请重新填写!");
|
||||
}
|
||||
}
|
||||
}
|
||||
try {
|
||||
//针对修改,先删除,后添加
|
||||
//对传入的手机号进行校验
|
||||
|
|
@ -483,4 +547,183 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService {
|
|||
return AjaxResult.success(backApplyInfoMapper.getMachineById(dto));
|
||||
}
|
||||
|
||||
/**
|
||||
* 提交退料申请
|
||||
* @param backApplyInfo
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public AjaxResult submitBackApply(BackApplyInfo backApplyInfo) {
|
||||
// 根据传入的id查询退料申请信息
|
||||
List<BackApplyInfo> applyInfoList = backApplyInfoMapper.selectBackDetails(backApplyInfo.getId());
|
||||
// 设置更新信息
|
||||
backApplyInfo.setUpdateBy(SecurityUtils.getUsername());
|
||||
backApplyInfo.setUpdateTime(DateUtils.getNowDate());
|
||||
backApplyInfo.setTaskStatus(2);
|
||||
// 更新任务表及退料申请表状态
|
||||
int result = updateTaskAndBackInfo(backApplyInfo);
|
||||
if (result > 0 && CollectionUtils.isNotEmpty(applyInfoList)) {
|
||||
for (BackApplyInfo applyInfo : applyInfoList) {
|
||||
// 查询待维修的机具设备
|
||||
backApplyInfo.setTypeId(applyInfo.getTypeId());
|
||||
List<BackApplyInfo> wxList = backApplyInfoMapper.getWxList(backApplyInfo);
|
||||
if (CollectionUtils.isNotEmpty(wxList)) {
|
||||
// 插入任务表
|
||||
Long newTaskId = insertTt(SecurityUtils.getUsername());
|
||||
// 插入协议任务表
|
||||
result += insertTta(newTaskId, wxList);
|
||||
// 插入维修记录表
|
||||
result += insertRad(newTaskId, wxList);
|
||||
// 更新结算表
|
||||
int res = updateSlt4Bean(backApplyInfo, applyInfo);
|
||||
// 检查机具是否领料
|
||||
if (res == 0) {
|
||||
throw new RuntimeException("该机具未被领料使用");
|
||||
}
|
||||
// 完成退料部分,更新 back_check_details
|
||||
finishBackCheckDetails(backApplyInfo);
|
||||
}
|
||||
}
|
||||
// 如果所有操作都成功
|
||||
if (result > 0) {
|
||||
return AjaxResult.success();
|
||||
}
|
||||
}
|
||||
// 操作失败,返回错误
|
||||
return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), HttpCodeEnum.FAIL.getMsg());
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新任务表及退料申请表状态
|
||||
* @param backApplyInfo
|
||||
* @return
|
||||
*/
|
||||
private int updateTaskAndBackInfo(BackApplyInfo backApplyInfo) {
|
||||
int result = backApplyInfoMapper.updateTaskStatus(backApplyInfo);
|
||||
result += backApplyInfoMapper.updateBack(backApplyInfo);
|
||||
result += backApplyInfoMapper.updateBackDetails(backApplyInfo);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新结算表
|
||||
* @param record
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
private int updateSlt4Bean(BackApplyInfo record, BackApplyInfo bean) {
|
||||
List<SltAgreementInfo> infoList = backApplyInfoMapper.getStlInfo(bean);
|
||||
if (infoList.size() > 0) {
|
||||
Integer backNum = bean.getBackNum();
|
||||
for (SltAgreementInfo info : infoList) {
|
||||
Integer num = info.getBackNum();
|
||||
if (backNum.equals(num)) {
|
||||
backApplyInfoMapper.updateStlInfo(info, record);
|
||||
break;
|
||||
} else if (backNum > num) {
|
||||
backNum = backNum - num;
|
||||
backApplyInfoMapper.updateStlInfo(info, record);
|
||||
} else {
|
||||
Integer many = num - backNum;
|
||||
backApplyInfoMapper.updateStlInfoTwo(info, record, backNum);
|
||||
backApplyInfoMapper.insStlInfoTwo(info, many);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* 完成退料申请
|
||||
* @param backApplyInfo
|
||||
*/
|
||||
private void finishBackCheckDetails(BackApplyInfo backApplyInfo) {
|
||||
backApplyInfoMapper.updateCheckDetails(backApplyInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 插入维修记录表
|
||||
* @param taskId
|
||||
* @param wxList
|
||||
* @return
|
||||
*/
|
||||
private int insertRad(Long taskId, List<BackApplyInfo> wxList) {
|
||||
int result = 0;
|
||||
if (wxList != null) {
|
||||
for (BackApplyInfo wx : wxList) {
|
||||
wx.setTaskId(taskId);
|
||||
wx.setStatus("0");
|
||||
result = backApplyInfoMapper.insertRad(wx);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 插入协议任务表
|
||||
* @param taskId
|
||||
* @param list
|
||||
* @return
|
||||
*/
|
||||
private int insertTta(Long taskId, List<BackApplyInfo> list) {
|
||||
int res;
|
||||
String agreementId = String.valueOf(list.get(0).getAgreementId());
|
||||
BackApplyInfo backApplyInfo = new BackApplyInfo();
|
||||
backApplyInfo.setAgreementId(Long.parseLong(agreementId));
|
||||
backApplyInfo.setTaskId(taskId);
|
||||
backApplyInfo.setCreateBy(SecurityUtils.getUsername());
|
||||
res = backApplyInfoMapper.insertTaskAgreement(backApplyInfo);
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* 插入任务表
|
||||
* @param createBy
|
||||
* @return
|
||||
*/
|
||||
private Long insertTt(String createBy) {
|
||||
Long newTask = null;
|
||||
// 生成维修单号
|
||||
String code = genCodeRule();
|
||||
BackApplyInfo applyInfo = new BackApplyInfo();
|
||||
applyInfo.setTaskType(4); // 设置任务类型
|
||||
applyInfo.setCode(code); // 设置单号
|
||||
applyInfo.setCreateBy(createBy); // 设置创建者
|
||||
applyInfo.setTaskStatus(0);
|
||||
// 插入任务
|
||||
int taskId = backApplyInfoMapper.insertTmTask(applyInfo);
|
||||
// 如果插入成功且返回的 taskId 大于 0
|
||||
if (taskId > 0 && applyInfo.getTaskId() > 0) {
|
||||
newTask = applyInfo.getTaskId();
|
||||
}
|
||||
return newTask;
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成维修单号
|
||||
* @return
|
||||
*/
|
||||
private String genCodeRule() {
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
|
||||
Date nowDate = DateUtils.getNowDate();
|
||||
String format = dateFormat.format(nowDate);
|
||||
Integer taskNum = backApplyInfoMapper.selectTaskNumByMonthWx(nowDate);
|
||||
String taskNumStr = "";
|
||||
if (taskNum != null) {
|
||||
// 将字符串转换为整数
|
||||
// int num = Integer.parseInt(taskNum);
|
||||
// 执行加一操作
|
||||
taskNum++;
|
||||
// 将结果转换回字符串格式,并确保结果是四位数,不足四位则在前面补0
|
||||
taskNumStr = String.format("%02d", taskNum);
|
||||
} else {
|
||||
taskNumStr = "01";
|
||||
}
|
||||
return "WX" + format + "-" + taskNumStr;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,6 +45,8 @@ public class SltAgreementInfo extends BaseEntity {
|
|||
@ApiModelProperty(value = "领料数量")
|
||||
private Long num;
|
||||
|
||||
private Integer backNum;
|
||||
|
||||
/** 领料时间 */
|
||||
@ApiModelProperty(value = "领料时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<select id="selectBackApplyInfoList" resultType="com.bonus.material.back.domain.BackApplyInfo">
|
||||
SELECT
|
||||
bai.id as id,
|
||||
bai.task_id as taskId,
|
||||
bai.`code` as code,
|
||||
bai.back_person as backPerson,
|
||||
bai.phone as phone,
|
||||
|
|
@ -196,6 +197,78 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
where bcd.parent_id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="selectBackDetails" resultType="com.bonus.material.back.domain.BackApplyInfo">
|
||||
SELECT
|
||||
bai.id AS id,
|
||||
tta.agreement_id AS agreementId,
|
||||
bai.task_id AS taskId,
|
||||
bcd.type_id AS typeId,
|
||||
SUM(bcd.back_num) AS backNum,
|
||||
bcd.parent_id AS parentId,
|
||||
bcd.create_by AS createBy,
|
||||
bcd.ma_id AS maId
|
||||
FROM
|
||||
back_check_details bcd
|
||||
LEFT JOIN back_apply_info bai ON bai.id = bcd.parent_id
|
||||
LEFT JOIN tm_task_agreement tta ON tta.task_id = bai.task_id
|
||||
WHERE
|
||||
bcd.parent_id = #{id} and (bcd.is_finished is null or bcd.is_finished != 1)
|
||||
GROUP By bcd.type_id,bcd.ma_id
|
||||
</select>
|
||||
|
||||
<select id="getWxList" resultType="com.bonus.material.back.domain.BackApplyInfo">
|
||||
SELECT
|
||||
bai.id as id,
|
||||
tta.agreement_id as agreementId,
|
||||
bai.task_id as taskId,
|
||||
bcd.type_id as typeId,
|
||||
bcd.back_num as backNum,
|
||||
bcd.parent_id as parentId,
|
||||
bcd.create_by as createBy,
|
||||
bcd.ma_id as maId,
|
||||
bai.company_id as companyId
|
||||
FROM
|
||||
back_check_details bcd
|
||||
LEFT JOIN back_apply_info bai on bai.id=bcd.parent_id
|
||||
LEFT JOIN tm_task_agreement tta on tta.task_id=bai.task_id
|
||||
WHERE
|
||||
bcd.parent_id = #{id}
|
||||
and bcd.type_id = #{typeId}
|
||||
and bcd.back_status = '1'
|
||||
</select>
|
||||
|
||||
<select id="selectTaskNumByMonthWx" resultType="java.lang.Integer">
|
||||
select count(*) from tm_task where DATE_FORMAT(create_time,'%y%m') = DATE_FORMAT(#{date},'%y%m') and task_type = 4
|
||||
</select>
|
||||
|
||||
<select id="getStlInfo" 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
|
||||
agreement_id = #{agreementId}
|
||||
AND type_id = #{typeId}
|
||||
AND status = 0
|
||||
<if test="maId != null">
|
||||
AND ma_id = #{maId}
|
||||
</if>
|
||||
order by start_time asc
|
||||
</select>
|
||||
|
||||
<insert id="insertBackApplyInfo" parameterType="com.bonus.material.back.domain.BackApplyInfo" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into back_apply_info
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
|
|
@ -335,6 +408,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="preNum != null">back_num,</if>
|
||||
<if test="maId != null">ma_id,</if>
|
||||
<if test="status != null">status,</if>
|
||||
<if test="backStatus != null">back_status,</if>
|
||||
<if test="isFinished != null">is_finished,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="remark != null">remark,</if>
|
||||
|
|
@ -347,6 +422,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="preNum != null">#{preNum},</if>
|
||||
<if test="maId != null">#{maId},</if>
|
||||
<if test="status != null">#{status},</if>
|
||||
<if test="backStatus != null">#{backStatus},</if>
|
||||
<if test="isFinished != null">#{isFinished},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="remark != null">#{remark},</if>
|
||||
|
|
@ -355,6 +432,70 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</trim>
|
||||
</insert>
|
||||
|
||||
<insert id="insertRad">
|
||||
insert into repair_apply_details
|
||||
(
|
||||
<if test="taskId != null">
|
||||
task_id,
|
||||
</if>
|
||||
<if test="maId != null">
|
||||
ma_id,
|
||||
</if>
|
||||
<if test="typeId != null">
|
||||
type_id,
|
||||
</if>
|
||||
<if test="backNum != null">
|
||||
repair_num,
|
||||
</if>
|
||||
<if test="status != null">
|
||||
status,
|
||||
</if>
|
||||
<if test="createBy != null and createBy != ''">
|
||||
create_by,
|
||||
</if>
|
||||
<if test="remark != null and remark != ''">
|
||||
remark,
|
||||
</if>
|
||||
<if test="companyId != null">
|
||||
company_id,
|
||||
</if>
|
||||
<if test="id != null">
|
||||
back_id,
|
||||
</if>
|
||||
create_time
|
||||
)
|
||||
values (
|
||||
<if test="taskId != null">
|
||||
#{taskId},
|
||||
</if>
|
||||
<if test="maId != null">
|
||||
#{maId},
|
||||
</if>
|
||||
<if test="typeId != null">
|
||||
#{typeId},
|
||||
</if>
|
||||
<if test="backNum != null">
|
||||
#{backNum},
|
||||
</if>
|
||||
<if test="status != null">
|
||||
#{status},
|
||||
</if>
|
||||
<if test="createBy != null and createBy != ''">
|
||||
#{createBy},
|
||||
</if>
|
||||
<if test="remark != null and remark != ''">
|
||||
#{remark},
|
||||
</if>
|
||||
<if test="companyId != null">
|
||||
#{companyId},
|
||||
</if>
|
||||
<if test="id != null">
|
||||
#{id},
|
||||
</if>
|
||||
NOW()
|
||||
)
|
||||
</insert>
|
||||
|
||||
<update id="updateBackApplyInfo" parameterType="com.bonus.material.back.domain.BackApplyInfo">
|
||||
update back_apply_info
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
|
|
@ -375,6 +516,45 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
<update id="updateTaskStatus">
|
||||
update tm_task set task_status = #{taskStatus} where task_id = #{taskId}
|
||||
</update>
|
||||
|
||||
<update id="updateBack">
|
||||
update back_apply_info set status = #{taskStatus} where id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="updateBackDetails">
|
||||
update back_apply_details set status = #{taskStatus} where parent_id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="updateCheckDetails">
|
||||
update back_check_details set is_finished = '1', update_time = now() where parent_id = #{id} and type_id = #{typeId} and (is_finished is null or is_finished != 1)
|
||||
</update>
|
||||
|
||||
<update id="updateStlInfo">
|
||||
update slt_agreement_info
|
||||
set end_time = now(),
|
||||
update_time = now(),
|
||||
back_id = #{record.id},
|
||||
status = '1'
|
||||
where id = #{info.id}
|
||||
</update>
|
||||
|
||||
<update id="updateStlInfoTwo">
|
||||
update slt_agreement_info
|
||||
set num = #{backNum},
|
||||
end_time = now(),
|
||||
update_time = now(),
|
||||
back_id = #{record.id},
|
||||
status = '1'
|
||||
where id = #{info.id}
|
||||
</update>
|
||||
|
||||
<insert id="insStlInfoTwo">
|
||||
insert into slt_agreement_info (agreement_id,type_id,ma_id,num,start_time,status,lease_id,lease_price,buy_price,is_slt,company_id,lease_type,create_time)
|
||||
values (#{info.agreementId},#{info.typeId},#{info.maId},#{many},#{info.startTime},#{info.status},#{info.leaseId},#{info.leasePrice},#{info.buyPrice},'0',#{info.companyId},#{info.leaseType},now());
|
||||
</insert>
|
||||
|
||||
<delete id="deleteBackApplyInfoById" parameterType="Long">
|
||||
delete from back_apply_info where id = #{id}
|
||||
|
|
|
|||
Loading…
Reference in New Issue