数字格式修改bigdecimal

This commit is contained in:
bonus 2024-12-06 18:02:55 +08:00
parent 15b1b12384
commit 14059db870
26 changed files with 379 additions and 152 deletions

View File

@ -26,6 +26,8 @@ public class TypeTreeNode {
private String unitName;
private String unitValue;
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private String level;

View File

@ -26,7 +26,7 @@ import com.bonus.common.core.web.page.TableDataInfo;
/**
* 退料任务详细Controller
*
*
* @author xsheng
* @date 2024-10-16
*/
@ -41,7 +41,7 @@ public class BackApplyDetailsController extends BaseController {
* 查询退料任务详细列表
*/
@ApiOperation(value = "查询退料任务详细列表")
@RequiresPermissions("back:details:list")
// @RequiresPermissions("back:details:list")
@GetMapping("/list")
public TableDataInfo list(BackApplyDetails backApplyDetails) {
startPage();
@ -54,7 +54,7 @@ public class BackApplyDetailsController extends BaseController {
*/
@ApiOperation(value = "导出退料任务详细列表")
@PreventRepeatSubmit
@RequiresPermissions("back:details:export")
// @RequiresPermissions("back:details:export")
@SysLog(title = "退料任务详细", businessType = OperaType.EXPORT, logType = 1,module = "仓储管理->导出退料任务详细")
@PostMapping("/export")
public void export(HttpServletResponse response, BackApplyDetails backApplyDetails) {
@ -67,7 +67,7 @@ public class BackApplyDetailsController extends BaseController {
* 获取退料任务详细详细信息
*/
@ApiOperation(value = "获取退料任务详细详细信息")
@RequiresPermissions("back:details:query")
// @RequiresPermissions("back:details:query")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(backApplyDetailsService.selectBackApplyDetailsById(id));
@ -78,7 +78,7 @@ public class BackApplyDetailsController extends BaseController {
*/
@ApiOperation(value = "新增退料任务详细")
@PreventRepeatSubmit
@RequiresPermissions("back:details:add")
// @RequiresPermissions("back:details:add")
@SysLog(title = "退料任务详细", businessType = OperaType.INSERT, logType = 1,module = "仓储管理->新增退料任务详细")
@PostMapping
public AjaxResult add(@RequestBody BackApplyDetails backApplyDetails) {
@ -94,7 +94,7 @@ public class BackApplyDetailsController extends BaseController {
*/
@ApiOperation(value = "修改退料任务详细")
@PreventRepeatSubmit
@RequiresPermissions("back:details:edit")
// @RequiresPermissions("back:details:edit")
@SysLog(title = "退料任务详细", businessType = OperaType.UPDATE, logType = 1,module = "仓储管理->修改退料任务详细")
@PutMapping
public AjaxResult edit(@RequestBody BackApplyDetails backApplyDetails) {
@ -110,7 +110,7 @@ public class BackApplyDetailsController extends BaseController {
*/
@ApiOperation(value = "删除退料任务详细")
@PreventRepeatSubmit
@RequiresPermissions("back:details:remove")
// @RequiresPermissions("back:details:remove")
@SysLog(title = "退料任务详细", businessType = OperaType.DELETE, logType = 1,module = "仓储管理->删除退料任务详细")
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {

View File

@ -30,7 +30,7 @@ import com.bonus.common.core.web.page.TableDataInfo;
/**
* 退料任务Controller
*
*
* @author xsheng
* @date 2024-10-16
*/
@ -45,7 +45,7 @@ public class BackApplyInfoController extends BaseController {
* 查询退料任务列表
*/
@ApiOperation(value = "查询退料任务列表")
@RequiresPermissions("back:info:list")
// @RequiresPermissions("back:info:list")
@GetMapping("/list")
public TableDataInfo list(BackApplyInfo backApplyInfo) {
backApplyInfo.setIsExport(false);
@ -71,7 +71,7 @@ public class BackApplyInfoController extends BaseController {
* @return
*/
@ApiOperation(value = "app编码检索")
@RequiresPermissions("back:info:list")
// @RequiresPermissions("back:info:list")
@GetMapping("/getMachine")
public AjaxResult getMachine(BackApplyInfo dto){
return backApplyInfoService.getMachine(dto);
@ -82,7 +82,7 @@ public class BackApplyInfoController extends BaseController {
*/
@ApiOperation(value = "导出退料任务列表")
@PreventRepeatSubmit
@RequiresPermissions("back:info:export")
// @RequiresPermissions("back:info:export")
@SysLog(title = "退料任务", businessType = OperaType.EXPORT, logType = 1,module = "仓储管理->导出退料任务")
@PostMapping("/export")
public void export(HttpServletResponse response, BackApplyInfo backApplyInfo) {
@ -96,7 +96,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));
@ -107,7 +107,7 @@ public class BackApplyInfoController extends BaseController {
*/
@ApiOperation(value = "新增退料任务")
@PreventRepeatSubmit
@RequiresPermissions("back:info:add")
// @RequiresPermissions("back:info:add")
@SysLog(title = "退料任务", businessType = OperaType.INSERT, logType = 1,module = "仓储管理->新增退料任务")
@PostMapping
public AjaxResult add(@Valid @RequestBody BackApplyRequestVo dto) {
@ -125,7 +125,7 @@ public class BackApplyInfoController extends BaseController {
*/
@ApiOperation(value = "新增退料任务app")
@PreventRepeatSubmit
@RequiresPermissions("back:info:add")
// @RequiresPermissions("back:info:add")
@SysLog(title = "退料任务", businessType = OperaType.INSERT, logType = 1,module = "仓储管理->新增退料任务app")
@PostMapping("/insertApp")
public AjaxResult insertApp(@RequestBody BackAppRequestVo dto) {
@ -141,7 +141,7 @@ public class BackApplyInfoController extends BaseController {
*/
@ApiOperation(value = "修改退料任务")
@PreventRepeatSubmit
@RequiresPermissions("back:info:edit")
// @RequiresPermissions("back:info:edit")
@SysLog(title = "退料任务", businessType = OperaType.UPDATE, logType = 1,module = "仓储管理->修改退料任务")
@PostMapping("/edit")
public AjaxResult edit(@Valid @RequestBody BackApplyRequestVo dto) {
@ -154,7 +154,7 @@ public class BackApplyInfoController extends BaseController {
@ApiOperation(value = "修改退料任务打印状态")
@PreventRepeatSubmit
@RequiresPermissions("back:info:edit")
// @RequiresPermissions("back:info:edit")
@SysLog(title = "退料任务", businessType = OperaType.UPDATE, logType = 1,module = "仓储管理->修改退料任务")
@PostMapping("/editPrintStatus")
public AjaxResult editPrintStatus(@RequestBody BackApplyInfo dto) {
@ -170,7 +170,7 @@ public class BackApplyInfoController extends BaseController {
*/
@ApiOperation(value = "退料申请提交")
@PreventRepeatSubmit
@RequiresPermissions("back:info:submit")
// @RequiresPermissions("back:info:submit")
@SysLog(title = "退料任务", businessType = OperaType.UPDATE, logType = 1,module = "仓储管理->退料申请提交")
@PostMapping("/submitBackApply")
public AjaxResult submitBackApply(@RequestBody BackApplyInfo backApplyInfo) {
@ -186,7 +186,7 @@ public class BackApplyInfoController extends BaseController {
*/
@ApiOperation(value = "删除退料任务")
@PreventRepeatSubmit
@RequiresPermissions("back:info:remove")
// @RequiresPermissions("back:info:remove")
@SysLog(title = "退料任务", businessType = OperaType.DELETE, logType = 1,module = "仓储管理->删除退料任务")
@PostMapping("/deleteById")
public AjaxResult remove(@RequestBody BackApplyInfo backApplyInfo) {

View File

@ -7,11 +7,12 @@ import lombok.Data;
import lombok.ToString;
import com.bonus.common.core.web.domain.BaseEntity;
import java.math.BigDecimal;
import java.util.List;
/**
* 退料任务详细对象 back_apply_details
*
*
* @author xsheng
* @date 2024-10-16
*/
@ -55,6 +56,9 @@ public class BackApplyDetails extends BaseEntity {
@ApiModelProperty(value = "单位名称")
private String unitName;
@ApiModelProperty(value = "单位名称数值")
private String unitValue;
@ApiModelProperty(value = "管理方式(0编号 1计数)")
private String manageType;
@ -75,15 +79,15 @@ public class BackApplyDetails extends BaseEntity {
/** 退料数量 */
@ApiModelProperty(value = "退料数量")
private Integer preNum;
private BigDecimal preNum;
/** 审批数量 */
@ApiModelProperty(value = "审批数量")
private Integer auditNum;
private BigDecimal auditNum;
/** 在用数量 */
@ApiModelProperty(value = "在用数量")
private Integer num;
private BigDecimal num;
/** 状态(0待审批1进行中2已出库3已驳回) */
@ApiModelProperty(value = "状态(0待审批1进行中2已出库3已驳回)")

View File

@ -1,5 +1,6 @@
package com.bonus.material.back.service.impl;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
@ -41,7 +42,7 @@ import javax.annotation.Resource;
/**
* 退料任务Service业务层处理
*
*
* @author xsheng
* @date 2024-10-16
*/
@ -69,7 +70,7 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService {
/**
* 查询退料任务
*
*
* @param id 退料任务主键
* @return 退料任务
*/
@ -187,7 +188,7 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService {
/**
* 查询退料任务列表
*
*
* @param backApplyInfo 退料任务
* @return 退料任务
*/
@ -222,7 +223,7 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService {
/**
* 新增退料任务
*
*
* @param dto 退料任务
* @return 结果
*/
@ -239,7 +240,7 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService {
//对提交的退料详情数目进行校验
for (BackApplyDetails backApplyDetails : dto.getBackApplyDetailsList()) {
if (backApplyDetails.getNum() != null && backApplyDetails.getPreNum() != null) {
if (backApplyDetails.getNum() < backApplyDetails.getPreNum()) {
if (backApplyDetails.getNum().compareTo( backApplyDetails.getPreNum())<0) {
return AjaxResult.error(backApplyDetails.getTypeName() + "退料数量不能大于预退数量,请重新填写!");
}
}
@ -339,7 +340,7 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService {
for (MaCodeDto maCodeDto : details.getMaCodeList()) {
// 设置每个 MaCodeDto 的独立属性
details.setMaId(maCodeDto.getMaId());
details.setPreNum(1);
details.setPreNum(BigDecimal.valueOf(1));
details.setApDetection(maCodeDto.getApDetection());
// 插入 CheckDetails
result += backApplyInfoMapper.insertCheckDetails(details);
@ -404,7 +405,7 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService {
/**
* 修改退料任务
*
*
* @param dto 退料任务
* @return 结果
*/
@ -416,7 +417,7 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService {
//对提交的退料详情树木进行校验
for (BackApplyDetails backApplyDetails : dto.getBackApplyDetailsList()) {
if (backApplyDetails.getNum() != null && backApplyDetails.getPreNum() != null) {
if (backApplyDetails.getNum() < backApplyDetails.getPreNum()) {
if (backApplyDetails.getNum().compareTo(backApplyDetails.getPreNum())<0 ) {
return AjaxResult.error(backApplyDetails.getTypeName() + "退料数量不能大于预退数量,请重新填写!");
}
}
@ -464,7 +465,7 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService {
/**
* 删除退料任务信息
*
*
* @param id 退料任务主键
* @return 结果
*/
@ -584,7 +585,7 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService {
List<BackApplyDetails> applyDetails = backApplyInfoMapper.selectBackApplyDetailsListByTaskId(backApplyInfo.getId());
if (CollectionUtils.isNotEmpty(applyDetails)) {
for (BackApplyDetails applyDetail : applyDetails) {
if (applyDetail.getPreNum() > applyDetail.getNum()) {
if (applyDetail.getPreNum().compareTo(applyDetail.getNum())>0) {
return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), "退料数量不能大于在用数量");
}
result += backApplyInfoMapper.updateBackApplyDetails(applyDetail);
@ -741,7 +742,7 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService {
BackApplyDetails details = dto.getBackApplyDetails();
details.setCode(code);
details.setParentId(id);
details.setNum(num);
details.setNum(BigDecimal.valueOf(num));
details.setAuditNum(details.getPreNum());
details.setStatus(String.valueOf(BackTaskStatusEnum.BACK_TASK_NO_FINISHED.getStatus()));
details.setCreateBy(SecurityUtils.getUsername());
@ -750,7 +751,7 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService {
result += backApplyInfoMapper.insertBackApplyDetails(details);
// 设置公共字段
setCommonFields(details, id);
details.setPreNum(1);
details.setPreNum(BigDecimal.valueOf(1));
// 插入 CheckDetails
result += backApplyInfoMapper.insertCheckDetails(details);
//更新ma_machine表状态为3退料检修
@ -841,9 +842,9 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService {
BackApplyDetails details = dto.getBackApplyDetails();
details.setCode(dto.getBackApplyInfo().getCode());
details.setParentId(dto.getBackApplyInfo().getId());
details.setPreNum(1);
details.setPreNum(BigDecimal.valueOf(1));
details.setAuditNum(details.getPreNum());
details.setNum(num);
details.setNum(BigDecimal.valueOf(num));
details.setStatus(String.valueOf(BackTaskStatusEnum.BACK_TASK_NO_FINISHED.getStatus()));
details.setCreateBy(SecurityUtils.getUsername());
details.setCreateTime(DateUtils.getNowDate());

View File

@ -0,0 +1,21 @@
package com.bonus.material.config;
import com.bonus.material.interceptor.DataEnDecryptInterceptor;
import org.mybatis.spring.boot.autoconfigure.ConfigurationCustomizer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* mybatis 配置类
* @author weiweiwang
*/
@Configuration
public class MyBatisConfig {
@Bean
public ConfigurationCustomizer configurationCustomizer() {
return configuration -> {
configuration.addInterceptor(new DataEnDecryptInterceptor());
};
}
}

View File

@ -0,0 +1,179 @@
package com.bonus.material.interceptor;
import com.bonus.common.core.utils.encryption.Sm4Utils;
import com.bonus.material.basic.domain.BmProject;
import com.bonus.system.api.domain.SysDept;
import com.bonus.system.api.domain.SysUser;
import org.apache.ibatis.executor.parameter.ParameterHandler;
import org.apache.ibatis.executor.resultset.ResultSetHandler;
import org.apache.ibatis.mapping.MappedStatement;
import org.apache.ibatis.plugin.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.lang.reflect.Field;
import java.sql.PreparedStatement;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
/**
* mybatis 拦截器
* 对用户和部门实体里的邮箱和电话号码进行加密存库并从库里查询后解密
* @author weiweiwang
*/
@Intercepts({
@Signature(type = ParameterHandler.class, method = "setParameters", args = {PreparedStatement.class}),
@Signature(type = ResultSetHandler.class, method = "handleResultSets", args = {Statement.class})
})
public class DataEnDecryptInterceptor implements Interceptor {
protected final Logger logger = LoggerFactory.getLogger(this.getClass());
final static String USER_MAPPER_ID = "com.bonus.material.basic.mapper.BmProjectMapper";
final static String DEPT_MAPPER_ID = "com.bonus.material.basic.mapper.BmUnitMapper";
@Override
public Object intercept(Invocation invocation) throws Throwable {
try {
if (invocation.getTarget() instanceof ParameterHandler) {
// Handle encryption before setting parameters
ParameterHandler parameterHandler = (ParameterHandler) invocation.getTarget();
MappedStatement mappedStatement = getMappedStatement(parameterHandler);
PreparedStatement preparedStatement = (PreparedStatement) invocation.getArgs()[0];
Object parameterObject = parameterHandler.getParameterObject();
String sqlId = mappedStatement.getId();
if (sqlId.contains(USER_MAPPER_ID)){
encryptUserObject(parameterObject);
} else if (sqlId.contains(DEPT_MAPPER_ID)){
encryptDeptObject(parameterObject);
}
return invocation.proceed();
} else if (invocation.getTarget() instanceof ResultSetHandler) {
// Handle decryption after result set is obtained
ResultSetHandler resultSetHandler = (ResultSetHandler) invocation.getTarget();
MappedStatement mappedStatement = getMappedStatement(resultSetHandler);
Object result = invocation.proceed();
String sqlId = mappedStatement.getId();
if (sqlId.contains(USER_MAPPER_ID))
{
decryUserObject(result);
} else if (sqlId.contains(DEPT_MAPPER_ID)){
decryDeptObject(result);
}
return result;
}
return invocation.proceed();
}
catch (Exception e){
logger.error("mybatis对敏感数据加解密拦截器异常报错{}",e.getMessage ());
return invocation.proceed();
}
}
@Override
public Object plugin(Object target) {
return Plugin.wrap(target, this);
}
@Override
public void setProperties(Properties properties) {
}
private void encryptUserObject(Object parameterObject){
if (parameterObject instanceof BmProject) {
BmProject pro = (BmProject) parameterObject;
// 加密敏感字段
if (pro.getTelphone() != null) {
pro.setTelphone(Sm4Utils.encrypt(pro.getTelphone()));
}
}
}
private void encryptDeptObject(Object parameterObject) {
if (parameterObject instanceof SysDept) {
SysDept dept = (SysDept) parameterObject;
// 加密敏感字段
if (dept.getEmail() != null) {
dept.setEmail(Sm4Utils.encrypt(dept.getEmail()));
}
if (dept.getPhone() != null) {
dept.setPhone(Sm4Utils.encrypt(dept.getPhone()));
}
}
}
private void decryUserObject(Object result){
try {
if (result instanceof ArrayList) {
List<?> list = (List<?>) result;
for (Object obj : list) {
if (obj instanceof BmProject) {
decryptUser ((BmProject) obj);
}
}
} else if (result instanceof BmProject) {
decryptUser ((BmProject) result);
}
} catch (Exception ingore) {
}
}
private void decryptUser(BmProject pro) {
if (pro.getTelphone() != null) {
pro.setTelphone(Sm4Utils.decrypt(pro.getTelphone()));
}
}
private void decryDeptObject(Object result){
try {
if (result instanceof ArrayList) {
List<?> list = (List<?>) result;
for (Object obj : list) {
if (obj instanceof SysDept) {
decryptDept ((SysDept) obj);
}
}
} else if (result instanceof SysDept) {
decryptDept ((SysDept) result);
}
} catch (Exception ingore) {
}
}
private void decryptDept(SysDept dept) {
if (dept.getEmail() != null) {
dept.setEmail(Sm4Utils.decrypt(dept.getEmail()));
}
if (dept.getPhone() != null) {
dept.setPhone(Sm4Utils.decrypt(dept.getPhone()));
}
}
private MappedStatement getMappedStatement(ParameterHandler parameterHandler) {
try {
// Use reflection to access the private field `mappedStatement` (or appropriate field)
Field mappedStatementField = parameterHandler.getClass().getDeclaredField("mappedStatement");
mappedStatementField.setAccessible(true);
return (MappedStatement) mappedStatementField.get(parameterHandler);
} catch (Exception e) {
throw new RuntimeException("Failed to get MappedStatement from ParameterHandler", e);
}
}
private MappedStatement getMappedStatement(ResultSetHandler resultSetHandler) {
try {
// Use reflection to access the private field `mappedStatement` (or appropriate field)
Field mappedStatementField = resultSetHandler.getClass().getDeclaredField("mappedStatement");
mappedStatementField.setAccessible(true);
return (MappedStatement) mappedStatementField.get(resultSetHandler);
} catch (Exception e) {
throw new RuntimeException("Failed to get MappedStatement from ResultSetHandler", e);
}
}
}

View File

@ -44,6 +44,9 @@ public class LeaseApplyDetails extends BaseEntity {
@ApiModelProperty(value = "计量单位")
private String unitName;
/** 计量单位数值 */
@ApiModelProperty(value = "计量单位数值")
private String unitValue;
/** 库存数量 */
@ApiModelProperty(value = "库存数量")
private BigDecimal storageNum;

View File

@ -6,9 +6,11 @@ import lombok.Data;
import lombok.ToString;
import com.bonus.common.core.web.domain.BaseEntity;
import java.math.BigDecimal;
/**
* 维修详细对象 repair_apply_details
*
*
* @author xsheng
* @date 2024-10-16
*/
@ -40,29 +42,29 @@ public class RepairApplyDetails extends BaseEntity {
/** 维修总量 */
@Excel(name = "维修总量")
@ApiModelProperty(value = "维修总量")
private Long repairNum;
private BigDecimal repairNum;
/** 维修合格数量 */
@Excel(name = "维修合格数量")
@ApiModelProperty(value = "维修合格数量")
private Long repairedNum;
private BigDecimal repairedNum;
/**
* 本次维修合格数量
*/
@ApiModelProperty(value = "本次维修合格数量")
private int thisRepairedNum;
private BigDecimal thisRepairedNum;
/** 维修报废数量 */
@Excel(name = "维修报废数量")
@ApiModelProperty(value = "维修报废数量")
private Long scrapNum;
private BigDecimal scrapNum;
/**
* 本次维修报废数量
*/
@ApiModelProperty(value = "本次维修报废数量")
private int thisScrapNum;
private BigDecimal thisScrapNum;
/** 0未完成1已完成 */
@Excel(name = "0未完成1已完成")

View File

@ -14,7 +14,7 @@ import lombok.experimental.Accessors;
/**
* 维修记录对象 repair_apply_record
*
*
* @author syruan
*/
@EqualsAndHashCode(callSuper = false)
@ -46,12 +46,12 @@ public class RepairApplyRecord extends BaseEntity {
/** 维修数量 */
@Excel(name = "维修数量")
@ApiModelProperty(value = "维修数量")
private Integer repairNum;
private BigDecimal repairNum;
/** 报废数量 */
@Excel(name = "报废数量")
@ApiModelProperty(value = "报废数量")
private Integer scrapNum;
private BigDecimal scrapNum;
/** 维修方式1内部2返厂3报废 */
@Excel(name = "维修方式", readConverterExp = "1=内部2返厂3报废")

View File

@ -1,5 +1,6 @@
package com.bonus.material.repair.domain;
import java.math.BigDecimal;
import java.util.Date;
import com.bonus.common.biz.enums.TmTaskTypeEnum;
@ -15,7 +16,7 @@ import lombok.experimental.Accessors;
/**
* 修试审核详细对象 repair_audit_details
*
*
* @author syruan
*/
@EqualsAndHashCode(callSuper = false)
@ -62,17 +63,17 @@ public class RepairAuditDetails extends BaseEntity {
/** 维修总量 */
@Excel(name = "维修总量")
@ApiModelProperty(value = "维修总量")
private Integer repairNum;
private BigDecimal repairNum;
/** 维修合格数量 */
@Excel(name = "维修合格数量")
@ApiModelProperty(value = "维修合格数量")
private Integer repairedNum;
private BigDecimal repairedNum;
/** 维修报废数量 */
@Excel(name = "维修报废数量")
@ApiModelProperty(value = "维修报废数量")
private Integer scrapNum;
private BigDecimal scrapNum;
/** 审核人 */
@Excel(name = "审核人")

View File

@ -9,7 +9,7 @@ import com.bonus.common.core.web.domain.BaseEntity;
/**
* 维修详细对象 repair_cost
*
*
* @author xsheng
* @date 2024-10-16
*/
@ -46,7 +46,7 @@ public class RepairCost extends BaseEntity {
/** 维修数量 */
@Excel(name = "维修数量")
@ApiModelProperty(value = "维修数量")
private Long repairNum;
private BigDecimal repairNum;
/** 维修费用 */
@Excel(name = "维修费用")

View File

@ -6,9 +6,11 @@ import lombok.Data;
import lombok.ToString;
import com.bonus.common.core.web.domain.BaseEntity;
import java.math.BigDecimal;
/**
* 修试后入库对象 repair_input_details
*
*
* @author xsheng
* @date 2024-10-16
*/
@ -50,12 +52,12 @@ public class RepairInputDetails extends BaseEntity {
/** 维修合格数量 */
@Excel(name = "维修合格数量")
@ApiModelProperty(value = "维修合格数量")
private Integer repairNum;
private BigDecimal repairNum;
/** 入库数量 */
@Excel(name = "入库数量")
@ApiModelProperty(value = "入库数量")
private Integer inputNum;
private BigDecimal inputNum;
/** 0未审核1已入库2驳回 */
@Excel(name = "0未审核1已入库2驳回")

View File

@ -13,7 +13,7 @@ import lombok.experimental.Accessors;
/**
* 维修配件详细对象 repair_part_details
*
*
* @author xsheng
* @date 2024-10-16
*/
@ -72,11 +72,11 @@ public class RepairPartDetails extends BaseEntity {
/** 维修数量 */
@ApiModelProperty(value = "维修数量")
private Integer repairNum;
private BigDecimal repairNum;
/** 报废数量 */
@ApiModelProperty(value = "报废数量")
private Integer scrapNum;
private BigDecimal scrapNum;
/** 报废原因 */
@ApiModelProperty(value = "报废原因")

View File

@ -6,6 +6,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* @author syruan
@ -37,12 +38,12 @@ public class RepairRecord implements Serializable {
* 维修数量
*/
@ApiModelProperty(value = "维修数量")
private int repairNum;
private BigDecimal repairNum;
/**
* 报废数量
*/
@ApiModelProperty(value = "报废数量")
private int scrapNum;
private BigDecimal scrapNum;
/**
* 维修方式1内部2返厂3报废
*/

View File

@ -5,6 +5,7 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.util.List;
/**
@ -118,19 +119,19 @@ public class RepairTask {
*/
@ApiModelProperty(value = "维修总量")
@Excel(name = "维修总量",sort = 11)
private int repairNum;
private BigDecimal repairNum;
/**
* 维修合格数量
*/
@ApiModelProperty(value = "维修合格数量")
@Excel(name = "维修合格数量",sort = 12)
private int repairedNum;
private BigDecimal repairedNum;
/**
* 维修报废数量
*/
@ApiModelProperty(value = "报废数量")
@Excel(name = "维修报废数量",sort = 13)
private int scrapNum;
private BigDecimal scrapNum;
/**
* 待修状态
*/

View File

@ -6,6 +6,8 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.math.BigDecimal;
/**
* @author syruan
*/
@ -62,7 +64,7 @@ public class RepairTaskDetails extends BaseEntity {
* 维修总量
*/
@ApiModelProperty(value = "维修总量")
private int repairNum;
private BigDecimal repairNum;
/**
* 维修方式: 1内部 2外部返厂 3报废
@ -74,23 +76,23 @@ public class RepairTaskDetails extends BaseEntity {
* 维修合格数量
*/
@ApiModelProperty(value = "维修合格数量")
private int repairedNum;
private BigDecimal repairedNum;
/**
* 本次维修合格数量
*/
@ApiModelProperty(value = "本次维修合格数量")
private int thisRepairedNum;
private BigDecimal thisRepairedNum;
/**
* 维修报废数量
*/
@ApiModelProperty(value = "维修报废数量")
private int scrapNum;
private BigDecimal scrapNum;
/**
* 本次维修报废数量
*/
@ApiModelProperty(value = "本次维修报废数量")
private int thisScrapNum;
private BigDecimal thisScrapNum;
/**
* 待修状态
*/

View File

@ -47,13 +47,13 @@ public class RepairDeviceSummaryVo extends BaseVO {
private String[] repairers;
@ApiModelProperty(value = "维修总量")
private int typeRepairNum;
private BigDecimal typeRepairNum;
@ApiModelProperty(value = "已修数量")
private int typeRepairedNum;
private BigDecimal typeRepairedNum;
@ApiModelProperty(value = "维修报废数量")
private int typeScrapNum;
private BigDecimal typeScrapNum;
// @ApiModelProperty(value = "维修费用记录条数")
// private Integer typeCostRecords;

View File

@ -6,6 +6,8 @@ import com.bonus.material.repair.domain.RepairPartDetails;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import org.apache.poi.hssf.record.crypto.Biff8DecryptingStream;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
@ -67,13 +69,13 @@ public class RepairDeviceVO {
private String fileUrl;
@ApiModelProperty(value = "维修数量")
private int repairNum;
private BigDecimal repairNum;
@ApiModelProperty(value = "维修合格数量")
private int repairedNum;
private BigDecimal repairedNum;
@ApiModelProperty(value = "维修报废数量")
private int scrapNum;
private BigDecimal scrapNum;
@ApiModelProperty(value = "维修费用记录条数")
private Integer totalCostRecords;

View File

@ -55,13 +55,13 @@ public interface RepairMapper {
* @param repairer 维修人员
* @param userId 用户id
*/
int updateRepairedNum(@Param("id") Long id, @Param("repairNum") int repairNum, @Param("repairer") Long repairer, @Param("userId") Long userId);
int updateRepairedNum(@Param("id") Long id, @Param("repairNum") BigDecimal repairNum, @Param("repairer") Long repairer, @Param("userId") Long userId);
int updateRepairNum(@Param("id") Long id, @Param("repairNum") int repairNum, @Param("repairer") Long repairer, @Param("userId") Long userId);
int updateRepairNum(@Param("id") Long id, @Param("repairNum") BigDecimal repairNum, @Param("repairer") Long repairer, @Param("userId") Long userId);
int updateThisRepairedAndScrapNum(@Param("id") Long id, @Param("thisRepairedNum") int repairNum, @Param("thisScrapNum") int thisScrapNum,@Param("repairer") Long repairer, @Param("userId") Long userId);
int updateThisRepairedAndScrapNum(@Param("id") Long id, @Param("thisRepairedNum") BigDecimal repairNum, @Param("thisScrapNum") BigDecimal thisScrapNum,@Param("repairer") Long repairer, @Param("userId") Long userId);
int updateRepairedNumAndStatus(@Param("id") Long id, @Param("repairNum") int repairNum, @Param("status") int status, @Param("repairer") Long repairer, @Param("userId") Long userId);
int updateRepairedNumAndStatus(@Param("id") Long id, @Param("repairNum") BigDecimal repairNum, @Param("status") int status, @Param("repairer") Long repairer, @Param("userId") Long userId);
/**
* 修改维修数量
@ -69,9 +69,9 @@ public interface RepairMapper {
* @param repairNum 维修数量
* @param userid 用户id
*/
int updateRepairedNumTwo(@Param("id") Long id, @Param("repairNum") int repairNum, @Param("userId") Long userid);
int updateRepairedNumTwo(@Param("id") Long id, @Param("repairNum") BigDecimal repairNum, @Param("userId") Long userid);
int updateRepairedNumTwoAndStatus(@Param("id") Long id, @Param("repairNum") int repairNum, @Param("status") int status, @Param("userId") Long userid);
int updateRepairedNumTwoAndStatus(@Param("id") Long id, @Param("repairNum") BigDecimal repairNum, @Param("status") int status, @Param("userId") Long userid);
/**
* 修改报废数量
@ -79,9 +79,9 @@ public interface RepairMapper {
* @param scrapNum 报废数量
* @param userId 用户id
*/
int updateScrapNum(@Param("id") Long id, @Param("scrapNum") int scrapNum, @Param("userId") Long userId);
int updateScrapNum(@Param("id") Long id, @Param("scrapNum") BigDecimal scrapNum, @Param("userId") Long userId);
int updateScrapNumAndStatus(@Param("id") Long id, @Param("scrapNum") int scrapNum, @Param("status") int status, @Param("userId") Long userId);
int updateScrapNumAndStatus(@Param("id") Long id, @Param("scrapNum") BigDecimal scrapNum, @Param("status") int status, @Param("userId") Long userId);
/**
* 新增配件维修记录

View File

@ -32,13 +32,14 @@ import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
/**
* 修试审核详细Service业务层处理
*
*
* @author syruan
* @date 2024-10-16
*/
@ -152,7 +153,7 @@ public class RepairAuditDetailsServiceImpl implements IRepairAuditDetailsService
String checkResult = scrapAudit.getCheckResult();
List<RepairAuditDetails> auditDetailList = scrapAudit.getAuditDetailList();
List<Long> taskIdList = scrapAudit.getTaskIdList();
Integer b = 0;
BigDecimal b = BigDecimal.valueOf(0);
char status;
for (Long taskId : taskIdList) {
TmTask tmTask = taskMapper.selectTmTaskByTaskId(taskId);
@ -199,7 +200,7 @@ public class RepairAuditDetailsServiceImpl implements IRepairAuditDetailsService
for (RepairAuditDetails inputDetails : repairInputList) {
Long typeId = inputDetails.getTypeId();
Long maId = inputDetails.getMaId();
Integer repairNum = inputDetails.getRepairedNum();
BigDecimal repairNum = inputDetails.getRepairedNum();
// 创建修饰后入库任务
if (repairNum.compareTo(b) > 0) {
// 添加修试后入库任务
@ -238,7 +239,7 @@ public class RepairAuditDetailsServiceImpl implements IRepairAuditDetailsService
Long typeId = scrapDetails.getTypeId();
Long maId = scrapDetails.getMaId();
// 创建报废任务
Integer scrapNum = scrapDetails.getScrapNum();
BigDecimal scrapNum = scrapDetails.getScrapNum();
if (scrapNum.compareTo(b) > 0) {
for (RepairRecord bean : repairRecord){
ScrapApplyDetails scrapApplyDetails = new ScrapApplyDetails();
@ -295,7 +296,7 @@ public class RepairAuditDetailsServiceImpl implements IRepairAuditDetailsService
repairTaskDetails.setTaskId(inputTaskId);
repairTaskDetails.setMaId(String.valueOf(inputDetails.getMaId()));
repairTaskDetails.setTypeId(String.valueOf(inputDetails.getTypeId()));
Integer repairNum = inputDetails.getRepairNum();
BigDecimal repairNum = inputDetails.getRepairNum();
repairTaskDetails.setRepairNum(repairNum);
repairTaskDetails.setStatus("0");
repairTaskDetails.setCreateBy(String.valueOf(SecurityUtils.getLoginUser().getUserid()));
@ -388,7 +389,7 @@ public class RepairAuditDetailsServiceImpl implements IRepairAuditDetailsService
/**
* 查询修试审核详细
*
*
* @param id 修试审核详细主键
* @return 修试审核详细
*/
@ -412,7 +413,7 @@ public class RepairAuditDetailsServiceImpl implements IRepairAuditDetailsService
/**
* 查询修试审核详细列表
*
*
* @param repairAuditDetails 修试审核详细
* @return 修试审核详细
*/
@ -423,7 +424,7 @@ public class RepairAuditDetailsServiceImpl implements IRepairAuditDetailsService
/**
* 新增修试审核详细
*
*
* @param repairAuditDetails 修试审核详细
* @return 结果
*/
@ -439,7 +440,7 @@ public class RepairAuditDetailsServiceImpl implements IRepairAuditDetailsService
/**
* 修改修试审核详细
*
*
* @param repairAuditDetails 修试审核详细
* @return 结果
*/
@ -553,7 +554,7 @@ public class RepairAuditDetailsServiceImpl implements IRepairAuditDetailsService
/**
* 批量删除修试审核详细
*
*
* @param ids 需要删除的修试审核详细主键
* @return 结果
*/
@ -564,7 +565,7 @@ public class RepairAuditDetailsServiceImpl implements IRepairAuditDetailsService
/**
* 删除修试审核详细信息
*
*
* @param id 修试审核详细主键
* @return 结果
*/

View File

@ -84,9 +84,9 @@ public class RepairServiceImpl implements RepairService {
if (CollectionUtil.isNotEmpty(tempList)) {
RepairDeviceSummaryVo vo = new RepairDeviceSummaryVo();
Long[] ids = tempList.stream().map(RepairDeviceVO::getId).toArray(Long[]::new);
int repairNumSum = tempList.stream().mapToInt(RepairDeviceVO::getRepairNum).sum();
int repairedNumSum = tempList.stream().mapToInt(RepairDeviceVO::getRepairedNum).sum();
int scrapNumSum = tempList.stream().mapToInt(RepairDeviceVO::getScrapNum).sum();
BigDecimal repairNumSum = tempList.stream().map(RepairDeviceVO::getRepairNum).reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal repairedNumSum = tempList.stream().map(RepairDeviceVO::getRepairedNum).reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal scrapNumSum = tempList.stream().map(RepairDeviceVO::getScrapNum).reduce(BigDecimal.ZERO, BigDecimal::add);
//BigDecimal typeCostSum = tempList.stream().map(RepairDeviceVO::getTotalCost).reduce(BigDecimal.ZERO, BigDecimal::add);
vo.setRepairDeviceList(tempList);
vo.setIds(ids);
@ -259,21 +259,21 @@ public class RepairServiceImpl implements RepairService {
// 根据维修类型更新维修数量报废数量
switch (bean.getRepairType()) {
case INNER_REPAIR: {
int repairNum = verifyRepairNum(bean, details);
BigDecimal repairNum = verifyRepairNum(bean, details);
// 更新维修数量并修改维修人员
repairMapper.updateRepairedNum(bean.getId(), repairNum, loginUser.getUserid(), loginUser.getUserid());
break;
}
case RETURN_FACTORY: {
int repairNum = verifyRepairNum(bean, details);
BigDecimal repairNum = verifyRepairNum(bean, details);
// 更新维修数量维修人员不变
repairMapper.updateRepairedNumTwo(bean.getId(), repairNum, loginUser.getUserid());
break;
}
case TO_SCRAP: {
int scrapNum = details.getScrapNum() + bean.getScrapNum();
int num = scrapNum + details.getRepairedNum();
if (num > details.getRepairNum()) {
BigDecimal scrapNum = details.getScrapNum().add(bean.getScrapNum()) ;
BigDecimal num = scrapNum.add(details.getRepairedNum()) ;
if (num.compareTo( details.getRepairNum()) >0) {
throw new ServiceException("维修数量大于维修总量");
}
// 更新报废数量
@ -360,12 +360,13 @@ public class RepairServiceImpl implements RepairService {
/**
* 校验维修数量
*/
private static int verifyRepairNum(RepairApplyRecord bean, RepairTaskDetails details) {
private static BigDecimal verifyRepairNum(RepairApplyRecord bean, RepairTaskDetails details) {
if (bean == null || bean.getRepairNum() == null) {
throw new ServiceException("维修数量不能为空");
}
int repairNum = OptionalInt.of(details.getRepairedNum()).orElse(0) + bean.getRepairNum();
if (repairNum + OptionalInt.of(details.getScrapNum()).orElse(0) > details.getRepairNum()) {
BigDecimal repairNum = details.getRepairedNum().add( bean.getRepairNum()) ;
if (repairNum.add(details.getScrapNum()).compareTo(details.getRepairNum())>0) {
throw new ServiceException("维修数量大于维修总量");
}
return repairNum;
@ -378,15 +379,15 @@ public class RepairServiceImpl implements RepairService {
// 判断待维修数量是否大于0
for (RepairTaskDetails bean : list) {
int repairedNum = bean.getRepairNum() - bean.getRepairedNum() - bean.getScrapNum();
if (repairedNum <= 0) {
BigDecimal repairedNum = bean.getRepairNum().subtract(bean.getRepairedNum()).subtract(bean.getScrapNum());
if (repairedNum.compareTo(new BigDecimal(0)) <= 0) {
throw new ServiceException("选中的数据中包含待维修数量为0的机具请重新选择");
}
}
// 执行SQL 1.增加维修记录表 2.修改维修明细表的维修数量
for (RepairTaskDetails bean : list) {
int repairedNum = bean.getRepairNum() - bean.getRepairedNum() - bean.getScrapNum();
BigDecimal repairedNum =bean.getRepairNum().subtract(bean.getRepairedNum()).subtract(bean.getScrapNum());
RepairApplyRecord repairRecord = new RepairApplyRecord();
repairRecord.setTaskId(bean.getTaskId());
repairRecord.setMaId(Long.valueOf(bean.getMaId()));
@ -397,7 +398,7 @@ public class RepairServiceImpl implements RepairService {
repairRecord.setCreateBy(String.valueOf(loginUser.getUserid()));
repairRecord.setCompanyId(bean.getCompanyId());
repairMapper.addRecord(repairRecord);
int i = repairedNum + bean.getRepairedNum();
BigDecimal i = repairedNum.add(bean.getRepairedNum());
repairMapper.updateRepairedNumTwo(bean.getId(), i, loginUser.getUserid());
}
@ -429,20 +430,20 @@ public class RepairServiceImpl implements RepairService {
case INNER_REPAIR: {
partList = bean.getCodeInRepairPartList();
// 更新维修数量并修改维修人员
repairMapper.updateRepairedNumAndStatus(bean.getId(), 1, 1, loginUser.getUserid(), loginUser.getUserid());
repairMapper.updateRepairedNumAndStatus(bean.getId(), BigDecimal.valueOf(1), 1, loginUser.getUserid(), loginUser.getUserid());
break;
}
case RETURN_FACTORY: {
partList = bean.getCodeOutRepairPartList();
// 更新维修数量维修人员不变
repairMapper.updateRepairedNumTwoAndStatus(bean.getId(), 1, 1, loginUser.getUserid());
repairMapper.updateRepairedNumTwoAndStatus(bean.getId(), BigDecimal.valueOf(1), 1, loginUser.getUserid());
break;
}
case TO_SCRAP: {
// 报废无需上传配件直接初始化空集合
partList = bean.getCodeScrapRepairPartList();
// 更新报废数量
repairMapper.updateScrapNumAndStatus(bean.getId(), 1, 1, loginUser.getUserid());
repairMapper.updateScrapNumAndStatus(bean.getId(), BigDecimal.valueOf(1), 1, loginUser.getUserid());
break;
}
default:
@ -461,9 +462,9 @@ public class RepairServiceImpl implements RepairService {
continue;
}
int innerRepairNum = 0;
int outerRepairNum = 0;
int scrapNum = 0;
BigDecimal innerRepairNum = BigDecimal.valueOf(0);
BigDecimal outerRepairNum = BigDecimal.valueOf(0);
BigDecimal scrapNum = BigDecimal.valueOf(0);
// 处理配件--数量管理--内部维修
if (CollectionUtil.isNotEmpty(bean.getNumberInRepairPartList())) {
@ -475,7 +476,7 @@ public class RepairServiceImpl implements RepairService {
}
partList = bean.getNumberInRepairPartList();
if (bean.getNumberInRepairPartList().get(0).getRepairNum() != null && bean.getNumberInRepairPartList().get(0).getRepairNum() != 0) {
if (bean.getNumberInRepairPartList().get(0).getRepairNum() != null ) {
// 分拆维修单, 准备数据
innerRepairNum = bean.getNumberInRepairPartList().get(0).getRepairNum();
// 处理配件集合数据
@ -499,7 +500,7 @@ public class RepairServiceImpl implements RepairService {
details = repairMapper.getById(bean.getId());
// 判断外部维修配件数量是否为空
if (partList.get(0).getRepairNum() != null && partList.get(0).getRepairNum() != 0) {
if (partList.get(0).getRepairNum() != null ) {
// 分拆维修单, 准备数据
outerRepairNum = partList.get(0).getRepairNum();
@ -511,7 +512,7 @@ public class RepairServiceImpl implements RepairService {
RepairApplyRecord repairApplyRecord = new RepairApplyRecord();
for (RepairPartDetails repairPartDetails : partList) {
repairApplyRecord.setId(bean.getId()).setTaskId(bean.getTaskId()).setMaId(bean.getMaId()).setTypeId(bean.getTypeId())
.setRepairType(RepairTypeEnum.RETURN_FACTORY.getTypeId()).setRepairNum(repairPartDetails.getRepairNum()).setScrapNum(0)
.setRepairType(RepairTypeEnum.RETURN_FACTORY.getTypeId()).setRepairNum(repairPartDetails.getRepairNum()).setScrapNum(BigDecimal.valueOf(0))
.setPartName(repairPartDetails.getPartName()).setPartType(repairPartDetails.getPartType())
.setRepairContent(repairPartDetails.getRepairContent()).setSupplierId(repairPartDetails.getSupplierId())
.setPartNum(repairPartDetails.getPartNum()).setRepairer(loginUser.getUsername())
@ -532,7 +533,7 @@ public class RepairServiceImpl implements RepairService {
// 处理配件集合数据 -- 数量管理--报废维修
if (CollectionUtil.isNotEmpty(bean.getNumberScrapRepairPartList())) {
// 判断报废数量是否为空
if (bean.getNumberScrapRepairPartList().get(0).getScrapNum() != null && bean.getNumberScrapRepairPartList().get(0).getScrapNum() > 0) {
if (bean.getNumberScrapRepairPartList().get(0).getScrapNum() != null ) {
// 获取维修详情表中的维修详情记录待维修已维修已报废的数量
RepairTaskDetails details = repairMapper.getById(bean.getId());
@ -557,7 +558,7 @@ public class RepairServiceImpl implements RepairService {
repairApplyRecord.setTaskId(bean.getTaskId()).setMaId(bean.getMaId()).setTypeId(bean.getTypeId())
.setRepairType(RepairTypeEnum.TO_SCRAP.getTypeId()).setStatus(0L).setIsSlt(0L).setPartNum(0)
.setFileIds(fileInfo.getId() == null ? "" : String.valueOf(fileInfo.getId()))
.setRepairNum(0).setScrapNum(bean.getNumberScrapRepairPartList().get(0).getScrapNum())
.setRepairNum(BigDecimal.valueOf(0)).setScrapNum(bean.getNumberScrapRepairPartList().get(0).getScrapNum())
.setScrapReason(bean.getNumberScrapRepairPartList().get(0).getScrapReason())
.setScrapType(bean.getNumberScrapRepairPartList().get(0).getScrapType())
.setRepairer(loginUser.getUsername()).setCreateBy(loginUser.getUsername());
@ -571,7 +572,7 @@ public class RepairServiceImpl implements RepairService {
RepairApplyRecord repairApplyRecord = new RepairApplyRecord();
repairApplyRecord.setTaskId(bean.getTaskId()).setMaId(bean.getMaId()).setTypeId(bean.getTypeId())
.setRepairType(RepairTypeEnum.TO_SCRAP.getTypeId()).setStatus(0L).setIsSlt(0L).setPartNum(0)
.setRepairNum(0).setScrapNum(bean.getNumberScrapRepairPartList().get(0).getScrapNum())
.setRepairNum(BigDecimal.valueOf(0)).setScrapNum(bean.getNumberScrapRepairPartList().get(0).getScrapNum())
.setScrapReason(bean.getNumberScrapRepairPartList().get(0).getScrapReason())
.setScrapType(bean.getNumberScrapRepairPartList().get(0).getScrapType())
.setRepairer(loginUser.getUsername()).setCreateBy(loginUser.getUsername());
@ -595,15 +596,15 @@ public class RepairServiceImpl implements RepairService {
return AjaxResult.success("维修完成");
}
private void SplitRepairDetailsToMultiple(RepairDeviceVO bean, int innerRepairNum, int outerRepairNum, int scrapNum, LoginUser loginUser) {
if (bean.getRepairNum() < innerRepairNum + outerRepairNum + scrapNum) {
private void SplitRepairDetailsToMultiple(RepairDeviceVO bean, BigDecimal innerRepairNum, BigDecimal outerRepairNum, BigDecimal scrapNum, LoginUser loginUser) {
if (bean.getRepairNum().compareTo(innerRepairNum.add(outerRepairNum).add(scrapNum) ) < 0) {
throw new ServiceException("本次维修提交总数过大");
}
if ((bean.getRepairNum() - innerRepairNum - outerRepairNum - scrapNum) == 0) { //本次修完了
repairMapper.updateRepairedNum(bean.getId(), innerRepairNum + outerRepairNum, loginUser.getUserid(), loginUser.getUserid());
if ((bean.getRepairNum().subtract(innerRepairNum).subtract(outerRepairNum).subtract(scrapNum).compareTo(BigDecimal.valueOf(0)) ) == 0) { //本次修完了
repairMapper.updateRepairedNum(bean.getId(), innerRepairNum.add(outerRepairNum) , loginUser.getUserid(), loginUser.getUserid());
repairMapper.updateScrapNum(bean.getId(), scrapNum, loginUser.getUserid());
} else {
repairMapper.updateThisRepairedAndScrapNum(bean.getId(), innerRepairNum + outerRepairNum, scrapNum, loginUser.getUserid(), loginUser.getUserid());
repairMapper.updateThisRepairedAndScrapNum(bean.getId(), innerRepairNum.add(outerRepairNum) , scrapNum, loginUser.getUserid(), loginUser.getUserid());
}
}
@ -654,8 +655,8 @@ public class RepairServiceImpl implements RepairService {
// 维修记录表信息
repairApplyRecord.setTaskId(bean.getTaskId()).setMaId(bean.getMaId()).setTypeId(bean.getTypeId()).setRepairType(RepairTypeEnum.INNER_REPAIR.getTypeId());
if (MaTypeManageTypeEnum.CODE_DEVICE.getTypeId().equals(manageType)) {
repairApplyRecord.setRepairNum(!RepairTypeEnum.TO_SCRAP.getTypeId().equals(bean.getRepairType()) ? 1 : 0);
repairApplyRecord.setScrapNum(RepairTypeEnum.TO_SCRAP.getTypeId().equals(bean.getRepairType()) ? 1 : 0);
repairApplyRecord.setRepairNum(BigDecimal.valueOf(!RepairTypeEnum.TO_SCRAP.getTypeId().equals(bean.getRepairType()) ? 1 : 0));
repairApplyRecord.setScrapNum(BigDecimal.valueOf(RepairTypeEnum.TO_SCRAP.getTypeId().equals(bean.getRepairType()) ? 1 : 0));
}
if (MaTypeManageTypeEnum.NUMBER_DEVICE.getTypeId().equals(manageType)) {
repairApplyRecord.setRepairNum(partDetails.getRepairNum());
@ -702,9 +703,9 @@ public class RepairServiceImpl implements RepairService {
if (RepairTypeEnum.RETURN_FACTORY.getTypeId().equals(bean.getRepairType())) {
// ---------------校验维修数量-----------------
// 统计已维修数量 + 本次维修数量
int repairNum = OptionalInt.of(bean.getRepairedNum()).orElse(0) + bean.getRepairNum();
BigDecimal repairNum = bean.getRepairedNum().add(bean.getRepairNum()) ;
// 统计报废数量 + 维修合计数量 不能 大与> 总的待维修量
if (repairNum + OptionalInt.of(bean.getScrapNum()).orElse(0) > bean.getRepairNum()) {
if (repairNum.add(bean.getScrapNum()).compareTo(bean.getRepairNum())>0 ) {
throw new ServiceException("维修数量大于维修总量");
}
@ -747,8 +748,8 @@ public class RepairServiceImpl implements RepairService {
RepairApplyRecord repairApplyRecord = new RepairApplyRecord();
repairApplyRecord.setTaskId(bean.getTaskId()).setMaId(bean.getMaId()).setTypeId(bean.getTypeId())
.setRepairType(bean.getRepairType()).setStatus(0L).setFileIds(String.valueOf(fileInfo.getId()))
.setRepairNum(!RepairTypeEnum.TO_SCRAP.getTypeId().equals(bean.getRepairType()) ? 1 : 0)
.setScrapNum(RepairTypeEnum.TO_SCRAP.getTypeId().equals(bean.getRepairType()) ? 1 : 0)
.setRepairNum(BigDecimal.valueOf(!RepairTypeEnum.TO_SCRAP.getTypeId().equals(bean.getRepairType()) ? 1 : 0))
.setScrapNum(BigDecimal.valueOf(RepairTypeEnum.TO_SCRAP.getTypeId().equals(bean.getRepairType()) ? 1 : 0))
.setCreateBy(loginUser.getUsername());
// 不选维修配件时, 只添加维修记录表
@ -759,8 +760,8 @@ public class RepairServiceImpl implements RepairService {
RepairApplyRecord repairApplyRecord = new RepairApplyRecord();
repairApplyRecord.setTaskId(bean.getTaskId()).setMaId(bean.getMaId()).setTypeId(bean.getTypeId())
.setRepairType(bean.getRepairType()).setStatus(0L)
.setRepairNum(!RepairTypeEnum.TO_SCRAP.getTypeId().equals(bean.getRepairType()) ? 1 : 0)
.setScrapNum(RepairTypeEnum.TO_SCRAP.getTypeId().equals(bean.getRepairType()) ? 1 : 0)
.setRepairNum(BigDecimal.valueOf(!RepairTypeEnum.TO_SCRAP.getTypeId().equals(bean.getRepairType()) ? 1 : 0))
.setScrapNum(BigDecimal.valueOf(RepairTypeEnum.TO_SCRAP.getTypeId().equals(bean.getRepairType()) ? 1 : 0))
.setCreateBy(loginUser.getUsername());
// 不选维修配件时, 只添加维修记录表
@ -773,8 +774,8 @@ public class RepairServiceImpl implements RepairService {
RepairApplyRecord repairApplyRecord = new RepairApplyRecord();
repairApplyRecord.setTaskId(bean.getTaskId()).setMaId(bean.getMaId()).setTypeId(bean.getTypeId())
.setRepairType(bean.getRepairType()).setStatus(0L)
.setRepairNum(!RepairTypeEnum.TO_SCRAP.getTypeId().equals(bean.getRepairType()) ? 1 : 0)
.setScrapNum(RepairTypeEnum.TO_SCRAP.getTypeId().equals(bean.getRepairType()) ? 1 : 0)
.setRepairNum(BigDecimal.valueOf(!RepairTypeEnum.TO_SCRAP.getTypeId().equals(bean.getRepairType()) ? 1 : 0))
.setScrapNum(BigDecimal.valueOf(RepairTypeEnum.TO_SCRAP.getTypeId().equals(bean.getRepairType()) ? 1 : 0))
.setCreateBy(loginUser.getUsername());
// 不选维修配件时, 只添加维修记录表
@ -799,9 +800,9 @@ public class RepairServiceImpl implements RepairService {
// 查询维修任务的详情表
Long oldWxTaskId = task.getTaskId();
List<RepairTaskDetails> detailsList = repairApplyDetailsMapper.getRepairDetailsWhichNotSent(oldWxTaskId);
int thisRepairedNum = detailsList.stream().mapToInt(RepairTaskDetails::getThisRepairedNum).sum();
int thisScrapNum = detailsList.stream().mapToInt(RepairTaskDetails::getThisScrapNum).sum();
if (!CollectionUtils.isEmpty(detailsList) && (thisRepairedNum + thisScrapNum) > 0) {
BigDecimal thisRepairedNum = detailsList.stream().map(RepairTaskDetails::getThisRepairedNum).reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal thisScrapNum = detailsList.stream().map(RepairTaskDetails::getThisScrapNum).reduce(BigDecimal.ZERO, BigDecimal::add);
if (!CollectionUtils.isEmpty(detailsList) && (thisRepairedNum.add(thisScrapNum)).compareTo(BigDecimal.valueOf(0)) > 0) {
task.setCreateBy(loginUser.getUserid());
Long agreementId = repairMapper.getAgreementId(task);
// 新增tm_task表数据修饰审核任务状态是待审核
@ -817,14 +818,14 @@ public class RepairServiceImpl implements RepairService {
for (RepairTaskDetails details : detailsList) {
RepairApplyDetails repairApplyDetails = new RepairApplyDetails();
repairApplyDetails.setId(details.getId());
repairApplyDetails.setRepairedNum((long) (details.getRepairedNum() + details.getThisRepairedNum()));
repairApplyDetails.setThisRepairedNum(0);
repairApplyDetails.setScrapNum((long) (details.getScrapNum() + details.getThisScrapNum()));
repairApplyDetails.setThisScrapNum(0);
repairApplyDetails.setRepairedNum( (details.getRepairedNum().add(details.getThisRepairedNum()) ));
repairApplyDetails.setThisRepairedNum(BigDecimal.valueOf(0));
repairApplyDetails.setScrapNum( (details.getScrapNum().add( details.getThisScrapNum())));
repairApplyDetails.setThisScrapNum(BigDecimal.valueOf(0));
repairApplyDetailsMapper.updateRepairApplyDetails(repairApplyDetails);
details.setCreateBy(String.valueOf(loginUser.getUserid()));
details.setTaskId(task.getTaskId());
details.setRepairNum(details.getThisRepairedNum() + details.getThisScrapNum());
details.setRepairNum(details.getThisRepairedNum().add(details.getThisScrapNum()) );
details.setRepairedNum(details.getThisRepairedNum());
details.setScrapNum(details.getThisScrapNum());
repairMapper.addAuditDetails(details);

View File

@ -1,5 +1,6 @@
package com.bonus.material.scrap.domain;
import java.math.BigDecimal;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.bonus.common.core.annotation.Excel;
@ -10,7 +11,7 @@ import com.bonus.common.core.web.domain.BaseEntity;
/**
* 报废任务详细对象 scrap_apply_details
*
*
* @author xsheng
* @date 2024-10-16
*/
@ -47,7 +48,7 @@ public class ScrapApplyDetails extends BaseEntity {
/** 报废数量 */
@Excel(name = "报废数量")
@ApiModelProperty(value = "报废数量")
private Integer scrapNum;
private BigDecimal scrapNum;
/** (1退料2,维修审核3盘点) */
@Excel(name = "(1退料2,维修审核3盘点)")

View File

@ -166,6 +166,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
mt.type_name AS typeModel,
mt1.type_name AS typeName,
mt.unit_name AS unitName,
mt.unit_value AS unitValue,
mt.manage_type AS manageType,
ba.pre_num AS preNum,
ba.use_num AS num,
@ -640,4 +641,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and ma_id = #{maId}
</if>
</delete>
</mapper>
</mapper>

View File

@ -186,6 +186,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
mt.type_name as typeName,
mt.parent_id as parentId,
mt.unit_name as unitName,
mt.unit_value as unitValue,
mt.manage_type as manageType,
SUM( CASE WHEN sai.agreement_id = #{agreementId} AND sai.STATUS = '0' THEN sai.num ELSE 0 END ) AS num,
mt.LEVEL as level
@ -369,4 +370,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
GROUP BY
mt.type_id
</select>
</mapper>
</mapper>

View File

@ -10,6 +10,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="typeName" column="type_name" />
<result property="maTypeName" column="ma_type_name" />
<result property="unitName" column="unit_name" />
<result property="unitValue" column="unit_value" />
<result property="storageNum" column="storage_num" />
<result property="preNum" column="pre_num" />
<result property="auditNum" column="audit_num" />
@ -42,7 +43,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
IFNULL(lad.pre_num,0) as pre_num,
IFNULL(lad.audit_num,0) as audit_num,
IFNULL(lad.al_num,0) as al_num,
IFNULL(lad.status,0) as status, mt.unit_name,
IFNULL(lad.status,0) as status, mt.unit_name,mt.unit_value,
lad.create_by, lad.create_time, lad.update_by, lad.update_time, lad.remark, lad.company_id
from
lease_apply_details lad
@ -63,7 +64,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectLeaseApplyDetailsList" parameterType="com.bonus.material.lease.domain.LeaseApplyDetails" resultMap="LeaseApplyDetailsResult">
<include refid="selectLeaseApplyDetailsVo"/>
<where>
<where>
<if test="parentId != null "> and lad.parent_id = #{parentId}</if>
<if test="keyword != null and keyword != ''">
AND (mt.type_name LIKE CONCAT('%', #{keyword}, '%')
@ -77,12 +78,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="companyId != null "> and lad.company_id = #{companyId}</if>
</where>
</select>
<select id="selectLeaseApplyDetailsById" parameterType="Long" resultMap="LeaseApplyDetailsResult">
<include refid="selectLeaseApplyDetailsVo"/>
where lad.id = #{id}
</select>
<insert id="insertLeaseApplyDetails" parameterType="com.bonus.material.lease.domain.LeaseApplyDetails" useGeneratedKeys="true" keyProperty="id">
insert into lease_apply_details
<trim prefix="(" suffix=")" suffixOverrides=",">
@ -152,7 +153,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete>
<delete id="deleteLeaseApplyDetailsByIds" parameterType="String">
delete from lease_apply_details where id in
delete from lease_apply_details where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
@ -233,4 +234,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
) t
GROUP BY parent_id
</select>
</mapper>
</mapper>