新购数据类型decimal修改
This commit is contained in:
parent
f85970d073
commit
15b1b12384
|
|
@ -47,6 +47,9 @@ public class PurchaseCheckDetails extends BaseEntity {
|
|||
@ApiModelProperty(value = "物资单位名称")
|
||||
private String unitName;
|
||||
|
||||
@ApiModelProperty(value = "数值")
|
||||
private String unitValue;
|
||||
|
||||
@Excel(name = "物资名称", sort = 1)
|
||||
@ApiModelProperty(value = "物资名称--规格parent类型")
|
||||
private String maTypeName;
|
||||
|
|
@ -64,17 +67,17 @@ public class PurchaseCheckDetails extends BaseEntity {
|
|||
/** 采购数量 */
|
||||
@Excel(name = "采购数量", sort = 5)
|
||||
@ApiModelProperty(value = "采购数量")
|
||||
private Long purchaseNum;
|
||||
private BigDecimal purchaseNum;
|
||||
|
||||
/** 验收数量 */
|
||||
@Excel(name = "验收数量", sort = 6)
|
||||
@ApiModelProperty(value = "验收数量")
|
||||
private Long checkNum;
|
||||
private BigDecimal checkNum;
|
||||
|
||||
/** 绑定数量 */
|
||||
@Excel(name = "绑定数量", sort = 7)
|
||||
@ApiModelProperty(value = "绑定数量")
|
||||
private Long bindNum;
|
||||
private BigDecimal bindNum;
|
||||
|
||||
/** 验收结论 */
|
||||
//@Excel(name = "验收结论")
|
||||
|
|
@ -123,7 +126,7 @@ public class PurchaseCheckDetails extends BaseEntity {
|
|||
/** 入库数量 */
|
||||
@Excel(name = "入库数量", sort = 8)
|
||||
@ApiModelProperty(value = "入库数量")
|
||||
private Long inputNum;
|
||||
private BigDecimal inputNum;
|
||||
|
||||
/** 是否入库 */
|
||||
@Excel(name = "是否入库", readConverterExp = "0=否,1=是")
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ public class PurchaseCheckInfo extends BaseEntity {
|
|||
*/
|
||||
@Excel(name = "采购数量", sort = 4)
|
||||
@ApiModelProperty(value = "采购数量--外层Table字段")
|
||||
private Long purchaseMaNumber;
|
||||
private BigDecimal purchaseMaNumber;
|
||||
|
||||
/**
|
||||
* 采购单价(不含税)
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ public class PurchasePartDetails extends BaseEntity {
|
|||
/** 采购数量 */
|
||||
@Excel(name = "采购数量")
|
||||
@ApiModelProperty(value = "采购数量")
|
||||
private Long purchaseNum;
|
||||
private BigDecimal purchaseNum;
|
||||
|
||||
/** 供应商id */
|
||||
@Excel(name = "供应商id")
|
||||
|
|
@ -59,7 +59,7 @@ public class PurchasePartDetails extends BaseEntity {
|
|||
/** 验收数量 */
|
||||
@Excel(name = "验收数量")
|
||||
@ApiModelProperty(value = "验收数量")
|
||||
private Long checkNum;
|
||||
private BigDecimal checkNum;
|
||||
|
||||
/** 验收结论 */
|
||||
@Excel(name = "验收结论")
|
||||
|
|
@ -69,7 +69,7 @@ public class PurchasePartDetails extends BaseEntity {
|
|||
/** 入库数量 */
|
||||
@Excel(name = "入库数量")
|
||||
@ApiModelProperty(value = "入库数量")
|
||||
private Long inputNum;
|
||||
private BigDecimal inputNum;
|
||||
|
||||
/** 入库时间 */
|
||||
@ApiModelProperty(value = "入库时间")
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import com.fasterxml.jackson.annotation.JsonFormat;
|
|||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
|
|
@ -54,19 +55,19 @@ public class PurchaseVo {
|
|||
|
||||
@ApiModelProperty(value="采购数量")
|
||||
@Excel(name = "采购数量")
|
||||
private Integer purchaseNum;
|
||||
private BigDecimal purchaseNum;
|
||||
|
||||
@ApiModelProperty(value="验收数量")
|
||||
private Integer checkNum;
|
||||
private BigDecimal checkNum;
|
||||
|
||||
@ApiModelProperty(value="绑定数量")
|
||||
private Integer bindNum;
|
||||
private BigDecimal bindNum;
|
||||
|
||||
@ApiModelProperty(value="采购价格(元含税)")
|
||||
private Integer purchasePrice;
|
||||
private BigDecimal purchasePrice;
|
||||
|
||||
@ApiModelProperty(value="采购价格(元不含税)")
|
||||
private Integer notaxPrice;
|
||||
private BigDecimal notaxPrice;
|
||||
|
||||
@ApiModelProperty(value="税率")
|
||||
private Integer taxRate;
|
||||
|
|
@ -109,5 +110,5 @@ public class PurchaseVo {
|
|||
private String qrUrl;
|
||||
|
||||
@ApiModelProperty(value = "异常数量")
|
||||
private Integer exceptionNum;
|
||||
private BigDecimal exceptionNum;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import com.bonus.material.purchase.domain.dto.PurchaseDto;
|
|||
import com.bonus.material.purchase.domain.vo.PurchaseVo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
|
@ -33,7 +34,7 @@ public interface PurchaseStorageMapper {
|
|||
* @param bindNum
|
||||
* @return
|
||||
*/
|
||||
int updateNum(@Param("id") String purchaseId, @Param("bindNum") Integer bindNum);
|
||||
int updateNum(@Param("id") String purchaseId, @Param("bindNum") BigDecimal bindNum);
|
||||
|
||||
/**
|
||||
* 更新状态
|
||||
|
|
@ -56,7 +57,7 @@ public interface PurchaseStorageMapper {
|
|||
* @param typeId
|
||||
* @return
|
||||
*/
|
||||
int updateStorageNum(@Param("inputNum") Integer inputNum, @Param("typeId") Integer typeId);
|
||||
int updateStorageNum(@Param("inputNum") BigDecimal inputNum, @Param("typeId") Integer typeId);
|
||||
|
||||
/**
|
||||
* 查询详情单子状态
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.*;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.zip.ZipEntry;
|
||||
|
|
@ -153,7 +154,7 @@ public class PurchaseBindServiceImpl implements IPurchaseBindService {
|
|||
if (purchaseVo.getBindNum().equals(purchaseVo.getCheckNum())) {
|
||||
purchaseBindMapper.updateStatusById(PurchaseTaskStatusEnum.TO_STORE.getStatus(), purchaseVo.getPurchaseId());
|
||||
}
|
||||
if (purchaseVo.getBindNum() < purchaseVo.getCheckNum()) {
|
||||
if (purchaseVo.getBindNum().compareTo(purchaseVo.getCheckNum()) <0 ) {
|
||||
purchaseBindMapper.updateStatusById(PurchaseTaskStatusEnum.TO_BIND.getStatus(), purchaseVo.getPurchaseId());
|
||||
}
|
||||
}
|
||||
|
|
@ -251,19 +252,7 @@ public class PurchaseBindServiceImpl implements IPurchaseBindService {
|
|||
for (String purchaseId : idList) {
|
||||
result += purchaseBindMapper.updateStatusById(PurchaseTaskStatusEnum.TO_BIND_AFTER_REJECT.getStatus(), purchaseId);
|
||||
}
|
||||
// for (String id : idList) {
|
||||
// //根据二级页面驳回状态更新任务状态
|
||||
// dto.setPurchaseId(id);
|
||||
// List<PurchaseVo> list = purchaseBindMapper.getDetails(dto);
|
||||
// if (CollectionUtils.isNotEmpty(list)) {
|
||||
// for (PurchaseVo purchaseVo : list) {
|
||||
// PurchaseDto purchaseDto = new PurchaseDto();
|
||||
// purchaseDto.setTaskId(purchaseVo.getTaskId().toString());
|
||||
// List<PurchaseVo> voList = purchaseBindMapper.getDetails(purchaseDto);
|
||||
// result = getResult(result, voList);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
||||
if (result > 0) {
|
||||
return AjaxResult.success("操作成功");
|
||||
|
|
@ -271,33 +260,7 @@ public class PurchaseBindServiceImpl implements IPurchaseBindService {
|
|||
return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), HttpCodeEnum.FAIL.getMsg());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取结果方法抽取
|
||||
* @param result
|
||||
* @param voList
|
||||
* @return
|
||||
*/
|
||||
// private int getResult(int result, List<PurchaseVo> voList) {
|
||||
// Map<Integer, List<Integer>> groupedByIdStatus = voList.stream()
|
||||
// .collect(Collectors.groupingBy(
|
||||
// PurchaseVo::getTaskId,
|
||||
// Collectors.mapping(PurchaseVo::getStatus, Collectors.toList())
|
||||
// ));
|
||||
// result += groupedByIdStatus.entrySet().stream()
|
||||
// .mapToInt(entry -> {
|
||||
// Integer taskId = entry.getKey();
|
||||
// List<Integer> statusList = entry.getValue();
|
||||
// if (statusList.contains(PurchaseTaskStatusEnum.TO_BIND_AFTER_REJECT.getStatus()) ||
|
||||
// statusList.contains(PurchaseTaskStatusEnum.TO_BIND.getStatus())) {
|
||||
// return tmTaskMapper.updateStatusById(MaterialConstants.TEN_CONSTANT, taskId.toString());
|
||||
// } else if (!statusList.contains(PurchaseTaskStatusEnum.TO_BIND_AFTER_REJECT.getStatus()) && !statusList.contains(PurchaseTaskStatusEnum.TO_BIND.getStatus())
|
||||
// && statusList.contains(PurchaseTaskStatusEnum.TO_STORE.getStatus())) {
|
||||
// return tmTaskMapper.updateStatusById(PurchaseTaskStatusEnum.IN_STORE.getStatus(), taskId.toString());
|
||||
// }
|
||||
// return 0;
|
||||
// }).sum();
|
||||
// return result;
|
||||
// }
|
||||
|
||||
|
||||
/**
|
||||
* 内层二维码下载
|
||||
|
|
@ -318,8 +281,8 @@ public class PurchaseBindServiceImpl implements IPurchaseBindService {
|
|||
if (CollectionUtils.isNotEmpty(details)) {
|
||||
PurchaseVo detail = details.get(0);
|
||||
purchaseDto.setTaskId(detail.getTaskId().toString());
|
||||
if (detail.getBindNum() != null && detail.getBindNum() > 0) {
|
||||
detail.setCheckNum(detail.getCheckNum() - detail.getBindNum());
|
||||
if (detail.getBindNum() != null ) {
|
||||
detail.setCheckNum(detail.getCheckNum().subtract(detail.getBindNum()) );
|
||||
}
|
||||
getString(addedEntries, purchaseDto, genMonth, num, zos, detail.getMaterialModel(), detail.getMaterialName(), detail.getTypeId(), detail.getCheckNum());
|
||||
extractedUpStatus(purchaseDto);
|
||||
|
|
@ -340,8 +303,9 @@ public class PurchaseBindServiceImpl implements IPurchaseBindService {
|
|||
* @throws WriterException
|
||||
* @throws IOException
|
||||
*/
|
||||
private void getString(Set<String> addedEntries, PurchaseDto purchaseDto, String genMonth, int num, ZipOutputStream zos, String materialModel, String materialName, Integer typeId, Integer checkNum) throws WriterException, IOException {
|
||||
for (int j = 1; j <= checkNum; j++) {
|
||||
private void getString(Set<String> addedEntries, PurchaseDto purchaseDto, String genMonth, int num, ZipOutputStream zos, String materialModel, String materialName, Integer typeId, BigDecimal checkNum) throws WriterException, IOException {
|
||||
int genNum = Integer.parseInt(String.valueOf(checkNum));
|
||||
for (int j = 1; j <= genNum; j++) {
|
||||
genMonth = genMonth.replace("-", "");
|
||||
String code = genMonth + "-" + String.format("%5d", num + j).replace(" ", "0");
|
||||
// 新购管理-二维码打印-新增
|
||||
|
|
|
|||
|
|
@ -152,19 +152,19 @@ public class PurchaseCheckInfoServiceImpl implements IPurchaseCheckInfoService {
|
|||
purchaseInfo.setPurchaseMaTypeName(purchaseCheckDetailsMapper.selectMaTypeNameByTaskAndStatusList(purchaseInfo.getTaskId(), new ArrayList<>()));
|
||||
}
|
||||
if (!CollectionUtils.isEmpty(purchaseCheckDetails)) {
|
||||
AtomicLong purchaseMaTotalNumber = new AtomicLong(0L);
|
||||
BigDecimal purchaseMaTotalNumber = new BigDecimal("0");
|
||||
AtomicReference<BigDecimal> purchaseMaTotalPrice = new AtomicReference<>(BigDecimal.ZERO);
|
||||
for (PurchaseCheckDetails detail : purchaseCheckDetails) {
|
||||
if (detail.getPurchaseNum() == null || detail.getPurchasePrice() == null) {
|
||||
continue;
|
||||
}
|
||||
if (detail.getPurchaseNum() < 0 || detail.getPurchasePrice().compareTo(BigDecimal.ZERO) < 0) {
|
||||
if (detail.getPurchaseNum().compareTo(BigDecimal.ZERO) < 0 || detail.getPurchasePrice().compareTo(BigDecimal.ZERO) < 0) {
|
||||
throw new IllegalArgumentException("采购数量和价格必须为非负数");
|
||||
}
|
||||
purchaseMaTotalNumber.addAndGet(detail.getPurchaseNum());
|
||||
purchaseMaTotalPrice.updateAndGet(v -> v.add(new BigDecimal(detail.getPurchaseNum()).multiply(detail.getPurchasePrice())));
|
||||
purchaseMaTotalNumber.add(detail.getPurchaseNum());
|
||||
purchaseMaTotalPrice.updateAndGet(v -> v.add(detail.getPurchaseNum().multiply(detail.getPurchasePrice())));
|
||||
}
|
||||
purchaseInfo.setPurchaseMaNumber(purchaseMaTotalNumber.get());
|
||||
purchaseInfo.setPurchaseMaNumber(purchaseMaTotalNumber);
|
||||
purchaseInfo.setPurchasePrice(purchaseMaTotalPrice.get());
|
||||
if (purchaseInfo.getTaxRate() != null && purchaseInfo.getPurchasePrice() != null) {
|
||||
purchaseInfo.setPurchaseTaxPrice(calculateTaxPrice(purchaseMaTotalPrice.get(), purchaseInfo.getTaxRate()));
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ import com.bonus.material.task.mapper.TmTaskMapper;
|
|||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
|
@ -212,7 +213,7 @@ public class PurchaseStorageServiceImpl implements IPurchaseStorageService {
|
|||
} else {
|
||||
//编码入库
|
||||
List<PurchaseVo> purchaseVoList = purchaseBindMapper.selectPurchaseCheckInfoById(purchaseDto);
|
||||
result += purchaseStorageMapper.updateNum(purchaseDto.getPurchaseId(), purchaseDto.getInPutList().size());
|
||||
result += purchaseStorageMapper.updateNum(purchaseDto.getPurchaseId(), BigDecimal.valueOf(purchaseDto.getInPutList().size()));
|
||||
for (PurchaseDto dto : purchaseDto.getInPutList()) {
|
||||
if (CollectionUtils.isNotEmpty(purchaseVoList)) {
|
||||
for (PurchaseVo purchaseVo : purchaseVoList) {
|
||||
|
|
|
|||
|
|
@ -489,7 +489,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</select>
|
||||
|
||||
<select id="selectMaTypeList" resultMap="TypeResult">
|
||||
select DISTINCT m.type_id, m.type_name, m.parent_id, m.unit_id, m.unit_name, m.manage_type,
|
||||
select DISTINCT m.type_id, m.type_name, m.parent_id, m.unit_id, m.unit_name, m.unit_value,m.manage_type,
|
||||
m.lease_price,m.eff_time, m.rent_price, m.buy_price, m.pay_price, m.level, m.rated_load, m.test_load,
|
||||
m.holding_time, m.warn_num,
|
||||
m.del_flag, m.create_by, m.create_time,
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<result property="typeId" column="type_id" />
|
||||
<result property="typeName" column="type_name" />
|
||||
<result property="unitName" column="unit_name" />
|
||||
<result property="unitValue" column="unit_value" />
|
||||
<result property="maTypeName" column="ma_type_name" />
|
||||
<result property="purchasePrice" column="purchase_price" />
|
||||
<result property="purchaseTaxPrice" column="purchase_tax_price" />
|
||||
|
|
@ -44,7 +45,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
select pcd.id, pcd.task_id, pcd.type_id, pcd.purchase_price, pcd.purchase_tax_price, pcd.purchase_num, pcd.check_num, pcd.bind_num, pcd.check_result,
|
||||
pcd.supplier_id, pcd.status, pcd.create_by, pcd.production_time, pcd.create_time, pcd.update_by, pcd.update_time,
|
||||
pcd.remark, pcd.check_url_name, pcd.check_url, pcd.input_num, pcd.input_status, pcd.input_time, pcd.file_name,
|
||||
pcd.file_url, pcd.company_id, pcd.fix_code, mt.type_name, mt.unit_name, mtp.type_name as ma_type_name, mt.manage_type as manage_type,
|
||||
pcd.file_url, pcd.company_id, pcd.fix_code, mt.type_name, mt.unit_name, mt.unit_value,mtp.type_name as ma_type_name, mt.manage_type as manage_type,
|
||||
pcd.warn_documents as warnDocuments, pcd.reason as reason
|
||||
from purchase_check_details pcd
|
||||
left join ma_type mt on pcd.type_id = mt.type_id
|
||||
|
|
|
|||
Loading…
Reference in New Issue