Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
liuchuan 2023-12-17 18:49:05 +08:00
commit c0e2037689
27 changed files with 899 additions and 106 deletions

View File

@ -2,9 +2,10 @@ package com.bonus.sgzb.base.api.domain;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
import lombok.Data;
/** /**
* Description: * Description:
@ -20,6 +21,8 @@ import lombok.Data;
@Data @Data
public class LeaseApplyDetails implements Serializable { public class LeaseApplyDetails implements Serializable {
private static final long serialVersionUID = 2227217051604273598L;
@ApiModelProperty(value = "") @ApiModelProperty(value = "")
private Integer id; private Integer id;
@ -47,10 +50,14 @@ public class LeaseApplyDetails implements Serializable {
@ApiModelProperty(value = "已领数量") @ApiModelProperty(value = "已领数量")
private Double alNum; private Double alNum;
/** 审批数量 */
@ApiModelProperty(value = "审批数量")
private Double auditNum;
/** /**
* 状态待审批进行中已出库 * 状态待审批进行中已出库
*/ */
@ApiModelProperty(value = "状态(待审批,进行中,已出库)") @ApiModelProperty(value = "状态(0待审批,1进行中,2已出库)")
private String status; private String status;
/** /**
@ -84,10 +91,9 @@ public class LeaseApplyDetails implements Serializable {
private String remark; private String remark;
/** /**
* 数据所属组织 * 设备所属类型
*/ */
@ApiModelProperty(value = "数据所属组织") @ApiModelProperty(value = "数据所属组织")
private Integer companyId; private Integer companyId;
private static final long serialVersionUID = 1L;
} }

View File

@ -2,9 +2,11 @@ package com.bonus.sgzb.base.api.domain;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
import lombok.Data; import java.util.List;
/** /**
* Description: * Description:
@ -20,6 +22,8 @@ import lombok.Data;
@Data @Data
public class LeaseApplyInfo implements Serializable { public class LeaseApplyInfo implements Serializable {
private static final long serialVersionUID = 4429196890466663037L;
@ApiModelProperty(value = "id") @ApiModelProperty(value = "id")
private Integer id; private Integer id;
@ -53,6 +57,10 @@ public class LeaseApplyInfo implements Serializable {
@ApiModelProperty(value = "11级审批22级审批") @ApiModelProperty(value = "11级审批22级审批")
private String type; private String type;
/** 机具规格详情列表 */
@ApiModelProperty(value = "机具规格详情列表")
private List<LeaseApplyDetails> leaseApplyDetails;
/** /**
* 公司审批人 * 公司审批人
*/ */
@ -89,6 +97,18 @@ public class LeaseApplyInfo implements Serializable {
@ApiModelProperty(value = "分管审批备注") @ApiModelProperty(value = "分管审批备注")
private String deptAuditRemark; private String deptAuditRemark;
/**
* 机具分公司审批人
*/
@ApiModelProperty(value = "机具分公司审批人")
private String directAuditBy;
/**
* 机具分公司审批时间
*/
@ApiModelProperty(value = "机具分公司审批时间")
private String directAuditTime;
/** /**
* 创建者 * 创建者
*/ */
@ -120,10 +140,9 @@ public class LeaseApplyInfo implements Serializable {
private String remark; private String remark;
/** /**
* 数据所属组织 * 设备数据所属组织类型
*/ */
@ApiModelProperty(value = "数据所属组织") @ApiModelProperty(value = "设备数据所属组织类型")
private Integer companyId; private Integer companyId;
private static final long serialVersionUID = 1L;
} }

View File

@ -0,0 +1,79 @@
package com.bonus.sgzb.base.api.domain;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 领料出库详情表
* @TableName lease_out_details
* @Version 1.0
* @Author 阮世耀
* @Since 2023-12-17
*/
@ApiModel(description = "领料出库详情表", value = "LeaseOutDetails")
@Data
public class LeaseOutDetails implements Serializable {
private static final long serialVersionUID = 2040328845027085291L;
@ApiModelProperty(value = "id")
private Integer id;
/** 任务ID */
@ApiModelProperty(value = "任务ID")
private Integer parentId;
/** 规格ID */
@ApiModelProperty(value = "规格ID")
private Integer typeId;
/** 规格名称 */
@ApiModelProperty(value = "规格名称")
private String typeName;
/** maId */
@ApiModelProperty(value = "maId")
private Integer maId;
/** 协议ID */
@ApiModelProperty(value = "协议ID")
private String agreementId;
/** 预领料数 */
@ApiModelProperty(value = "预领料数")
private Double outNum;
/** 出库类型 */
@ApiModelProperty(value = "出库类型")
private String outType;
/** 创建者 */
@ApiModelProperty(value = "创建者")
private String createBy;
/** 创建时间 */
@ApiModelProperty(value = "创建时间")
private Date createTime;
/** 更新者 */
@ApiModelProperty(value = "更新者")
private String updateBy;
/** 更新时间 */
@ApiModelProperty(value = "更新时间")
private Date updateTime;
/** 备注 */
@ApiModelProperty(value = "备注")
private String remark;
/** 数据所属组织 */
@ApiModelProperty(value = "数据所属组织")
private Integer companyId;
}

View File

@ -2,12 +2,12 @@ package com.bonus.sgzb.base.api.domain;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import lombok.Data;
/** /**
* Description: 任务表tm_task * Description: 任务表tm_task
* @Author 阮世耀 * @Author 阮世耀
@ -32,13 +32,13 @@ public class TmTask implements Serializable {
/** /**
* 任务类型(定义数据字典) * 任务类型(定义数据字典)
*/ */
@ApiModelProperty(value="任务类型(定义数据字典)") @ApiModelProperty(value="任务类型(数据字典)")
private Integer taskType; private Integer taskType;
/** /**
* 任务状态(定义数据字典) * 任务状态(定义数据字典)
*/ */
@ApiModelProperty(value="任务状态(定义数据字典)") @ApiModelProperty(value="任务状态(数据字典)")
private Integer taskStatus; private Integer taskStatus;
/** /**
@ -89,6 +89,12 @@ public class TmTask implements Serializable {
@ApiModelProperty(value="领料任务实体") @ApiModelProperty(value="领料任务实体")
private LeaseApplyInfo leaseApplyInfo; private LeaseApplyInfo leaseApplyInfo;
/**
* 领料任务实体集合
*/
@ApiModelProperty(value="领料任务实体集合")
private List<LeaseApplyInfo> leaseApplyInfoList;
/** /**
* 领料任务详情集合 * 领料任务详情集合
*/ */

View File

