Merge branch 'master' of http://gitea.zianxin.com/zianxin-tec/biz-api-cloud
This commit is contained in:
commit
fb703a956d
9 files changed
+127
-89
No files matched your search
+4
@@ -52,4 +52,8 @@ public class InventoryRecordSaveItemDTO {
|
||||
private Long unitId;
|
||||
|
||||
|
||||
@Schema(description="实际进价")
|
||||
private Integer realPrice;
|
||||
|
||||
|
||||
}
|
||||
+10
-6
@@ -44,16 +44,16 @@ public class InventoryRecordItemVo {
|
||||
* 进价
|
||||
*/
|
||||
@Schema(description="进价")
|
||||
@JsonSerialize(using = MoneySerializer.class) // 分 -> 元
|
||||
@JsonDeserialize(using = MoneyDeserializer.class) // 元 -> 分
|
||||
// @JsonSerialize(using = MoneySerializer.class) // 分 -> 元
|
||||
// @JsonDeserialize(using = MoneyDeserializer.class) // 元 -> 分
|
||||
private Integer unitPrice;
|
||||
|
||||
/**
|
||||
* 累计总金额
|
||||
*/
|
||||
@Schema(description="累计总金额")
|
||||
@JsonSerialize(using = MoneySerializer.class) // 分 -> 元
|
||||
@JsonDeserialize(using = MoneyDeserializer.class) // 元 -> 分
|
||||
// @JsonSerialize(using = MoneySerializer.class) // 分 -> 元
|
||||
// @JsonDeserialize(using = MoneyDeserializer.class) // 元 -> 分
|
||||
private Integer totalAmount;
|
||||
|
||||
/**
|
||||
@@ -87,12 +87,16 @@ public class InventoryRecordItemVo {
|
||||
@Schema(description="装数")
|
||||
private Integer packageNum;
|
||||
|
||||
|
||||
@Schema(description="实际进价")
|
||||
private Integer realPrice;
|
||||
|
||||
/**
|
||||
* 进价(分为单位)
|
||||
*/
|
||||
@Schema(description="进价(分为单位)")
|
||||
@JsonSerialize(using = MoneySerializer.class) // 分 -> 元
|
||||
@JsonDeserialize(using = MoneyDeserializer.class) // 元 -> 分
|
||||
// @JsonSerialize(using = MoneySerializer.class) // 分 -> 元
|
||||
// @JsonDeserialize(using = MoneyDeserializer.class) // 元 -> 分
|
||||
private Integer purchasePrice;
|
||||
|
||||
@Schema(description = "包装对象集合对象")
|
||||
|
||||
+1
@@ -87,6 +87,7 @@ public class SmErpInventoryRecordsController {
|
||||
wrapper.eq(SmErpInventoryRecordsEntity::getInventoryType, smErpInventoryRecords.getInventoryType());
|
||||
wrapper.eq(StrUtil.isNotBlank(smErpInventoryRecords.getInventoryCode()),SmErpInventoryRecordsEntity::getInventoryCode,smErpInventoryRecords.getInventoryCode());
|
||||
wrapper.eq(null!=smErpInventoryRecords.getInventoryDate(),SmErpInventoryRecordsEntity::getInventoryDate,smErpInventoryRecords.getInventoryDate());
|
||||
wrapper.orderByDesc(SmErpInventoryRecordsEntity::getCreateTime);
|
||||
return R.ok(smErpInventoryRecordsService.pageScope(page, wrapper));
|
||||
}
|
||||
|
||||
|
||||
+3
-2
@@ -135,8 +135,9 @@ public class SmErpSupplierController {
|
||||
*/
|
||||
@Operation(summary = "通过id查询" , description = "通过id查询" )
|
||||
@GetMapping("/selectSimpleAll" )
|
||||
public R selectSimpleAll(@RequestParam(value = "name",required = false)String name) {
|
||||
List<SmErpSupplierEntity> list = smErpSupplierService.selectSimpleAllScope(name);
|
||||
public R selectSimpleAll(@RequestParam(value = "name",required = false)String name,
|
||||
@RequestParam(value = "supplierId",required = false)Long supplierId) {
|
||||
List<SmErpSupplierEntity> list = smErpSupplierService.selectSimpleAllScope(name,supplierId);
|
||||
List<SmErpSupplierSimpleVo> bean = BeanUtils.toBean(list, SmErpSupplierSimpleVo.class);
|
||||
return R.ok(bean);
|
||||
}
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@ public interface SmErpSupplierService extends IService<SmErpSupplierEntity> {
|
||||
* 隔离查询
|
||||
* @return
|
||||
*/
|
||||
List<SmErpSupplierEntity> selectSimpleAllScope(String name);
|
||||
List<SmErpSupplierEntity> selectSimpleAllScope(String name,Long supplierId);
|
||||
|
||||
|
||||
/**
|
||||
|
||||
+61
-38
@@ -80,59 +80,60 @@ public class SmErpInventoryRecordsServiceImpl extends ServiceImpl<SmErpInventory
|
||||
smErpCgDdEntity.setTotalAmount(sum);
|
||||
|
||||
//发起流程
|
||||
String inventoryType = inventoryRecordSaveDTO.getInventoryType();
|
||||
String processKey = getProcessKey(inventoryType);
|
||||
R<Process> processR = remoteFlowApiFlowService.getProcessByBusinessKey(processKey);
|
||||
if (!processR.isOk() || processR.getData() == null) {
|
||||
throw new ServiceException("流程配置获取失败: " + processR.getMsg());
|
||||
}
|
||||
String flowId = processR.getData().getFlowId();
|
||||
ProcessInstanceParamDto processInstanceParamDto = new ProcessInstanceParamDto();
|
||||
processInstanceParamDto.setFlowId(flowId);
|
||||
Map<String,Object> params = new HashMap<>();
|
||||
params.put("inventoryType",inventoryType);
|
||||
processInstanceParamDto.setParamMap(params);
|
||||
R<String> stringR = remoteFlowApiFlowService.startProcessInstance(processInstanceParamDto);
|
||||
if (!stringR.isOk() || stringR.getData() == null) {
|
||||
throw new ServiceException("流程实例启动失败: " + stringR.getMsg());
|
||||
}
|
||||
String processInstanceId = stringR.getData();
|
||||
smErpCgDdEntity.setProcessInstanceId(processInstanceId);
|
||||
smErpCgDdEntity.setCheckStatus(TaskCheckStatusEnum.PADDING.getCode());
|
||||
// String inventoryType = inventoryRecordSaveDTO.getInventoryType();
|
||||
// String processKey = getProcessKey(inventoryType);
|
||||
// R<Process> processR = remoteFlowApiFlowService.getProcessByBusinessKey(processKey);
|
||||
// if (!processR.isOk() || processR.getData() == null) {
|
||||
// throw new ServiceException("流程配置获取失败: " + processR.getMsg());
|
||||
// }
|
||||
// String flowId = processR.getData().getFlowId();
|
||||
// ProcessInstanceParamDto processInstanceParamDto = new ProcessInstanceParamDto();
|
||||
// processInstanceParamDto.setFlowId(flowId);
|
||||
// Map<String,Object> params = new HashMap<>();
|
||||
// params.put("inventoryType",inventoryType);
|
||||
// processInstanceParamDto.setParamMap(params);
|
||||
// R<String> stringR = remoteFlowApiFlowService.startProcessInstance(processInstanceParamDto);
|
||||
// if (!stringR.isOk() || stringR.getData() == null) {
|
||||
// throw new ServiceException("流程实例启动失败: " + stringR.getMsg());
|
||||
// }
|
||||
// String processInstanceId = stringR.getData();
|
||||
// smErpCgDdEntity.setProcessInstanceId(processInstanceId);
|
||||
// smErpCgDdEntity.setCheckStatus(TaskCheckStatusEnum.PADDING.getCode());
|
||||
smErpCgDdEntity.setCheckStatus(TaskCheckStatusEnum.RESULT.getCode());
|
||||
|
||||
int insert = baseMapper.insert(smErpCgDdEntity);
|
||||
|
||||
List<SmErpInventoryRecordsItemEntity> cgPlanItemEntities = BeanUtils.toBean(items, SmErpInventoryRecordsItemEntity.class);
|
||||
// int sum1 = cgPlanItemEntities.stream().mapToInt(SmErpInventoryRecordsItemEntity::getTotalAmount).sum();
|
||||
|
||||
// List<UpdateStockDTO> updateStockDTOS = new ArrayList<>();
|
||||
List<UpdateStockDTO> updateStockDTOS = new ArrayList<>();
|
||||
for (SmErpInventoryRecordsItemEntity cgPlanItemEntity : cgPlanItemEntities) {
|
||||
cgPlanItemEntity.setInventoryId(smErpCgDdEntity.getId());
|
||||
cgPlanItemEntity.setDeptId(deptId);
|
||||
// UpdateStockDTO updateStockDTO = new UpdateStockDTO();
|
||||
// updateStockDTO.setId(cgPlanItemEntity.getErpSpuId());
|
||||
// Double quantity = cgPlanItemEntity.getQuantity();
|
||||
UpdateStockDTO updateStockDTO = new UpdateStockDTO();
|
||||
updateStockDTO.setId(cgPlanItemEntity.getErpSpuId());
|
||||
Double quantity = cgPlanItemEntity.getQuantity();
|
||||
String orderType = smErpCgDdEntity.getOrderType();
|
||||
cgPlanItemEntity.setOrderType(orderType);
|
||||
// if (orderType.equals(OrderTypeEnum.RK.getType())){
|
||||
// updateStockDTO.setIncrCount(quantity);
|
||||
// }else if (orderType.equals(OrderTypeEnum.CK.getType())){
|
||||
// updateStockDTO.setIncrCount(-quantity);
|
||||
// }else if (orderType.equals(OrderTypeEnum.No.getType())){
|
||||
// //无需更新库存
|
||||
// }else {
|
||||
// throw new RuntimeException("订单类型错误");
|
||||
// }
|
||||
if (orderType.equals(OrderTypeEnum.RK.getType())){
|
||||
updateStockDTO.setIncrCount(quantity);
|
||||
}else if (orderType.equals(OrderTypeEnum.CK.getType())){
|
||||
updateStockDTO.setIncrCount(-quantity);
|
||||
}else if (orderType.equals(OrderTypeEnum.No.getType())){
|
||||
//无需更新库存
|
||||
}else {
|
||||
throw new RuntimeException("订单类型错误");
|
||||
}
|
||||
|
||||
// updateStockDTOS.add(updateStockDTO);
|
||||
updateStockDTOS.add(updateStockDTO);
|
||||
}
|
||||
smErpInventoryRecordsItemMapper.insert(cgPlanItemEntities);
|
||||
|
||||
// //todo 实际上应该审批后才会入库
|
||||
// //更新库存
|
||||
// if (!CollectionUtils.isEmpty(updateStockDTOS)){
|
||||
// smErpStockService.updateStock(updateStockDTOS);
|
||||
// }
|
||||
// //todo 实际上应该审批后才会入库,这里已经写完了,因为说要直接入库不审核,又改回去了
|
||||
//更新库存
|
||||
if (!CollectionUtils.isEmpty(updateStockDTOS)){
|
||||
smErpStockService.updateStock(updateStockDTOS);
|
||||
}
|
||||
//更新已关联的采购,标记为已使用
|
||||
LambdaQueryWrapper<SmErpCgDdEntity> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(SmErpCgDdEntity::getCode, inventoryRecordSaveDTO.getInventoryCode());
|
||||
@@ -487,6 +488,7 @@ public class SmErpInventoryRecordsServiceImpl extends ServiceImpl<SmErpInventory
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public Object removeBatch(ArrayList<Long> list) {
|
||||
//首先先查询是否有当前数据权限
|
||||
LambdaQueryWrapper<SmErpInventoryRecordsEntity> eq = new LambdaQueryWrapper<SmErpInventoryRecordsEntity>().in(SmErpInventoryRecordsEntity::getId, list);
|
||||
@@ -495,6 +497,8 @@ public class SmErpInventoryRecordsServiceImpl extends ServiceImpl<SmErpInventory
|
||||
|
||||
LambdaQueryWrapper<SmErpInventoryRecordsItemEntity> itemEntityLambdaQueryWrapper = new LambdaQueryWrapper<SmErpInventoryRecordsItemEntity>()
|
||||
.in(SmErpInventoryRecordsItemEntity::getInventoryId, delIds);
|
||||
//要删除的item
|
||||
List<SmErpInventoryRecordsItemEntity> items = smErpInventoryRecordsItemMapper.selectList(itemEntityLambdaQueryWrapper);
|
||||
smErpInventoryRecordsItemMapper.delete(itemEntityLambdaQueryWrapper);
|
||||
baseMapper.deleteByIds(delIds);
|
||||
List<Long> toDeleteIds = delIds.stream()
|
||||
@@ -503,6 +507,25 @@ public class SmErpInventoryRecordsServiceImpl extends ServiceImpl<SmErpInventory
|
||||
if (!CollectionUtils.isEmpty(toDeleteIds)){
|
||||
return R.failed("越权删除!");
|
||||
}
|
||||
//删除之前入库的库存
|
||||
List<UpdateStockDTO> updateStockDTOS = new ArrayList<>();
|
||||
for (SmErpInventoryRecordsItemEntity item : items){
|
||||
//库存更新对象
|
||||
UpdateStockDTO updateStockDTO = new UpdateStockDTO();
|
||||
updateStockDTO.setId(item.getErpSpuId());
|
||||
Double quantity = item.getQuantity();
|
||||
String orderType = item.getOrderType();
|
||||
//入库的删除就是减去入的库存,所以是负数
|
||||
if (orderType.equals(OrderTypeEnum.RK.getType())){
|
||||
updateStockDTO.setIncrCount(-quantity);
|
||||
}else if (orderType.equals(OrderTypeEnum.CK.getType())){
|
||||
updateStockDTO.setIncrCount(quantity);
|
||||
}else {
|
||||
throw new RuntimeException("订单类型错误");
|
||||
}
|
||||
updateStockDTOS.add(updateStockDTO);
|
||||
}
|
||||
smErpStockService.updateStock(updateStockDTOS);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
+6
-5
@@ -38,11 +38,12 @@ public class SmErpSupplierServiceImpl extends ServiceImpl<SmErpSupplierMapper, S
|
||||
|
||||
private final SmErpSupplierTypeMapper supplierTypeMapper;
|
||||
@Override
|
||||
public List<SmErpSupplierEntity> selectSimpleAllScope(String name) {
|
||||
LambdaQueryWrapper<SmErpSupplierEntity> eq = new LambdaQueryWrapper<SmErpSupplierEntity>()
|
||||
.eq(SmErpSupplierEntity::getStatus, "0")
|
||||
.like(StringUtils.isNotBlank(name),SmErpSupplierEntity::getSupplierName,name);
|
||||
return baseMapper.selectListByScope(eq, DataScope.of());
|
||||
public List<SmErpSupplierEntity> selectSimpleAllScope(String name,Long supplierId) {
|
||||
LambdaQueryWrapper<SmErpSupplierEntity> wrapper = new LambdaQueryWrapper<SmErpSupplierEntity>();
|
||||
wrapper.eq(SmErpSupplierEntity::getStatus, "0");
|
||||
wrapper.like(StringUtils.isNotBlank(name),SmErpSupplierEntity::getSupplierName,name);
|
||||
wrapper.eq(supplierId!=null,SmErpSupplierEntity::getSupplierId,supplierId);
|
||||
return baseMapper.selectListByScope(wrapper, DataScope.of());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+5
-1
@@ -432,10 +432,14 @@ public class SysUserController {
|
||||
|
||||
@GetMapping("/getSimpleUserAll")
|
||||
@Schema(description = "简要用户信息")
|
||||
public R<List<SimpleUserAllListVO>> getSimpleUserAllList(@RequestParam(value = "mobile", required = false) String mobile, @RequestParam(value = "name", required = false) String name) {
|
||||
public R<List<SimpleUserAllListVO>> getSimpleUserAllList(
|
||||
@RequestParam(value = "mobile", required = false) String mobile,
|
||||
@RequestParam(value = "name", required = false) String name,
|
||||
@RequestParam(value = "userId", required = false) Long userId) {
|
||||
LambdaQueryWrapper<SysUser> sysUserLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
sysUserLambdaQueryWrapper.like(StringUtils.isNotBlank(mobile), SysUser::getPhone, mobile);
|
||||
sysUserLambdaQueryWrapper.like(StringUtils.isNotBlank(name), SysUser::getName, name);
|
||||
sysUserLambdaQueryWrapper.eq(null!=userId,SysUser::getUserId, userId);
|
||||
List<SimpleUserAllListVO> list = userService.listScope(sysUserLambdaQueryWrapper);
|
||||
return R.ok(list);
|
||||
}
|
||||
|
||||
+36
-36
@@ -295,47 +295,47 @@ public class SysMessageServiceImpl extends ServiceImpl<SysMessageMapper, SysMess
|
||||
public R sendSms(MessageSmsDTO messageSmsDTO) {
|
||||
|
||||
// 根据业务编码获取短信通道配置
|
||||
List<SysSystemConfigEntity> configEntityList = sysSystemConfigMapper.selectList(Wrappers.<SysSystemConfigEntity>lambdaQuery().eq(SysSystemConfigEntity::getConfigType, SystemConfigTypeEnum.SMS.getValue()).eq(SysSystemConfigEntity::getConfigStatus, YesNoEnum.YES.getCode()).eq(SysSystemConfigEntity::getConfigKey, messageSmsDTO.getBizCode()));
|
||||
if (CollUtil.isEmpty(configEntityList)) {
|
||||
return R.failed("发送失败,短信通道配置不存在");
|
||||
}
|
||||
// List<SysSystemConfigEntity> configEntityList = sysSystemConfigMapper.selectList(Wrappers.<SysSystemConfigEntity>lambdaQuery().eq(SysSystemConfigEntity::getConfigType, SystemConfigTypeEnum.SMS.getValue()).eq(SysSystemConfigEntity::getConfigStatus, YesNoEnum.YES.getCode()).eq(SysSystemConfigEntity::getConfigKey, messageSmsDTO.getBizCode()));
|
||||
// if (CollUtil.isEmpty(configEntityList)) {
|
||||
// return R.failed("发送失败,短信通道配置不存在");
|
||||
// }
|
||||
|
||||
SysSystemConfigEntity configEntity = configEntityList.get(0);
|
||||
JSONObject configMap = JSONUtil.parseObj(configEntity.getConfigValue());
|
||||
// SysSystemConfigEntity configEntity = configEntityList.get(0);
|
||||
// JSONObject configMap = JSONUtil.parseObj(configEntity.getConfigValue());
|
||||
|
||||
// 组装SMS4J 的发送对象
|
||||
SmsBlend smsBlend = SmsFactory.getSmsBlend(messageSmsDTO.getBizCode());
|
||||
if (Objects.isNull(smsBlend)) {
|
||||
Class targetClass = Arrays.stream(SUPPORT_CONFIG_CLAZZ).filter(config -> config.getSimpleName().toLowerCase().contains(configMap.getStr(MessageSmsDTO.Fields.supplier))).findFirst().orElseThrow(() -> new CheckedException("发送失败,短信通道配置不存在"));
|
||||
BaseConfig baseConfig = (BaseConfig) JSONUtil.toBean(configEntity.getConfigValue(), targetClass);
|
||||
|
||||
// 如果渠道扩展参数不为空则增加特性化参数
|
||||
if (StrUtil.isNotBlank(configMap.getStr(MessageSmsDTO.Fields.extParams))) {
|
||||
JSONObject extParams = configMap.getJSONObject(MessageSmsDTO.Fields.extParams);
|
||||
BeanUtil.copyProperties(extParams, baseConfig);
|
||||
}
|
||||
|
||||
baseConfig.setConfigId(configEntity.getConfigKey());
|
||||
SmsFactory.createSmsBlend(baseConfig);
|
||||
smsBlend = SmsFactory.getSmsBlend(messageSmsDTO.getBizCode());
|
||||
}
|
||||
// SmsBlend smsBlend = SmsFactory.getSmsBlend(messageSmsDTO.getBizCode());
|
||||
// if (Objects.isNull(smsBlend)) {
|
||||
// Class targetClass = Arrays.stream(SUPPORT_CONFIG_CLAZZ).filter(config -> config.getSimpleName().toLowerCase().contains(configMap.getStr(MessageSmsDTO.Fields.supplier))).findFirst().orElseThrow(() -> new CheckedException("发送失败,短信通道配置不存在"));
|
||||
// BaseConfig baseConfig = (BaseConfig) JSONUtil.toBean(configEntity.getConfigValue(), targetClass);
|
||||
//
|
||||
// // 如果渠道扩展参数不为空则增加特性化参数
|
||||
// if (StrUtil.isNotBlank(configMap.getStr(MessageSmsDTO.Fields.extParams))) {
|
||||
// JSONObject extParams = configMap.getJSONObject(MessageSmsDTO.Fields.extParams);
|
||||
// BeanUtil.copyProperties(extParams, baseConfig);
|
||||
// }
|
||||
//
|
||||
// baseConfig.setConfigId(configEntity.getConfigKey());
|
||||
// SmsFactory.createSmsBlend(baseConfig);
|
||||
// smsBlend = SmsFactory.getSmsBlend(messageSmsDTO.getBizCode());
|
||||
// }
|
||||
|
||||
// 异步发送短信
|
||||
SysLogDTO sysLog = SysLogUtils.getSysLog();
|
||||
Long start = System.currentTimeMillis();
|
||||
sysLog.setTenantId(TenantContextHolder.getTenantId());
|
||||
for (String mobile : messageSmsDTO.getMobiles()) {
|
||||
smsBlend.sendMessageAsync(mobile, configMap.getStr(MessageSmsDTO.Fields.templateId), messageSmsDTO.getParams(), smsResponse -> {
|
||||
log.info("发送短信结果:{}", smsResponse);
|
||||
sysLog.setTitle(String.format("发送短信 %s", mobile));
|
||||
sysLog.setLogType(LogTypeEnum.NORMAL.getType());
|
||||
sysLog.setServiceId(SystemConfigTypeEnum.SMS.getValue());
|
||||
sysLog.setParams(JacksonSensitiveFieldUtil.writeValueAsString(smsResponse));
|
||||
sysLog.setTime(System.currentTimeMillis() - start);
|
||||
sysLog.setException(JacksonSensitiveFieldUtil.writeValueAsString(smsResponse));
|
||||
remoteLogService.saveLog(sysLog);
|
||||
});
|
||||
}
|
||||
// SysLogDTO sysLog = SysLogUtils.getSysLog();
|
||||
// Long start = System.currentTimeMillis();
|
||||
// sysLog.setTenantId(TenantContextHolder.getTenantId());
|
||||
// for (String mobile : messageSmsDTO.getMobiles()) {
|
||||
// smsBlend.sendMessageAsync(mobile, configMap.getStr(MessageSmsDTO.Fields.templateId), messageSmsDTO.getParams(), smsResponse -> {
|
||||
// log.info("发送短信结果:{}", smsResponse);
|
||||
// sysLog.setTitle(String.format("发送短信 %s", mobile));
|
||||
// sysLog.setLogType(LogTypeEnum.NORMAL.getType());
|
||||
// sysLog.setServiceId(SystemConfigTypeEnum.SMS.getValue());
|
||||
// sysLog.setParams(JacksonSensitiveFieldUtil.writeValueAsString(smsResponse));
|
||||
// sysLog.setTime(System.currentTimeMillis() - start);
|
||||
// sysLog.setException(JacksonSensitiveFieldUtil.writeValueAsString(smsResponse));
|
||||
// remoteLogService.saveLog(sysLog);
|
||||
// });
|
||||
// }
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user