add:单据转发中鼎开关
This commit is contained in:
@@ -1,12 +1,17 @@
|
||||
package org.nl.wms.ext_manage.purchase.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.logging.annotation.Log;
|
||||
import org.nl.wms.ext_manage.purchase.service.EasToWmsService;
|
||||
import org.nl.wms.ext_manage.purchase.service.dto.BillChangeDto;
|
||||
import org.nl.wms.ext_manage.service.WmsToZDWmdService;
|
||||
import org.nl.wms.system_manage.enums.SysParamConstant;
|
||||
import org.nl.wms.system_manage.service.param.ISysParamService;
|
||||
import org.nl.wms.system_manage.service.param.dao.Param;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;import org.nl.common.base.ResponseData;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@@ -19,7 +24,8 @@ import org.springframework.web.bind.annotation.*;
|
||||
public class EasToWmsController {
|
||||
|
||||
private final EasToWmsService easToWmsService;
|
||||
|
||||
private final WmsToZDWmdService wmsToZDWmdService;
|
||||
private final ISysParamService paramService;
|
||||
|
||||
|
||||
@PostMapping("/orderChangeNotice")
|
||||
@@ -27,6 +33,10 @@ public class EasToWmsController {
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> billChange(@RequestBody BillChangeDto body) {
|
||||
JSONObject result = easToWmsService.billChangeHandler(body);
|
||||
Param forwardAllZD = paramService.findByCode(SysParamConstant.FORWARD_ALL_ZD);
|
||||
if (ObjectUtil.isNotEmpty(forwardAllZD) && "1".equals(forwardAllZD.getValue())) {
|
||||
wmsToZDWmdService.syncPurchaseReceiving(body);
|
||||
}
|
||||
return ResponseData.build(result, HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
@@ -69,6 +69,15 @@ class SysParamController {
|
||||
return ResponseData.build(paramService.findByCode(code), HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PutMapping("/updateValueByCode")
|
||||
@Log("根据编码更新参数值")
|
||||
public ResponseEntity<Object> updateValueByCode(@RequestBody Map<String, String> body) {
|
||||
String code = body.get("code");
|
||||
String value = body.get("value");
|
||||
paramService.updateValueByCode(code, value);
|
||||
return ResponseData.build();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -42,4 +42,9 @@ public class SysParamConstant {
|
||||
*/
|
||||
public final static String PRINTER_PORT = "printer_port";
|
||||
|
||||
/**
|
||||
* 单据转发中鼎开关 0-关闭 1-开启
|
||||
*/
|
||||
public final static String FORWARD_ALL_ZD = "forward_all_zd";
|
||||
|
||||
}
|
||||
|
||||
@@ -56,4 +56,12 @@ public interface ISysParamService extends IService<Param> {
|
||||
* @return Param
|
||||
*/
|
||||
Param findByCode(String code);
|
||||
|
||||
/**
|
||||
* 根据编码更新参数值,不存在则创建
|
||||
*
|
||||
* @param code 参数编码
|
||||
* @param value 参数值
|
||||
*/
|
||||
void updateValueByCode(String code, String value);
|
||||
}
|
||||
|
||||
@@ -101,4 +101,38 @@ public class SysParamServiceImpl extends ServiceImpl<SysParamMapper, Param> impl
|
||||
Param param = paramMapper.selectOne(queryWrapper);
|
||||
return param;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateValueByCode(String code, String value) {
|
||||
Param param = findByCode(code);
|
||||
if (param == null) {
|
||||
param = new Param();
|
||||
param.setCode(code);
|
||||
param.setName(code);
|
||||
param.setZh_name(code);
|
||||
param.setEn_name(code);
|
||||
param.setIn_name(code);
|
||||
param.setValue(value);
|
||||
param.setIs_active(true);
|
||||
param.setIs_delete(false);
|
||||
param.setId(IdUtil.getSnowflake(1, 1).nextIdStr());
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
param.setCreate_id(currentUserId);
|
||||
param.setCreate_name(nickName);
|
||||
param.setCreate_time(now);
|
||||
param.setUpdate_id(currentUserId);
|
||||
param.setUpdate_name(nickName);
|
||||
param.setUpdate_time(now);
|
||||
paramMapper.insert(param);
|
||||
} else {
|
||||
param.setValue(value);
|
||||
param.setUpdate_id(SecurityUtils.getCurrentUserId());
|
||||
param.setUpdate_name(SecurityUtils.getCurrentNickName());
|
||||
param.setUpdate_time(DateUtil.now());
|
||||
paramMapper.updateById(param);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user