@ -1,7 +1,5 @@
package com.bonus.sgzb.auth.service; package com.bonus.sgzb.auth.service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.bonus.sgzb.common.core.constant.CacheConstants; import com.bonus.sgzb.common.core.constant.CacheConstants;
import com.bonus.sgzb.common.core.constant.Constants; import com.bonus.sgzb.common.core.constant.Constants;
import com.bonus.sgzb.common.core.constant.SecurityConstants; import com.bonus.sgzb.common.core.constant.SecurityConstants;
@ -17,6 +15,8 @@ import com.bonus.sgzb.common.security.utils.SecurityUtils;
import com.bonus.sgzb.system.api.RemoteUserService; import com.bonus.sgzb.system.api.RemoteUserService;
import com.bonus.sgzb.system.api.domain.SysUser; import com.bonus.sgzb.system.api.domain.SysUser;
import com.bonus.sgzb.system.api.model.LoginUser; import com.bonus.sgzb.system.api.model.LoginUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import javax.annotation.Resource; import javax.annotation.Resource;
@ -159,6 +159,35 @@ public class SysLoginService
} }
} }
/**
* 根据手机号码重置密码判断Redis中是否有验证码如果有则通过验证并删除key
* @param phone 手机号码
* @param password 密码
* @param code 验证码
*/
private void resetPassword(String phone, String code, Long userId, String password) {
if (password.length() < UserConstants.PASSWORD_MIN_LENGTH || password.length() > UserConstants.PASSWORD_MAX_LENGTH) {
throw new ServiceException("密码长度必须在6到19个字符之间");
}
if (code.length() != UserConstants.CODE_MIN_LENGTH_LOGIN) {
throw new ServiceException("验证码长度需为6位");
}
if (phone.length() != UserConstants.PHONE_DEFAULT_LENGTH_LOGIN) {
throw new ServiceException("手机号码长度不在指定范围");
}
if (remoteUserService.checkCode(phone, code).getCode() != Constants.SUCCESS) {
throw new ServiceException("对不起,您输入的验证码:" + code + " 不存在,请输入有效的验证码");
} else {
// 已验证过的验证码需要清除
redisService.deleteObject("code_" + phone);
// 执行重置密码操作
SysUser user = new SysUser();
user.setUserId(userId);
user.setPassword(SecurityUtils.encryptPassword(password));
}
}
private void isBlackIp(String phone) { private void isBlackIp(String phone) {
String blackStr = Convert.toStr(redisService.getCacheObject(CacheConstants.SYS_LOGIN_BLACKIPLIST)); String blackStr = Convert.toStr(redisService.getCacheObject(CacheConstants.SYS_LOGIN_BLACKIPLIST));
if (IpUtils.isMatchedIp(blackStr, IpUtils.getIpAddr())) if (IpUtils.isMatchedIp(blackStr, IpUtils.getIpAddr()))

View File

@ -0,0 +1,44 @@
package com.bonus.sgzb.app.controller;
import com.bonus.sgzb.app.service.LeaseOutDetailsService;
import com.bonus.sgzb.base.api.domain.LeaseOutDetails;
import com.bonus.sgzb.common.core.web.controller.BaseController;
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
import com.bonus.sgzb.common.core.web.page.TableDataInfo;
import com.bonus.sgzb.common.log.annotation.Log;
import com.bonus.sgzb.common.log.enums.BusinessType;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
/**
* Description: 任务领料出库详情表控制器
*
* @Author 阮世耀
* @Create 2023/12/17 15:48
* @Version 1.0
*/
@RestController
@RequestMapping("/leaseOutDetails")
public class LeaseOutDetailsController extends BaseController {
@Resource
private LeaseOutDetailsService leaseOutDetailsService;
@Log(title = "获取领料出库详情表", businessType = BusinessType.QUERY)
@GetMapping("/getLeaseList")
public TableDataInfo getLeaseList(@RequestParam(value ="taskId", required = false, defaultValue = "") String taskId){
return getDataTable(leaseOutDetailsService.selectListByParentId(taskId));
}
/**
* 领料出库对库存处理
* @param record 出库内容
*/
@Log(title = "领料出库", businessType = BusinessType.UPDATE)
@PostMapping("/submitOut")
public AjaxResult submitOut(@RequestBody LeaseOutDetails record){
return leaseOutDetailsService.submitOut(record);
}
}

View File

@ -1,12 +1,14 @@
package com.bonus.sgzb.app.controller; package com.bonus.sgzb.app.controller;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import com.bonus.sgzb.base.api.domain.LeaseApplyDetails;
import com.bonus.sgzb.base.api.domain.LeaseApplyInfo;
import com.bonus.sgzb.base.api.domain.TmTask;
import com.bonus.sgzb.app.service.LeaseApplyDetailsService; import com.bonus.sgzb.app.service.LeaseApplyDetailsService;
import com.bonus.sgzb.app.service.LeaseApplyInfoService; import com.bonus.sgzb.app.service.LeaseApplyInfoService;
import com.bonus.sgzb.app.service.TmTaskService; import com.bonus.sgzb.app.service.TmTaskService;
import com.bonus.sgzb.base.api.domain.LeaseApplyDetails;
import com.bonus.sgzb.base.api.domain.LeaseApplyInfo;
import com.bonus.sgzb.base.api.domain.TmTask;
import com.bonus.sgzb.common.core.utils.StringUtils; import com.bonus.sgzb.common.core.utils.StringUtils;
import com.bonus.sgzb.common.core.web.controller.BaseController;
import com.bonus.sgzb.common.core.web.domain.AjaxResult; import com.bonus.sgzb.common.core.web.domain.AjaxResult;
import com.bonus.sgzb.common.log.annotation.Log; import com.bonus.sgzb.common.log.annotation.Log;
import com.bonus.sgzb.common.log.enums.BusinessType; import com.bonus.sgzb.common.log.enums.BusinessType;
@ -22,7 +24,7 @@ import java.util.List;
*/ */
@RestController @RestController
@RequestMapping("/tm_task") @RequestMapping("/tm_task")
public class TmTaskController { public class TmTaskController extends BaseController {
/** /**
* 服务对象 * 服务对象
@ -36,12 +38,25 @@ public class TmTaskController {
@Resource @Resource
private LeaseApplyDetailsService leaseApplyDetailsService; // 领料申请明细表Service private LeaseApplyDetailsService leaseApplyDetailsService; // 领料申请明细表Service
/**
* 领料审核分公司分管机具分公司统一接口
* @param task 审核信息
* @return 结果
*/
@Log(title = "领料审核", businessType = BusinessType.UPDATE)
@PostMapping("auditLeaseByCompany")
public AjaxResult auditLeaseByCompany(@RequestBody TmTask task) {
return toAjax(tmTaskService.updateLeaseTaskAuditInfo(task));
}
/** /**
* 往来单位提交工程领用机具信息 * 往来单位提交工程领用机具信息
* *
* @return 结果 * @return 结果
*/ */
@Log(title = "任务表", businessType = BusinessType.INSERT) @Log(title = "往来单位提交领料申请", businessType = BusinessType.INSERT)
@PostMapping("submitLeaseApply") @PostMapping("submitLeaseApply")
public AjaxResult submitLeaseApply(@RequestBody TmTask task) { public AjaxResult submitLeaseApply(@RequestBody TmTask task) {
if (StringUtils.isNull(task)) { if (StringUtils.isNull(task)) {
@ -105,6 +120,90 @@ public class TmTaskController {
} }
/**
* 机具分公司直接创建领料申请
* @param task 任务信息
* @return 结果
*/
@Log(title = "机具分公司创建领料申请", businessType = BusinessType.INSERT)
@PostMapping("directLeaseApply")
public AjaxResult directLeaseApply(@RequestBody TmTask task) {
if (StringUtils.isNull(task)) {
return AjaxResult.error("参数错误");
}
try {
// 创建任务
boolean addTaskResult = tmTaskService.insertSelective(task) > 0;
if (addTaskResult && task.getLeaseApplyInfo() != null) {
if (CollUtil.isNotEmpty(task.getLeaseApplyDetails())) {
return AjaxResult.error("领料设备明细为空,请重新选择后上传!");
}
if (StringUtils.isNull(task.getLeaseApplyInfo())) {
return AjaxResult.error("领料任务信息为空,请重新选择后上传!");
}
// 获取任务编号
String taskId = task.getId();
// 根据设备所属分公司拆分集合
List<List<LeaseApplyDetails>> deviceByCompanyList = CollUtil.group(task.getLeaseApplyDetails(), LeaseApplyDetails::getCompanyId);
// 对拆分后的集合进行遍历
for (List<LeaseApplyDetails> leaseApplyDetailsList : deviceByCompanyList) {
// 判断拆分后的集合内是否有数据
if (CollUtil.isNotEmpty(leaseApplyDetailsList)) {
// 对领料任务表的对象做数据处理
LeaseApplyInfo leaseApplyInfo = task.getLeaseApplyInfo();
leaseApplyInfo.setCode(tmTaskService.genderLeaseCode()); // 创建领料单号
leaseApplyInfo.setTaskId(Integer.valueOf(taskId)); // 设置任务ID
leaseApplyInfo.setCompanyId(leaseApplyDetailsList.get(0).getCompanyId()); // 设置设备所属分公司,用于交给哪家审核
leaseApplyInfo.setType("1"); // 设置审批层级先固定2层后期根据接口传入Type区分来源设定
// 创建领料任务返回领料任务编号
boolean addLeaseTaskResult = leaseApplyInfoService.genderLeaseCode(leaseApplyInfo) > 0;
// 领料任务创建完成进行领料任务明细插入
if (addLeaseTaskResult) {
// 领料任务编号
Integer leaseTaskId = leaseApplyInfo.getId();
if (StringUtils.isNotNull(leaseTaskId)) {
// 插入领料任务明细
boolean addLeaseTaskDetailsResult = leaseApplyDetailsService.batchInsert(leaseApplyDetailsList) > 0;
if (addLeaseTaskDetailsResult) {
System.out.println("领料任务创建成功");
} else {
System.out.println("领料任务创建成功,但领料任务明细插入失败");
}
}
} else {
return AjaxResult.error("创建领料任务失败,或领料明细为空");
}
}
}
if (StringUtils.isEmpty(taskId)) { return AjaxResult.error("任务编号为空,创建失败"); }
} else {
return AjaxResult.error("创建任务失败");
}
return AjaxResult.success("任务创建成功,已完成");
} catch (Exception e) {
return AjaxResult.error("创建任务失败," + e.getMessage());
}
}
/**
* 查询机具领料审核列表
* @param task 筛选条件
* @return 列表
*/
@Log(title = "查询机具领料审核列表", businessType = BusinessType.QUERY)
@GetMapping(value = "getLeaseAuditList")
public AjaxResult getLeaseAuditList(TmTask task) {
if (StringUtils.isNull(task)) {
return AjaxResult.error("参数错误");
}
List<TmTask> leaseAuditList = tmTaskService.getLeaseAuditList(task);
return AjaxResult.success(getDataTable(leaseAuditList));
}
/** /**
* 通过主键查询单条数据 * 通过主键查询单条数据
* *

View File

@ -0,0 +1,49 @@
package com.bonus.sgzb.app.mapper;
import com.bonus.sgzb.base.api.domain.LeaseOutDetails;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* Description:
*
* @Author 阮世耀
* @Create 2023/12/17 15:10
* @Version 1.0
*/
@Mapper
public interface LeaseOutDetailsMapper {
/** 查询出库详情 */
List<LeaseOutDetails> selectListByParentId(String parentId);
/**
* 修改 lease_apply_details 领料任务详细表的已领数量
*/
int updateLeaseApplyDetailsOutNum(@Param("record") LeaseOutDetails leaseOutDetails);
/** 插入领料出库详细表 */
int insert(LeaseOutDetails record);
/** 插入领料出库详情表 -- 根据字段选择注入 */
int insertSelective(LeaseOutDetails record);
/**
* 减少 (ma_type 设备规格表)的库存数量
*/
int updateMaTypeStockNum(@Param("record") LeaseOutDetails leaseOutDetails);
/**
* 修改机具设备(ma_machine表)的状态为在用
*/
int updateMaMachineStatus(@Param("record") LeaseOutDetails leaseOutDetails);
/**
* 插入(tm_task_agreement 任务协议表)协议信息
*/
int insertAgreementInfo(@Param("record") LeaseOutDetails leaseOutDetails);
}

View File

@ -1,10 +1,13 @@
package com.bonus.sgzb.app.mapper; package com.bonus.sgzb.app.mapper;
import com.bonus.sgzb.base.api.domain.LeaseApplyDetails;
import com.bonus.sgzb.base.api.domain.LeaseApplyInfo;
import com.bonus.sgzb.base.api.domain.TmTask; import com.bonus.sgzb.base.api.domain.TmTask;
import java.util.List;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List;
/** /**
* Description: * Description:
* @Author 阮世耀 * @Author 阮世耀
@ -14,6 +17,27 @@ import org.apache.ibatis.annotations.Param;
@Mapper @Mapper
public interface TmTaskMapper { public interface TmTaskMapper {
/**
* 获取领料审核列表 by TmTask
* @param record 筛选条件
* @return TmTask列表
*/
List<TmTask> getAuditListByLeaseTmTask(TmTask record);
List<LeaseApplyInfo> getAuditListByLeaseInfo(@Param("record") TmTask record);
List<LeaseApplyDetails> getLeaseApplyDetails(@Param("record") LeaseApplyInfo record);
/** 更新TmTask审批状态 */
int updateTmTaskAuditStatus(@Param("record") TmTask record);
/** 更新LeaseApplyInfo审批信息 */
int updateLeaseApplyInfoAuditInfo(@Param("record") LeaseApplyInfo record);
/** 更新leaseApplyDetails审批信息 */
int updateLeaseApplyDetailsAuditInfo(@Param("record") LeaseApplyDetails record);
int deleteByPrimaryKey(Long taskId); int deleteByPrimaryKey(Long taskId);
int insert(TmTask record); int insert(TmTask record);

View File

@ -0,0 +1,20 @@
package com.bonus.sgzb.app.service;
import com.bonus.sgzb.base.api.domain.LeaseOutDetails;
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
import java.util.List;
/**
* Description: 领料出库详情表Service接口
*
* @Author 阮世耀
* @Create 2023/12/17 15:06
* @Version 1.0
*/
public interface LeaseOutDetailsService {
List<LeaseOutDetails> selectListByParentId(String parentId);
AjaxResult submitOut(LeaseOutDetails record);
}

View File

@ -1,8 +1,9 @@
package com.bonus.sgzb.app.service; package com.bonus.sgzb.app.service;
import java.util.List;
import com.bonus.sgzb.base.api.domain.TmTask; import com.bonus.sgzb.base.api.domain.TmTask;
import java.util.List;
/** /**
* Description: 任务表Task * Description: 任务表Task
* @Author 阮世耀 * @Author 阮世耀
@ -12,6 +13,11 @@ import com.bonus.sgzb.base.api.domain.TmTask;
public interface TmTaskService{ public interface TmTaskService{
List<TmTask> getLeaseAuditList(TmTask record);
/** 领料任务审核状态 */
int updateLeaseTaskAuditInfo(TmTask record);
String genderLeaseCode(); String genderLeaseCode();
int deleteByPrimaryKey(Long taskId); int deleteByPrimaryKey(Long taskId);

View File

@ -0,0 +1,80 @@
package com.bonus.sgzb.app.service.impl;
import com.bonus.sgzb.app.mapper.LeaseOutDetailsMapper;
import com.bonus.sgzb.app.service.LeaseOutDetailsService;
import com.bonus.sgzb.base.api.domain.LeaseOutDetails;
import com.bonus.sgzb.common.core.utils.StringUtils;
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* Description: 领料出库详情接口实现类
*
* @Author 阮世耀
* @Create 2023/12/17 15:06
* @Version 1.0
*/
@Service(value = "LeaseOutDetailsService")
public class LeaseOutDetailsServiceImpl implements LeaseOutDetailsService {
@Resource
private LeaseOutDetailsMapper leaseOutDetailsMapper;
/**
* 根据任务id查询出库数据
* @param parentId 任务id
* @return 出库数据集合
*/
@Override
public List<LeaseOutDetails> selectListByParentId(String parentId) {
return leaseOutDetailsMapper.selectListByParentId(parentId);
}
/**
* 领料出库处理
* @param record 出库对象
* @return 结果
*/
@Override
public AjaxResult submitOut(LeaseOutDetails record) {
if (StringUtils.isNull(record)) {
return AjaxResult.error("领料出库失败,请检查参数是否填写完整!");
}
// 首先更新领料任务详情表的领料数及状态
int updateLeaseApplyDetailsOutNum = leaseOutDetailsMapper.updateLeaseApplyDetailsOutNum(record);
// 插入领料出库明细表
int insertSelectiveNum = leaseOutDetailsMapper.insertSelective(record);
// 减少 (ma_type 设备规格表)的库存数量
int updateMaTypeStockNum = leaseOutDetailsMapper.updateMaTypeStockNum(record);
// 更新 (ma_machine 设备表)的状态
int updateMaMachineStatus = leaseOutDetailsMapper.updateMaMachineStatus(record);
// 插入(tm_task_agreement 任务协议表)协议信息
int insertAgreementInfo = leaseOutDetailsMapper.insertAgreementInfo(record);
// 进行状态判断
if (updateLeaseApplyDetailsOutNum > 0) {
if (insertSelectiveNum > 0) {
if (updateMaTypeStockNum > 0) {
if (updateMaMachineStatus > 0) {
if (insertAgreementInfo > 0) {
return AjaxResult.success("领料出库成功!");
}
return AjaxResult.error("领料出库失败,插入任务协议信息错误!");
}
return AjaxResult.error("领料出库失败,最后更新设备状态错误!");
}
return AjaxResult.error("出库失败,更新设备规格库存数量时出错!");
}
return AjaxResult.error("出库失败,插入领料出库明细错误!");
}
return AjaxResult.error("出库操作失败,更新领料数量及状态时出错!");
}
}

View File

@ -1,12 +1,18 @@
package com.bonus.sgzb.app.service.impl; package com.bonus.sgzb.app.service.impl;
import com.bonus.sgzb.common.core.utils.DateUtils; import cn.hutool.core.collection.CollUtil;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import com.bonus.sgzb.base.api.domain.TmTask;
import com.bonus.sgzb.app.mapper.TmTaskMapper; import com.bonus.sgzb.app.mapper.TmTaskMapper;
import com.bonus.sgzb.app.service.TmTaskService; import com.bonus.sgzb.app.service.TmTaskService;
import com.bonus.sgzb.base.api.domain.LeaseApplyDetails;
import com.bonus.sgzb.base.api.domain.LeaseApplyInfo;
import com.bonus.sgzb.base.api.domain.TmTask;
import com.bonus.sgzb.common.core.utils.DateUtils;
import com.bonus.sgzb.common.core.utils.StringUtils;
import org.apache.commons.lang3.RandomStringUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/** /**
* Description: * Description:
* @Author 阮世耀 * @Author 阮世耀
@ -20,9 +26,74 @@ public class TmTaskServiceImpl implements TmTaskService{
@Resource @Resource
private TmTaskMapper tmTaskMapper; private TmTaskMapper tmTaskMapper;
/**
* 获取审核列表
*/
@Override
public List<TmTask> getLeaseAuditList(TmTask record) {
List<TmTask> tmTaskList = tmTaskMapper.getAuditListByLeaseTmTask(record);
for (TmTask tmTask : tmTaskList) {
if (tmTask != null) {
// 去查询任务分单表
List<LeaseApplyInfo> auditListByLeaseInfo = tmTaskMapper.getAuditListByLeaseInfo(tmTask);
if (auditListByLeaseInfo != null && !auditListByLeaseInfo.isEmpty()) {
// 对领料任务集合查询具体详情
for (LeaseApplyInfo leaseApplyInfo : auditListByLeaseInfo) {
if (leaseApplyInfo != null) {
// 去查询领料任务详情表
List<LeaseApplyDetails> leaseApplyDetails = tmTaskMapper.getLeaseApplyDetails(leaseApplyInfo);
if (leaseApplyDetails != null && !leaseApplyDetails.isEmpty()) {
// 塞入领料任务详情集合
leaseApplyInfo.setLeaseApplyDetails(leaseApplyDetails);
}
}
}
// 存入领料任务实体集合
tmTask.setLeaseApplyInfoList(auditListByLeaseInfo);
}
}
}
return tmTaskList;
}
/**
* 领料任务审核状态
*
* @param record 审核数据及信息
*/
@Override
public int updateLeaseTaskAuditInfo(TmTask record) {
int result = 0;
if (StringUtils.isNotNull(record)) {
// 先审核任务表
result += tmTaskMapper.updateTmTaskAuditStatus(record);
// 再审核领料任务信息表
if (CollUtil.isNotEmpty(record.getLeaseApplyInfoList())) {
for (LeaseApplyInfo leaseApplyInfo : record.getLeaseApplyInfoList()) {
if (leaseApplyInfo != null) {
result += tmTaskMapper.updateLeaseApplyInfoAuditInfo(leaseApplyInfo);
// 再审核领料任务详情表
if (CollUtil.isNotEmpty(leaseApplyInfo.getLeaseApplyDetails())) {
for (LeaseApplyDetails leaseApplyDetails : leaseApplyInfo.getLeaseApplyDetails()) {
if (StringUtils.isNotNull(leaseApplyDetails)) {
result += tmTaskMapper.updateLeaseApplyDetailsAuditInfo(leaseApplyDetails);
}
}
}
}
}
}
} else {
return 0;
}
return result;
}
@Override @Override
public String genderLeaseCode() { public String genderLeaseCode() {
String code = "001"; //String code = "0001";
// 先生成随机4位字符后期根据数据库当月最大CODE值+1
String code = RandomStringUtils.randomAlphanumeric(4);
return "L" + DateUtils.getDate() + "-" + code; return "L" + DateUtils.getDate() + "-" + code;
} }

View File

@ -53,7 +53,8 @@ public class CommonUtil {
BigDecimal value = new BigDecimal(new Double(0).toString()); BigDecimal value = new BigDecimal(new Double(0).toString());
for (int i = 0; i < list.size(); i++) { for (int i = 0; i < list.size(); i++) {
Map<String, String> map = list.get(i); Map<String, String> map = list.get(i);
BigDecimal value2 = new BigDecimal(new Double(String.valueOf(map.get("num")))); String num = Objects.isNull(map.get("num")) ? "0" : String.valueOf(map.get("num"));
BigDecimal value2 = new BigDecimal(new Double(num));
value = value.add(value2); value = value.add(value2);
} }
double doubleValue = value.doubleValue(); double doubleValue = value.doubleValue();

View File

@ -0,0 +1,166 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.bonus.sgzb.app.mapper.LeaseOutDetailsMapper">
<select id="selectListByParentId" resultType="com.bonus.sgzb.base.api.domain.LeaseOutDetails">
SELECT
lod.id,lod.parent_id,lod.type_id,lod.ma_id,lod.out_num,lod.out_type,lod.create_by,
lod.create_time,lod.update_by,lod.update_time,lod.remark,lod.company_id
FROM
lease_out_details lod
<where>
<if test="_parameter != null and _parameter != '' ">
lod.parent_id = #{parentId}
</if>
</where>
</select>
<update id="updateLeaseApplyDetailsOutNum">
UPDATE
lease_apply_details
SET
al_num = al_num + 1,
<if test="record.updateBy != null and record.updateBy!= '' ">
update_by = #{record.updateBy},
</if>
update_time = now(),
status = '2'
WHERE
parennt_id = #{record.parentId} and type_id = #{record.typeId}
</update>
<insert id="insert">
insert into lease_out_details(parent_id,type_id,ma_id,out_num,out_type,create_by,create_time,update_by,update_time,remark,company_id)
values(#{parentId},#{typeId},#{maId},#{outNum},#{outType},#{createBy},now(),#{updateBy},now(),#{remark},#{companyId})
</insert>
<insert id="insertSelective">
insert into lease_out_details
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="parentId!= null">
parent_id,
</if>
<if test="typeId!= null">
type_id,
</if>
<if test="maId!= null">
ma_id,
</if>
<if test="outNum!= null">
out_num,
</if>
<if test="outType!= null">
out_type,
</if>
<if test="createBy!= null">
create_by,
</if>
<if test="updateBy!= null">
update_by,
</if>
<if test="remark!= null">
remark,
</if>
<if test="companyId!= null">
company_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="parentId!= null">
#{parentId},
</if>
<if test="typeId!= null">
#{typeId},
</if>
<if test="maId!= null">
#{maId},
</if>
<if test="outNum!= null">
#{outNum},
</if>
<if test="outType!= null">
#{outType},
</if>
<if test="createBy!= null">
#{createBy},
</if>
<if test="updateBy!= null">
#{updateBy},
</if>
<if test="remark!= null">
#{remark},
</if>
<if test="companyId!= null">
#{companyId},
</if>
</trim>
</insert>
<update id="updateMaTypeStockNum">
UPDATE
ma_type
SET
num = num - #{record.outNum}
WHERE
type_id = #{record.typeId}
</update>
<update id="updateMaMachineStatus">
UPDATE
ma_machine
SET
ma_status = '16'
<where>
type_id = #{record.typeId}
<if test="record.maId != null and record.maId != ''">
and ma_id = #{record.maId}
</if>
</where>
</update>
<insert id="insertAgreementInfo">
insert into tm_task_agreement
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="record.parentId != null">
task_id,
</if>
<if test="record.agreementId!= null">
agreement_id,
</if>
<if test="record.createBy!= null">
create_by,
</if>
<if test="record.updateBy!= null">
update_by,
</if>
<if test="record.remark!= null">
remark,
</if>
<if test="record.companyId!= null">
company_id,
</if>
create_time
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="record.parentId != null">
#{record.parentId},
</if>
<if test="record.agreementId != null">
#{record.typeId},
</if>
<if test="record.createBy != null">
#{record.createBy},
</if>
<if test="record.updateBy != null">
#{record.updateBy},
</if>
<if test="record.remark != null">
#{record.remark},
</if>
<if test="record.companyId != null">
#{record.companyId},
</if>
now()
</trim>
</insert>
</mapper>

View File

@ -447,4 +447,78 @@
</trim> </trim>
</insert> </insert>
<select id="getAuditListByLeaseTmTask" resultType="com.bonus.sgzb.base.api.domain.TmTask">
SELECT tt.* FROM tm_task tt WHERE tt.task_type = '29'
</select>
<select id="getAuditListByLeaseInfo" resultType="com.bonus.sgzb.base.api.domain.LeaseApplyInfo">
SELECT
lai.*
FROM
lease_apply_info lai
WHERE
lai.task_id = #{record.taskId} AND lai.`code` = #{record.code}
</select>
<select id="getLeaseApplyDetails" resultType="com.bonus.sgzb.base.api.domain.LeaseApplyDetails">
SELECT
lad.*
FROM
lease_apply_details lad
WHERE
lad.parennt_id = #{record.taskId} AND lad.company_id = #{record.companyId}
</select>
<update id="updateTmTaskAuditStatus">
UPDATE tm_task SET task_status = #{record.taskStatus} WHERE task_id = #{record.taskId}
</update>
<update id="updateLeaseApplyInfoAuditInfo">
UPDATE
lease_apply_info
set
<trim suffixOverrides=",">
<if test="record.companyAuditBy != null and record.companyAuditBy != ''">
company_audit_by = #{record.companyAuditBy},
company_audit_time = #{record.companyAuditTime},
company_audit_remark = #{record.companyAuditRemark},
</if>
<if test="record.deptAuditBy != null and record.deptAuditBy != ''">
dept_audit_by = #{record.companyAuditBy},
dept_audit_time = #{record.companyAuditTime},
dept_audit_remark = #{record.companyAuditRemark},
</if>
<if test="record.directAuditBy != null and record.directAuditBy != ''">
direct_audit_by = #{record.directAuditBy},
direct_audit_time = #{record.directAuditTime}
</if>
</trim>
WHERE
task_id = #{record.taskId}
</update>
<update id="updateLeaseApplyDetailsAuditInfo">
update
lease_apply_details
set
<trim suffixOverrides=",">
<if test="record.auditNum != null and record.auditNum != '' ">
audit_num = #{record.auditNum},
</if>
<if test="record.alNum != null and record.alNum != '' ">
al_num = #{record.alNum},
</if>
<if test="record.status!= null and record.status!= '' ">
status = #{record.status},
</if>
<if test="record.updateBy != null and record.updateBy != '' ">
update_by = #{record.updateBy},
</if>
<if test="record.updateTime!= null and record.updateTime != '' ">
update_time = #{record.updateTime}
</if>
</trim>
where
parennt_id = #{record.parenntId}
</update>
</mapper> </mapper>

View File

@ -74,9 +74,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</if> </if>
/*入库*/ /*入库*/
<if test="type == 2"> <if test="type == 2">
SELECT mir.input_num, SELECT iad.input_num,
a.typeName a.typeName
FROM ma_input_record mir FROM input_apply_details iad
LEFT JOIN ( LEFT JOIN (
SELECT mt.type_id,mt4.type_name AS typeName SELECT mt.type_id,mt4.type_name AS typeName
FROM ma_type mt FROM ma_type mt
@ -84,8 +84,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
LEFT JOIN ma_type mt3 ON mt2.parent_id = mt3.type_id AND mt3.`level` = '2' LEFT JOIN ma_type mt3 ON mt2.parent_id = mt3.type_id AND mt3.`level` = '2'
LEFT JOIN ma_type mt4 ON mt3.parent_id = mt4.type_id AND mt4.`level` = '1' LEFT JOIN ma_type mt4 ON mt3.parent_id = mt4.type_id AND mt4.`level` = '1'
WHERE mt.`level` = '4' WHERE mt.`level` = '4'
)a ON mir.type_id = a.type_id )a ON iad.type_id = a.type_id
WHERE mir.create_time BETWEEN CONCAT(#{startDate}, ' 00:00:00') AND CONCAT(#{endDate}, ' 23:59:59') AND mir.input_type = '1' WHERE iad.create_time BETWEEN CONCAT(#{startDate}, ' 00:00:00') AND CONCAT(#{endDate}, ' 23:59:59') AND iad.input_type = '1'
<if test="maType!=null and maType == 1"> <if test="maType!=null and maType == 1">
AND a.typeName = #{maTypeName} AND a.typeName = #{maTypeName}
</if> </if>

View File

@ -1,12 +1,12 @@
package com.bonus.sgzb.base.controller; package com.bonus.sgzb.material.controller;
import com.bonus.sgzb.base.domain.RepairTestInputDetailVo;
import com.bonus.sgzb.base.domain.RepairTestInputDto;
import com.bonus.sgzb.base.domain.RepairTestInputVo;
import com.bonus.sgzb.base.service.RepairTestInputService;
import com.bonus.sgzb.common.core.web.controller.BaseController; import com.bonus.sgzb.common.core.web.controller.BaseController;
import com.bonus.sgzb.common.core.web.domain.AjaxResult; import com.bonus.sgzb.common.core.web.domain.AjaxResult;
import com.bonus.sgzb.common.core.web.page.TableDataInfo; import com.bonus.sgzb.common.core.web.page.TableDataInfo;
import com.bonus.sgzb.material.domain.RepairTestInputDetailVo;
import com.bonus.sgzb.material.domain.RepairTestInputDto;
import com.bonus.sgzb.material.domain.RepairTestInputVo;
import com.bonus.sgzb.material.service.RepairTestInputService;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;

View File

@ -1,4 +1,4 @@
package com.bonus.sgzb.base.domain; package com.bonus.sgzb.material.domain;
import lombok.Data; import lombok.Data;

View File

@ -1,4 +1,4 @@
package com.bonus.sgzb.base.domain; package com.bonus.sgzb.material.domain;
import lombok.Data; import lombok.Data;
@ -15,4 +15,7 @@ public class RepairTestInputDto {
/** 关键字*/ /** 关键字*/
private String keyWord; private String keyWord;
/** 状态*/
private String status;
} }

View File

@ -1,4 +1,4 @@
package com.bonus.sgzb.base.domain; package com.bonus.sgzb.material.domain;
import lombok.Data; import lombok.Data;

View File

@ -1,4 +1,4 @@
package com.bonus.sgzb.base.domain; package com.bonus.sgzb.material.domain;
import lombok.Data; import lombok.Data;

View File

@ -1,9 +1,9 @@
package com.bonus.sgzb.base.mapper; package com.bonus.sgzb.material.mapper;
import com.bonus.sgzb.base.domain.RepairTestInputDetailVo; import com.bonus.sgzb.material.domain.RepairTestInputDetailVo;
import com.bonus.sgzb.base.domain.RepairTestInputDto; import com.bonus.sgzb.material.domain.RepairTestInputDto;
import com.bonus.sgzb.base.domain.RepairTestInputVo; import com.bonus.sgzb.material.domain.RepairTestInputVo;
import com.bonus.sgzb.base.domain.RepairTestWarehousingDto; import com.bonus.sgzb.material.domain.RepairTestWarehousingDto;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
@ -104,5 +104,5 @@ public interface RepairTestInputMapper {
* @author cwchen * @author cwchen
* @date 2023/12/16 21:19 * @date 2023/12/16 21:19
*/ */
void updateTmTaskStatus(@Param("params") RepairTestWarehousingDto dto,@Param("dictId") int dicId); void updateTmTaskStatus(@Param("params") RepairTestWarehousingDto dto, @Param("dictId") int dicId);
} }

View File

@ -1,9 +1,9 @@
package com.bonus.sgzb.base.service; package com.bonus.sgzb.material.service;
import com.bonus.sgzb.base.domain.RepairTestInputDetailVo;
import com.bonus.sgzb.base.domain.RepairTestInputDto;
import com.bonus.sgzb.base.domain.RepairTestInputVo;
import com.bonus.sgzb.common.core.web.domain.AjaxResult; import com.bonus.sgzb.common.core.web.domain.AjaxResult;
import com.bonus.sgzb.material.domain.RepairTestInputDetailVo;
import com.bonus.sgzb.material.domain.RepairTestInputDto;
import com.bonus.sgzb.material.domain.RepairTestInputVo;
import java.util.List; import java.util.List;

View File

@ -1,18 +1,19 @@
package com.bonus.sgzb.base.service.impl; package com.bonus.sgzb.material.service.impl;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.bonus.sgzb.base.domain.RepairTestInputDetailVo;
import com.bonus.sgzb.base.domain.RepairTestInputDto;
import com.bonus.sgzb.base.domain.RepairTestInputVo;
import com.bonus.sgzb.base.domain.RepairTestWarehousingDto;
import com.bonus.sgzb.base.mapper.RepairTestInputMapper;
import com.bonus.sgzb.base.service.RepairTestInputService;
import com.bonus.sgzb.common.core.constant.HttpStatus; import com.bonus.sgzb.common.core.constant.HttpStatus;
import com.bonus.sgzb.common.core.utils.DateTimeHelper; import com.bonus.sgzb.common.core.utils.DateTimeHelper;
import com.bonus.sgzb.common.core.utils.StringUtils; import com.bonus.sgzb.common.core.utils.StringUtils;
import com.bonus.sgzb.common.core.web.domain.AjaxResult; import com.bonus.sgzb.common.core.web.domain.AjaxResult;
import com.bonus.sgzb.common.security.utils.SecurityUtils; import com.bonus.sgzb.common.security.utils.SecurityUtils;
import com.bonus.sgzb.material.domain.RepairTestInputDetailVo;
import com.bonus.sgzb.material.domain.RepairTestInputDto;
import com.bonus.sgzb.material.domain.RepairTestInputVo;
import com.bonus.sgzb.material.domain.RepairTestWarehousingDto;
import com.bonus.sgzb.material.mapper.RepairTestInputMapper;
import com.bonus.sgzb.material.service.RepairTestInputService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport; import org.springframework.transaction.interceptor.TransactionAspectSupport;
@ -49,9 +50,12 @@ public class RepairTestInputServiceImpl implements RepairTestInputService {
public AjaxResult inputByType(String params) { public AjaxResult inputByType(String params) {
try { try {
if (StringUtils.isEmpty(params)) { if (StringUtils.isEmpty(params)) {
return AjaxResult.error(HttpStatus.ERROR, "参数类型不正确"); return AjaxResult.error(HttpStatus.ERROR, "参数不正确");
} }
List<RepairTestWarehousingDto> list = JSONObject.parseArray(params, RepairTestWarehousingDto.class); List<RepairTestWarehousingDto> list = JSONObject.parseArray(params, RepairTestWarehousingDto.class);
if(CollectionUtils.isEmpty(list)){
return AjaxResult.error(HttpStatus.ERROR, "参数不正确");
}
Long companyId = SecurityUtils.getLoginUser().getSysUser().getCompanyId(); Long companyId = SecurityUtils.getLoginUser().getSysUser().getCompanyId();
String updateTime = DateTimeHelper.getNowTime(); String updateTime = DateTimeHelper.getNowTime();
String updateBy = SecurityUtils.getLoginUser().getUsername(); String updateBy = SecurityUtils.getLoginUser().getUsername();
@ -60,7 +64,7 @@ public class RepairTestInputServiceImpl implements RepairTestInputService {
dto.setUpdateTime(updateTime); dto.setUpdateTime(updateTime);
dto.setUpdateBy(updateBy); dto.setUpdateBy(updateBy);
if (Objects.equals("2", dto.getCheckType())) { if (Objects.equals("2", dto.getCheckType())) {
// 审核不通过-入库数量修改为0 // 审核不通过-入库数量修改为 0
dto.setRepairNum("0"); dto.setRepairNum("0");
} }
// 更新修试后入库数据 // 更新修试后入库数据
@ -80,20 +84,21 @@ public class RepairTestInputServiceImpl implements RepairTestInputService {
mapper.updateMaMachineStatus(dicId,dto.getMaId()); mapper.updateMaMachineStatus(dicId,dto.getMaId());
} }
} }
// 查询修试后入库的状态是否全部更新更新任务表状态 }
Map<String, Object> numMap = mapper.getIsAllUpdate(dto); RepairTestWarehousingDto dto = list.get(0);
// 总量未审核数量入库数量驳回数量 // 查询修试后入库的状态是否全部更新更新任务表状态
int totalNum = Integer.parseInt(String.valueOf(numMap.get("num"))); Map<String, Object> numMap = mapper.getIsAllUpdate(dto);
int noCheckNum = Integer.parseInt(String.valueOf(numMap.get("noCheckNum"))); // 总量未审核数量入库数量驳回数量
int passNum = Integer.parseInt(String.valueOf(numMap.get("passNum"))); int totalNum = Integer.parseInt(String.valueOf(numMap.get("totalNum")));
int noPassNum = Integer.parseInt(String.valueOf(numMap.get("noPassNum"))); int noCheckNum = Integer.parseInt(String.valueOf(numMap.get("noCheckNum")));
if(passNum == totalNum){ int passNum = Integer.parseInt(String.valueOf(numMap.get("passNum")));
int dicId = mapper.getDicByMaStatusId("rk_task","入库完成"); int noPassNum = Integer.parseInt(String.valueOf(numMap.get("noPassNum")));
mapper.updateTmTaskStatus(dto,dicId); if(passNum == totalNum){
}else if(noPassNum > 0){ int dicId = mapper.getDicByMaStatusId("rk_task","入库完成");
int dicId = mapper.getDicByMaStatusId("rk_task","入库驳回"); mapper.updateTmTaskStatus(dto,dicId);
mapper.updateTmTaskStatus(dto,dicId); }else if(noPassNum > 0 && noCheckNum == 0){
} int dicId = mapper.getDicByMaStatusId("rk_task","入库驳回");
mapper.updateTmTaskStatus(dto,dicId);
} }
} catch (Exception e) { } catch (Exception e) {
//手动回滚异常 //手动回滚异常
@ -118,7 +123,7 @@ public class RepairTestInputServiceImpl implements RepairTestInputService {
value = value.add(repairNumValue); value = value.add(repairNumValue);
if (Objects.nonNull(num)) { if (Objects.nonNull(num)) {
BigDecimal numValue = new BigDecimal(new Double(String.valueOf(num)).toString()); BigDecimal numValue = new BigDecimal(new Double(String.valueOf(num)).toString());
value.add(numValue); value = value.add(numValue);
} }
return value.doubleValue(); return value.doubleValue();
} }

View File

@ -2,7 +2,7 @@
<!DOCTYPE mapper <!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.bonus.sgzb.base.mapper.RepairTestInputMapper"> <mapper namespace="com.bonus.sgzb.material.mapper.RepairTestInputMapper">
<!--新增入库任务详细表-数据--> <!--新增入库任务详细表-数据-->
<insert id="addInputApplyDetails"> <insert id="addInputApplyDetails">
INSERT INTO input_apply_details INSERT INTO input_apply_details
@ -37,7 +37,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<set> <set>
<if test="repairNum != null and repairNum != ''">input_num = #{repairNum},</if> <if test="repairNum != null and repairNum != ''">input_num = #{repairNum},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if> <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
<if test="updateTime != null and updateTime != ''">update_time = #{status},</if> <if test="updateTime != null and updateTime != ''">update_time = #{updateTime},</if>
<if test="checkType != null and checkType != ''">`status` = #{checkType},</if> <if test="checkType != null and checkType != ''">`status` = #{checkType},</if>
<if test="remark != null and remark != ''">`remark` = #{remark}</if> <if test="remark != null and remark != ''">`remark` = #{remark}</if>
</set> </set>
@ -53,11 +53,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</update> </update>
<!--更新任务表状态--> <!--更新任务表状态-->
<update id="updateTmTaskStatus"> <update id="updateTmTaskStatus">
UPDATE tm_task SET task_status = #{dictId} WHERE task_id = #{params.taskId} UPDATE tm_task SET task_status = #{dictId},update_by = #{params.updateBy},update_time = #{params.updateTime} WHERE task_id = #{params.taskId}
</update> </update>
<!--获取修试后入库列表--> <!--获取修试后入库列表-->
<select id="getRepairedList" resultType="com.bonus.sgzb.base.domain.RepairTestInputVo"> <select id="getRepairedList" resultType="com.bonus.sgzb.material.domain.RepairTestInputVo">
SELECT ANY_VALUE(rid.task_id) AS id, SELECT ANY_VALUE(rid.task_id) AS id,
ANY_VALUE(tt.`code`) AS repairCode, ANY_VALUE(tt.`code`) AS repairCode,
ANY_VALUE(GROUP_CONCAT(a.typeName)) AS maTypeName, ANY_VALUE(GROUP_CONCAT(a.typeName)) AS maTypeName,
@ -85,9 +85,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</if> </if>
</where> </where>
GROUP BY rid.task_id GROUP BY rid.task_id
ORDER BY tt.create_time DESC
</select> </select>
<!--获取修试后入库-详情列表--> <!--获取修试后入库-详情列表-->
<select id="getRepairedDetailList" resultType="com.bonus.sgzb.base.domain.RepairTestInputDetailVo"> <select id="getRepairedDetailList" resultType="com.bonus.sgzb.material.domain.RepairTestInputDetailVo">
SELECT rid.id, SELECT rid.id,
rid.ma_id AS maId, rid.ma_id AS maId,
rid.type_id AS typeId, rid.type_id AS typeId,
@ -117,6 +118,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
INSTR(a.typeName2,#{keyWord}) > 0 INSTR(a.typeName2,#{keyWord}) > 0
) )
</if> </if>
<if test="status!=null and status!=''">
AND rid.status = #{status}
</if>
ORDER BY rid.create_time DESC
</select> </select>
<!--查询机具类型-库存数量--> <!--查询机具类型-库存数量-->
<select id="getMaTypeByNum" resultType="java.util.Map"> <select id="getMaTypeByNum" resultType="java.util.Map">

View File

@ -1,30 +1,10 @@
package com.bonus.sgzb.system.controller; package com.bonus.sgzb.system.controller;
import java.io.IOException;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import com.bonus.sgzb.common.core.constant.Constants; import com.bonus.sgzb.common.core.constant.Constants;
import com.bonus.sgzb.common.core.constant.SecurityConstants; import com.bonus.sgzb.common.core.constant.SecurityConstants;
import com.bonus.sgzb.common.core.exception.ServiceException; import com.bonus.sgzb.common.core.constant.UserConstants;
import com.bonus.sgzb.system.api.RemoteUserService;
import com.bonus.sgzb.system.service.*;
import org.apache.commons.lang3.ArrayUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import com.bonus.sgzb.common.core.domain.R; import com.bonus.sgzb.common.core.domain.R;
import com.bonus.sgzb.common.core.exception.ServiceException;
import com.bonus.sgzb.common.core.utils.StringUtils; import com.bonus.sgzb.common.core.utils.StringUtils;
import com.bonus.sgzb.common.core.utils.poi.ExcelUtil; 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.controller.BaseController;
@ -35,10 +15,24 @@ import com.bonus.sgzb.common.log.enums.BusinessType;
import com.bonus.sgzb.common.security.annotation.InnerAuth; import com.bonus.sgzb.common.security.annotation.InnerAuth;
import com.bonus.sgzb.common.security.annotation.RequiresPermissions; import com.bonus.sgzb.common.security.annotation.RequiresPermissions;
import com.bonus.sgzb.common.security.utils.SecurityUtils; import com.bonus.sgzb.common.security.utils.SecurityUtils;
import com.bonus.sgzb.system.api.RemoteUserService;
import com.bonus.sgzb.system.api.domain.SysDept; import com.bonus.sgzb.system.api.domain.SysDept;
import com.bonus.sgzb.system.api.domain.SysRole; import com.bonus.sgzb.system.api.domain.SysRole;
import com.bonus.sgzb.system.api.domain.SysUser; import com.bonus.sgzb.system.api.domain.SysUser;
import com.bonus.sgzb.system.api.model.LoginUser; import com.bonus.sgzb.system.api.model.LoginUser;
import com.bonus.sgzb.system.service.*;
import org.apache.commons.lang3.ArrayUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
/** /**
* 用户信息 * 用户信息
@ -292,12 +286,25 @@ public class SysUserController extends BaseController
* 根据手机验证码重制密码 * 根据手机验证码重制密码
*/ */
@RequiresPermissions("system:user:edit") @RequiresPermissions("system:user:edit")
@Log(title = "用户管理", businessType = BusinessType.UPDATE) @Log(title = "根据手机验证码重制密码", businessType = BusinessType.UPDATE)
@PutMapping("/resetPwdByCode") @PutMapping("/resetPwdByCode")
public AjaxResult resetPwdByCode(String phone, String code, String password) { public AjaxResult resetPwdByCode(String phone, Long userId, String code, String password) {
if (StringUtils.isEmpty(phone) || StringUtils.isEmpty(code) || StringUtils.isEmpty(password)) { if (StringUtils.isEmpty(phone) || StringUtils.isEmpty(code) || StringUtils.isEmpty(password) || userId == null) {
return AjaxResult.error("参数错误"); return AjaxResult.error("参数不能为空");
} }
if (password.length() < UserConstants.PASSWORD_MIN_LENGTH || password.length() > UserConstants.PASSWORD_MAX_LENGTH) {
throw new ServiceException("密码长度必须在6到19个字符之间");
}
if (code.length() != UserConstants.CODE_MIN_LENGTH_LOGIN) {
throw new ServiceException("验证码长度需为6位");
}
if (phone.length() != UserConstants.PHONE_DEFAULT_LENGTH_LOGIN) {
throw new ServiceException("手机号码长度不在指定范围");
}
if (remoteUserService.checkCode(phone, code).getCode() != Constants.SUCCESS) {
throw new ServiceException("对不起,您输入的验证码:" + code + " 不存在,请重新输入有效的验证码");
}
if (smsService.checkCode(phone, code)) { if (smsService.checkCode(phone, code)) {
// 查询用户信息 // 查询用户信息
R<LoginUser> userResult = remoteUserService.getUserInfoByPhone(phone, SecurityConstants.INNER); R<LoginUser> userResult = remoteUserService.getUserInfoByPhone(phone, SecurityConstants.INNER);