Compare commits
10 Commits
a6922e57da
...
685ba9473b
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
685ba9473b | ||
|
|
09f8db69c4 | ||
|
|
cfdeb40a23 | ||
|
|
10bfece481 | ||
|
|
79a760a379 | ||
|
|
dd9142a670 | ||
|
|
8faa14d227 | ||
|
|
82219fd733 | ||
|
|
f797283021 | ||
|
|
d382abba10 |
@@ -12,6 +12,7 @@ public interface ErrorCodeConstants {
|
|||||||
// ========== 示例模块 1-001-000-000 ==========
|
// ========== 示例模块 1-001-000-000 ==========
|
||||||
ErrorCode MATERIAL_OTHER_NOT_EXISTS = new ErrorCode(1_001_000_001, "物料不存在");
|
ErrorCode MATERIAL_OTHER_NOT_EXISTS = new ErrorCode(1_001_000_001, "物料不存在");
|
||||||
ErrorCode ELEMENT_NOT_EXISTS = new ErrorCode(1_001_000_001, "金属元素不存在");
|
ErrorCode ELEMENT_NOT_EXISTS = new ErrorCode(1_001_000_001, "金属元素不存在");
|
||||||
|
ErrorCode ELEMENT_EXISTS = new ErrorCode(1_001_000_002, "金属元素已经存在");
|
||||||
ErrorCode CONTACT_NOT_EXISTS = new ErrorCode(1_001_000_001, "联系人不存在");
|
ErrorCode CONTACT_NOT_EXISTS = new ErrorCode(1_001_000_001, "联系人不存在");
|
||||||
ErrorCode ACCOUNT_NOT_EXISTS = new ErrorCode(1_001_000_001, "账户条款不存在");
|
ErrorCode ACCOUNT_NOT_EXISTS = new ErrorCode(1_001_000_001, "账户条款不存在");
|
||||||
ErrorCode MATERIAL_DESTROY_NOT_EXISTS = new ErrorCode(1_001_000_001, "物料回收率不存在");
|
ErrorCode MATERIAL_DESTROY_NOT_EXISTS = new ErrorCode(1_001_000_001, "物料回收率不存在");
|
||||||
|
|||||||
@@ -88,6 +88,14 @@ public class ElementController {
|
|||||||
return success(BeanUtils.toBean(pageResult, ElementRespVO.class));
|
return success(BeanUtils.toBean(pageResult, ElementRespVO.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/pageByEnable")
|
||||||
|
@Operation(summary = "获得启用的金属元素分页")
|
||||||
|
@PreAuthorize("@ss.hasPermission('base:element:query')")
|
||||||
|
public CommonResult<PageResult<ElementRespVO>> getElementPageByEnable(@Valid ElementPageReqVO pageReqVO) {
|
||||||
|
PageResult<ElementDO> pageResult = elementService.getElementPageByEnable(pageReqVO);
|
||||||
|
return success(BeanUtils.toBean(pageResult, ElementRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
@GetMapping("/export-excel")
|
@GetMapping("/export-excel")
|
||||||
@Operation(summary = "导出金属元素 Excel")
|
@Operation(summary = "导出金属元素 Excel")
|
||||||
@PreAuthorize("@ss.hasPermission('base:element:export')")
|
@PreAuthorize("@ss.hasPermission('base:element:export')")
|
||||||
|
|||||||
@@ -40,4 +40,8 @@ public class TemplateInstanceDataRespVO {
|
|||||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
@ExcelProperty("创建时间")
|
@ExcelProperty("创建时间")
|
||||||
private LocalDateTime createTime;
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
@Schema(description = "是否必填", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@ExcelProperty("是否必填")
|
||||||
|
private String isMust;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,8 +34,8 @@ public class TmplInscBsnRelDO extends BusinessBaseDO {
|
|||||||
/**
|
/**
|
||||||
* 业务主键
|
* 业务主键
|
||||||
*/
|
*/
|
||||||
@TableField("BSN_ID")
|
@TableField("REL_ID")
|
||||||
private Long bsnId;
|
private Long relativityId;
|
||||||
/**
|
/**
|
||||||
* 实例主键
|
* 实例主键
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ public interface ElementMapper extends BaseMapperX<ElementDO> {
|
|||||||
.likeIfPresent(ElementDO::getAbbreviation, reqVO.getAbbreviation())
|
.likeIfPresent(ElementDO::getAbbreviation, reqVO.getAbbreviation())
|
||||||
.likeIfPresent(ElementDO::getName, reqVO.getName())
|
.likeIfPresent(ElementDO::getName, reqVO.getName())
|
||||||
.eqIfPresent(ElementDO::getDecimalValue, reqVO.getDecimalValue())
|
.eqIfPresent(ElementDO::getDecimalValue, reqVO.getDecimalValue())
|
||||||
|
.eqIfPresent(ElementDO::getIsEnable, reqVO.getIsEnable())
|
||||||
.likeIfPresent(ElementDO::getCoding, reqVO.getCoding())
|
.likeIfPresent(ElementDO::getCoding, reqVO.getCoding())
|
||||||
.eqIfPresent(ElementDO::getGradeUnit, reqVO.getGradeUnit())
|
.eqIfPresent(ElementDO::getGradeUnit, reqVO.getGradeUnit())
|
||||||
.betweenIfPresent(ElementDO::getCreateTime, reqVO.getCreateTime())
|
.betweenIfPresent(ElementDO::getCreateTime, reqVO.getCreateTime())
|
||||||
@@ -36,4 +37,9 @@ public interface ElementMapper extends BaseMapperX<ElementDO> {
|
|||||||
.eq(ElementDO::getIsEnable, 1)
|
.eq(ElementDO::getIsEnable, 1)
|
||||||
.orderByDesc(ElementDO::getSort));
|
.orderByDesc(ElementDO::getSort));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
default ElementDO getElementName(String code){
|
||||||
|
return selectOne(new LambdaQueryWrapperX<ElementDO>()
|
||||||
|
.eq(ElementDO::getAbbreviation, code));
|
||||||
|
};
|
||||||
}
|
}
|
||||||
@@ -21,7 +21,7 @@ public interface TmplInscBsnRelMapper extends BaseMapperX<TmplInscBsnRelDO> {
|
|||||||
|
|
||||||
default PageResult<TmplInscBsnRelDO> selectPage(TmplInscBsnRelPageReqVO reqVO) {
|
default PageResult<TmplInscBsnRelDO> selectPage(TmplInscBsnRelPageReqVO reqVO) {
|
||||||
return selectPage(reqVO, new LambdaQueryWrapperX<TmplInscBsnRelDO>()
|
return selectPage(reqVO, new LambdaQueryWrapperX<TmplInscBsnRelDO>()
|
||||||
.eqIfPresent(TmplInscBsnRelDO::getBsnId, reqVO.getBsnId())
|
.eqIfPresent(TmplInscBsnRelDO::getRelativityId, reqVO.getBsnId())
|
||||||
.eqIfPresent(TmplInscBsnRelDO::getInscId, reqVO.getInscId())
|
.eqIfPresent(TmplInscBsnRelDO::getInscId, reqVO.getInscId())
|
||||||
.eqIfPresent(TmplInscBsnRelDO::getCntt, reqVO.getCntt())
|
.eqIfPresent(TmplInscBsnRelDO::getCntt, reqVO.getCntt())
|
||||||
.eqIfPresent(TmplInscBsnRelDO::getVer, reqVO.getVer())
|
.eqIfPresent(TmplInscBsnRelDO::getVer, reqVO.getVer())
|
||||||
|
|||||||
@@ -65,4 +65,6 @@ public interface ElementService {
|
|||||||
void enableElementList(List<ElementRespVO> saveReqVOS);
|
void enableElementList(List<ElementRespVO> saveReqVOS);
|
||||||
|
|
||||||
List<ElementDO> getElementNoPage();
|
List<ElementDO> getElementNoPage();
|
||||||
|
|
||||||
|
PageResult<ElementDO> getElementPageByEnable(ElementPageReqVO pageReqVO);
|
||||||
}
|
}
|
||||||
@@ -17,6 +17,7 @@ import org.springframework.validation.annotation.Validated;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static com.zt.plat.framework.common.exception.util.ServiceExceptionUtil.exception;
|
import static com.zt.plat.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
|
import static com.zt.plat.module.base.enums.ErrorCodeConstants.ELEMENT_EXISTS;
|
||||||
import static com.zt.plat.module.base.enums.ErrorCodeConstants.ELEMENT_NOT_EXISTS;
|
import static com.zt.plat.module.base.enums.ErrorCodeConstants.ELEMENT_NOT_EXISTS;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -35,6 +36,8 @@ public class ElementServiceImpl implements ElementService {
|
|||||||
public ElementRespVO createElement(ElementSaveReqVO createReqVO) {
|
public ElementRespVO createElement(ElementSaveReqVO createReqVO) {
|
||||||
// 插入
|
// 插入
|
||||||
ElementDO element = BeanUtils.toBean(createReqVO, ElementDO.class);
|
ElementDO element = BeanUtils.toBean(createReqVO, ElementDO.class);
|
||||||
|
// 校验存在
|
||||||
|
validateElementCodeExists(createReqVO.getAbbreviation());
|
||||||
//金属编码自动生成,格式 JSYS-00001,依次新增
|
//金属编码自动生成,格式 JSYS-00001,依次新增
|
||||||
String maxCode = elementMapper.selectMaxCode();
|
String maxCode = elementMapper.selectMaxCode();
|
||||||
if (maxCode == null) {
|
if (maxCode == null) {
|
||||||
@@ -55,6 +58,8 @@ public class ElementServiceImpl implements ElementService {
|
|||||||
public void updateElement(ElementSaveReqVO updateReqVO) {
|
public void updateElement(ElementSaveReqVO updateReqVO) {
|
||||||
// 校验存在
|
// 校验存在
|
||||||
validateElementExists(updateReqVO.getId());
|
validateElementExists(updateReqVO.getId());
|
||||||
|
// 校验存在
|
||||||
|
validateElementCodeExists(updateReqVO.getAbbreviation());
|
||||||
// 更新
|
// 更新
|
||||||
ElementDO updateObj = BeanUtils.toBean(updateReqVO, ElementDO.class);
|
ElementDO updateObj = BeanUtils.toBean(updateReqVO, ElementDO.class);
|
||||||
elementMapper.updateById(updateObj);
|
elementMapper.updateById(updateObj);
|
||||||
@@ -69,12 +74,12 @@ public class ElementServiceImpl implements ElementService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void deleteElementListByIds(List<Long> ids) {
|
public void deleteElementListByIds(List<Long> ids) {
|
||||||
// 校验存在
|
// 校验存在
|
||||||
validateElementExists(ids);
|
validateElementExists(ids);
|
||||||
// 删除
|
// 删除
|
||||||
elementMapper.deleteByIds(ids);
|
elementMapper.deleteByIds(ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void validateElementExists(List<Long> ids) {
|
private void validateElementExists(List<Long> ids) {
|
||||||
List<ElementDO> list = elementMapper.selectByIds(ids);
|
List<ElementDO> list = elementMapper.selectByIds(ids);
|
||||||
@@ -89,6 +94,13 @@ public class ElementServiceImpl implements ElementService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void validateElementCodeExists(String code) {
|
||||||
|
ElementDO elementDO = elementMapper.getElementName(code);
|
||||||
|
if (elementDO != null) {
|
||||||
|
throw exception(ELEMENT_EXISTS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ElementDO getElement(Long id) {
|
public ElementDO getElement(Long id) {
|
||||||
return elementMapper.selectById(id);
|
return elementMapper.selectById(id);
|
||||||
@@ -102,7 +114,7 @@ public class ElementServiceImpl implements ElementService {
|
|||||||
@Override
|
@Override
|
||||||
public void enableElementList(List<ElementRespVO> saveReqVOS) {
|
public void enableElementList(List<ElementRespVO> saveReqVOS) {
|
||||||
List<ElementDO> updateObj = BeanUtils.toBean(saveReqVOS, ElementDO.class);
|
List<ElementDO> updateObj = BeanUtils.toBean(saveReqVOS, ElementDO.class);
|
||||||
List<BatchResult> count = elementMapper.updateById(updateObj);
|
List<BatchResult> count = elementMapper.updateById(updateObj);
|
||||||
if (CollUtil.isEmpty(count)) {
|
if (CollUtil.isEmpty(count)) {
|
||||||
throw exception(ELEMENT_NOT_EXISTS);
|
throw exception(ELEMENT_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
@@ -113,4 +125,12 @@ public class ElementServiceImpl implements ElementService {
|
|||||||
return elementMapper.getElementNoPage();
|
return elementMapper.getElementNoPage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<ElementDO> getElementPageByEnable(ElementPageReqVO pageReqVO) {
|
||||||
|
if (pageReqVO!=null&&pageReqVO.getIsEnable()==null){
|
||||||
|
pageReqVO.setIsEnable("1");
|
||||||
|
}
|
||||||
|
return elementMapper.selectPage(pageReqVO);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -420,6 +420,7 @@ public class TemplateInstanceServiceImpl implements TemplateInstanceService {
|
|||||||
if (templateInstanceDataRespVO.getFldKy().equals(tmplTpFldDO.getFldKy())) {
|
if (templateInstanceDataRespVO.getFldKy().equals(tmplTpFldDO.getFldKy())) {
|
||||||
templateInstanceDataRespVO.setFldName(tmplTpFldDO.getFldName());
|
templateInstanceDataRespVO.setFldName(tmplTpFldDO.getFldName());
|
||||||
templateInstanceDataRespVO.setFldDoc(tmplTpFldDO.getFldDoc());
|
templateInstanceDataRespVO.setFldDoc(tmplTpFldDO.getFldDoc());
|
||||||
|
templateInstanceDataRespVO.setIsMust(tmplTpFldDO.getIsMust());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -67,6 +67,7 @@ public class TmplInscBsnRelServiceImpl implements TmplInscBsnRelService {
|
|||||||
// fileUpload(createReqVO, templateInstance, type);
|
// fileUpload(createReqVO, templateInstance, type);
|
||||||
// 插入
|
// 插入
|
||||||
TmplInscBsnRelDO tmplInscBsnRel = BeanUtils.toBean(createReqVO, TmplInscBsnRelDO.class);
|
TmplInscBsnRelDO tmplInscBsnRel = BeanUtils.toBean(createReqVO, TmplInscBsnRelDO.class);
|
||||||
|
tmplInscBsnRel.setRelativityId(createReqVO.getBsnId());
|
||||||
// tmplInscBsnRel.setBsnId(Long.valueOf(createReqVO.getUuid()));
|
// tmplInscBsnRel.setBsnId(Long.valueOf(createReqVO.getUuid()));
|
||||||
tmplInscBsnRelMapper.insert(tmplInscBsnRel);
|
tmplInscBsnRelMapper.insert(tmplInscBsnRel);
|
||||||
// 返回
|
// 返回
|
||||||
@@ -81,6 +82,9 @@ public class TmplInscBsnRelServiceImpl implements TmplInscBsnRelService {
|
|||||||
validateTmplInscBsnRelExists(updateReqVO.getId());
|
validateTmplInscBsnRelExists(updateReqVO.getId());
|
||||||
// 更新
|
// 更新
|
||||||
TmplInscBsnRelDO updateObj = BeanUtils.toBean(updateReqVO, TmplInscBsnRelDO.class);
|
TmplInscBsnRelDO updateObj = BeanUtils.toBean(updateReqVO, TmplInscBsnRelDO.class);
|
||||||
|
if (updateReqVO.getBsnId()!=null){
|
||||||
|
updateObj.setRelativityId(updateReqVO.getBsnId());
|
||||||
|
}
|
||||||
tmplInscBsnRelMapper.updateById(updateObj);
|
tmplInscBsnRelMapper.updateById(updateObj);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -99,9 +103,9 @@ public class TmplInscBsnRelServiceImpl implements TmplInscBsnRelService {
|
|||||||
// 校验存在
|
// 校验存在
|
||||||
validateTmplInscBsnRelExists(ids);
|
validateTmplInscBsnRelExists(ids);
|
||||||
//删除业务实例字段值
|
//删除业务实例字段值
|
||||||
deleteFldOrItmByIds(tmplInscBsnRelMapper.selectByIds(ids).stream().map(TmplInscBsnRelDO::getBsnId).map(String::valueOf).toList(), tmplInscDatBsnService);
|
deleteFldOrItmByIds(tmplInscBsnRelMapper.selectByIds(ids).stream().map(TmplInscBsnRelDO::getRelativityId).map(String::valueOf).toList(), tmplInscDatBsnService);
|
||||||
//删除业务实例字段值
|
//删除业务实例字段值
|
||||||
deleteFldOrItmByIds(tmplInscBsnRelMapper.selectByIds(ids).stream().map(TmplInscBsnRelDO::getBsnId).map(String::valueOf).toList(), tmplInscItmBsnService);
|
deleteFldOrItmByIds(tmplInscBsnRelMapper.selectByIds(ids).stream().map(TmplInscBsnRelDO::getRelativityId).map(String::valueOf).toList(), tmplInscItmBsnService);
|
||||||
tmplInscBsnRelMapper.deleteByIds(ids);
|
tmplInscBsnRelMapper.deleteByIds(ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -155,7 +159,7 @@ public class TmplInscBsnRelServiceImpl implements TmplInscBsnRelService {
|
|||||||
@Override
|
@Override
|
||||||
public void updateCntt(Long bsnId, String params) {
|
public void updateCntt(Long bsnId, String params) {
|
||||||
List<TmplInscBsnRelDO> tmplInscBsnRelDOS = tmplInscBsnRelMapper.selectList(new LambdaQueryWrapper<TmplInscBsnRelDO>()
|
List<TmplInscBsnRelDO> tmplInscBsnRelDOS = tmplInscBsnRelMapper.selectList(new LambdaQueryWrapper<TmplInscBsnRelDO>()
|
||||||
.eq(TmplInscBsnRelDO::getBsnId, bsnId).orderByDesc(TmplInscBsnRelDO::getVer)
|
.eq(TmplInscBsnRelDO::getRelativityId, bsnId).orderByDesc(TmplInscBsnRelDO::getVer)
|
||||||
);
|
);
|
||||||
if (tmplInscBsnRelDOS.isEmpty()) {
|
if (tmplInscBsnRelDOS.isEmpty()) {
|
||||||
throw exception(TEMPLATE_INSTANCE_FILE_NOT_EXISTS);
|
throw exception(TEMPLATE_INSTANCE_FILE_NOT_EXISTS);
|
||||||
@@ -170,7 +174,7 @@ public class TmplInscBsnRelServiceImpl implements TmplInscBsnRelService {
|
|||||||
//业务条款
|
//业务条款
|
||||||
private List<TmplInscItmBsnRespVO> setTmplInscItmBsnRespVOS(TmplInscBsnRelRespVO tmplInscBsnRelRespVO) {
|
private List<TmplInscItmBsnRespVO> setTmplInscItmBsnRespVOS(TmplInscBsnRelRespVO tmplInscBsnRelRespVO) {
|
||||||
List<TmplInscItmBsnRespVO> tmplInscItmBsnRespVOS = BeanUtils.toBean(SpringUtil.getBean(TmplInscItmBsnMapper.class).selectList(new LambdaQueryWrapper<TmplInscItmBsnDO>()
|
List<TmplInscItmBsnRespVO> tmplInscItmBsnRespVOS = BeanUtils.toBean(SpringUtil.getBean(TmplInscItmBsnMapper.class).selectList(new LambdaQueryWrapper<TmplInscItmBsnDO>()
|
||||||
.eq(TmplInscItmBsnDO::getBsnId, tmplInscBsnRelRespVO.getBsnId())
|
.eq(TmplInscItmBsnDO::getBsnId, tmplInscBsnRelRespVO.getId())
|
||||||
), TmplInscItmBsnRespVO.class);
|
), TmplInscItmBsnRespVO.class);
|
||||||
// tmplInscItmBsnRespVOS.forEach(tmplInscItmBsnRespVO -> {
|
// tmplInscItmBsnRespVOS.forEach(tmplInscItmBsnRespVO -> {
|
||||||
// tmplInscBsnRelRespVO.getInstanceItemRespVOS().forEach(instanceItemRespVO -> {
|
// tmplInscBsnRelRespVO.getInstanceItemRespVOS().forEach(instanceItemRespVO -> {
|
||||||
@@ -184,7 +188,7 @@ public class TmplInscBsnRelServiceImpl implements TmplInscBsnRelService {
|
|||||||
|
|
||||||
//业务字段
|
//业务字段
|
||||||
private List<TmplInscDatBsnRespVO> setTmplInscDatBsnRespVOS(TmplInscBsnRelRespVO tmplInscBsnRelRespVO) {
|
private List<TmplInscDatBsnRespVO> setTmplInscDatBsnRespVOS(TmplInscBsnRelRespVO tmplInscBsnRelRespVO) {
|
||||||
List<TmplInscDatBsnRespVO> tmplInscDatBsnRespVOS = BeanUtils.toBean(SpringUtil.getBean(TmplInscDatBsnMapper.class).selectList(new LambdaQueryWrapper<TmplInscDatBsnDO>()), TmplInscDatBsnRespVO.class);
|
List<TmplInscDatBsnRespVO> tmplInscDatBsnRespVOS = BeanUtils.toBean(SpringUtil.getBean(TmplInscDatBsnMapper.class).selectList(new LambdaQueryWrapper<TmplInscDatBsnDO>().eq(TmplInscDatBsnDO::getBsnId, tmplInscBsnRelRespVO.getId())), TmplInscDatBsnRespVO.class);
|
||||||
|
|
||||||
// tmplInscDatBsnRespVOS.forEach(tmplInscDatBsnRespVO -> tmplInscBsnRelRespVO.getTemplateInstanceDataRespVOS().forEach(templateInstanceDataRespVO -> {
|
// tmplInscDatBsnRespVOS.forEach(tmplInscDatBsnRespVO -> tmplInscBsnRelRespVO.getTemplateInstanceDataRespVOS().forEach(templateInstanceDataRespVO -> {
|
||||||
// if (templateInstanceDataRespVO.getId().toString().equals(tmplInscDatBsnRespVO.getInscFldId())) {
|
// if (templateInstanceDataRespVO.getId().toString().equals(tmplInscDatBsnRespVO.getInscFldId())) {
|
||||||
@@ -300,7 +304,7 @@ public class TmplInscBsnRelServiceImpl implements TmplInscBsnRelService {
|
|||||||
public Map<String, Object> valueInfo(String cttId, String inscId) {
|
public Map<String, Object> valueInfo(String cttId, String inscId) {
|
||||||
// 1、通过实例和合同Id获取业务
|
// 1、通过实例和合同Id获取业务
|
||||||
TmplInscBsnRelDO tmplInscBsnRelDO = tmplInscBsnRelMapper.selectOne(
|
TmplInscBsnRelDO tmplInscBsnRelDO = tmplInscBsnRelMapper.selectOne(
|
||||||
TmplInscBsnRelDO::getBsnId, cttId,
|
TmplInscBsnRelDO::getRelativityId, cttId,
|
||||||
TmplInscBsnRelDO::getInscId, inscId
|
TmplInscBsnRelDO::getInscId, inscId
|
||||||
);
|
);
|
||||||
if (tmplInscBsnRelDO == null) {
|
if (tmplInscBsnRelDO == null) {
|
||||||
@@ -310,7 +314,7 @@ public class TmplInscBsnRelServiceImpl implements TmplInscBsnRelService {
|
|||||||
List<ValueInfo> valueInfoS = new ArrayList<>();
|
List<ValueInfo> valueInfoS = new ArrayList<>();
|
||||||
// 2、获取绑定的字段
|
// 2、获取绑定的字段
|
||||||
List<TmplInscDatBsnRespVO> tmplInscDatBsnList = tmplInscDatBsnService
|
List<TmplInscDatBsnRespVO> tmplInscDatBsnList = tmplInscDatBsnService
|
||||||
.getTmplInscDatBsnListByBsnId(String.valueOf(tmplInscBsnRelDO.getBsnId()));
|
.getTmplInscDatBsnListByBsnId(String.valueOf(tmplInscBsnRelDO.getRelativityId()));
|
||||||
|
|
||||||
|
|
||||||
Optional.ofNullable(tmplInscDatBsnList)
|
Optional.ofNullable(tmplInscDatBsnList)
|
||||||
@@ -326,7 +330,7 @@ public class TmplInscBsnRelServiceImpl implements TmplInscBsnRelService {
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
// 3、获取条款
|
// 3、获取条款
|
||||||
List<TmplInscItmBsnRespVO> tmplInscItmBsnList = tmplInscItmBsnService.getTmplInscItmBsnList(String.valueOf(tmplInscBsnRelDO.getBsnId()));
|
List<TmplInscItmBsnRespVO> tmplInscItmBsnList = tmplInscItmBsnService.getTmplInscItmBsnList(String.valueOf(tmplInscBsnRelDO.getRelativityId()));
|
||||||
Optional.ofNullable(tmplInscItmBsnList)
|
Optional.ofNullable(tmplInscItmBsnList)
|
||||||
.ifPresent(list -> list.forEach(tmplInscItmBsnRespVO -> {
|
.ifPresent(list -> list.forEach(tmplInscItmBsnRespVO -> {
|
||||||
ValueInfo valueInfo = new ValueInfo(
|
ValueInfo valueInfo = new ValueInfo(
|
||||||
@@ -345,7 +349,7 @@ public class TmplInscBsnRelServiceImpl implements TmplInscBsnRelService {
|
|||||||
@Override
|
@Override
|
||||||
public TmplInscBsnRelRespVO bseInfo(String cttId, String inscId) {
|
public TmplInscBsnRelRespVO bseInfo(String cttId, String inscId) {
|
||||||
TmplInscBsnRelDO tmplInscBsnRelDO = tmplInscBsnRelMapper.selectOne(
|
TmplInscBsnRelDO tmplInscBsnRelDO = tmplInscBsnRelMapper.selectOne(
|
||||||
TmplInscBsnRelDO::getBsnId, cttId,
|
TmplInscBsnRelDO::getRelativityId, cttId,
|
||||||
TmplInscBsnRelDO::getInscId, inscId
|
TmplInscBsnRelDO::getInscId, inscId
|
||||||
);
|
);
|
||||||
return BeanUtils.toBean(tmplInscBsnRelDO, TmplInscBsnRelRespVO.class);
|
return BeanUtils.toBean(tmplInscBsnRelDO, TmplInscBsnRelRespVO.class);
|
||||||
@@ -362,7 +366,7 @@ public class TmplInscBsnRelServiceImpl implements TmplInscBsnRelService {
|
|||||||
List<ValueInfo> valueInfoS = new ArrayList<>();
|
List<ValueInfo> valueInfoS = new ArrayList<>();
|
||||||
// 2、获取绑定的字段
|
// 2、获取绑定的字段
|
||||||
List<TmplInscDatBsnRespVO> tmplInscDatBsnList = tmplInscDatBsnService
|
List<TmplInscDatBsnRespVO> tmplInscDatBsnList = tmplInscDatBsnService
|
||||||
.getTmplInscDatBsnListByBsnId(String.valueOf(tmplInscBsnRelDO.getBsnId()));
|
.getTmplInscDatBsnListByBsnId(String.valueOf(tmplInscBsnRelDO.getRelativityId()));
|
||||||
|
|
||||||
|
|
||||||
Optional.ofNullable(tmplInscDatBsnList)
|
Optional.ofNullable(tmplInscDatBsnList)
|
||||||
@@ -378,7 +382,7 @@ public class TmplInscBsnRelServiceImpl implements TmplInscBsnRelService {
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
// 3、获取条款
|
// 3、获取条款
|
||||||
List<TmplInscItmBsnRespVO> tmplInscItmBsnList = tmplInscItmBsnService.getTmplInscItmBsnList(String.valueOf(tmplInscBsnRelDO.getBsnId()));
|
List<TmplInscItmBsnRespVO> tmplInscItmBsnList = tmplInscItmBsnService.getTmplInscItmBsnList(String.valueOf(tmplInscBsnRelDO.getRelativityId()));
|
||||||
Optional.ofNullable(tmplInscItmBsnList)
|
Optional.ofNullable(tmplInscItmBsnList)
|
||||||
.ifPresent(list -> list.forEach(tmplInscItmBsnRespVO -> {
|
.ifPresent(list -> list.forEach(tmplInscItmBsnRespVO -> {
|
||||||
ValueInfo valueInfo = new ValueInfo(
|
ValueInfo valueInfo = new ValueInfo(
|
||||||
|
|||||||
@@ -242,6 +242,30 @@ public class ContractRespDTO {
|
|||||||
@Schema(description = "模板中间表ID")
|
@Schema(description = "模板中间表ID")
|
||||||
private Long businessId;
|
private Long businessId;
|
||||||
|
|
||||||
|
@Schema(description = "甲方户名")
|
||||||
|
private String purchaseAccountName;
|
||||||
|
|
||||||
|
@Schema(description = "甲方开户行")
|
||||||
|
private String purchaseBankAccount;
|
||||||
|
|
||||||
|
@Schema(description = "甲方户号")
|
||||||
|
private String purchaseAccountNumber;
|
||||||
|
|
||||||
|
@Schema(description = "甲方税号/社会信用代码")
|
||||||
|
private String purchaseTaxNumber;
|
||||||
|
|
||||||
|
@Schema(description = "乙方户名")
|
||||||
|
private String salesAccountName;
|
||||||
|
|
||||||
|
@Schema(description = "乙方开户行")
|
||||||
|
private String salesBankAccount;
|
||||||
|
|
||||||
|
@Schema(description = "乙方户号")
|
||||||
|
private String salesAccountNumber;
|
||||||
|
|
||||||
|
@Schema(description = "乙方税号/社会信用代码")
|
||||||
|
private String salesTaxNumber;
|
||||||
|
|
||||||
// 物料信息
|
// 物料信息
|
||||||
private List<DetailRespDTO> detail;
|
private List<DetailRespDTO> detail;
|
||||||
|
|
||||||
|
|||||||
@@ -248,6 +248,30 @@ public class ContractRespVO {
|
|||||||
@Schema(description = "模板中间表ID")
|
@Schema(description = "模板中间表ID")
|
||||||
private Long businessId;
|
private Long businessId;
|
||||||
|
|
||||||
|
@Schema(description = "甲方户名")
|
||||||
|
private String purchaseAccountName;
|
||||||
|
|
||||||
|
@Schema(description = "甲方开户行")
|
||||||
|
private String purchaseBankAccount;
|
||||||
|
|
||||||
|
@Schema(description = "甲方户号")
|
||||||
|
private String purchaseAccountNumber;
|
||||||
|
|
||||||
|
@Schema(description = "甲方税号/社会信用代码")
|
||||||
|
private String purchaseTaxNumber;
|
||||||
|
|
||||||
|
@Schema(description = "乙方户名")
|
||||||
|
private String salesAccountName;
|
||||||
|
|
||||||
|
@Schema(description = "乙方开户行")
|
||||||
|
private String salesBankAccount;
|
||||||
|
|
||||||
|
@Schema(description = "乙方户号")
|
||||||
|
private String salesAccountNumber;
|
||||||
|
|
||||||
|
@Schema(description = "乙方税号/社会信用代码")
|
||||||
|
private String salesTaxNumber;
|
||||||
|
|
||||||
// 物料信息
|
// 物料信息
|
||||||
private List<DetailRespVO> detail;
|
private List<DetailRespVO> detail;
|
||||||
|
|
||||||
|
|||||||
@@ -218,6 +218,30 @@ public class ContractSaveReqVO {
|
|||||||
@Schema(description = "模板中间表ID")
|
@Schema(description = "模板中间表ID")
|
||||||
private Long businessId;
|
private Long businessId;
|
||||||
|
|
||||||
|
@Schema(description = "甲方户名")
|
||||||
|
private String purchaseAccountName;
|
||||||
|
|
||||||
|
@Schema(description = "甲方开户行")
|
||||||
|
private String purchaseBankAccount;
|
||||||
|
|
||||||
|
@Schema(description = "甲方户号")
|
||||||
|
private String purchaseAccountNumber;
|
||||||
|
|
||||||
|
@Schema(description = "甲方税号/社会信用代码")
|
||||||
|
private String purchaseTaxNumber;
|
||||||
|
|
||||||
|
@Schema(description = "乙方户名")
|
||||||
|
private String salesAccountName;
|
||||||
|
|
||||||
|
@Schema(description = "乙方开户行")
|
||||||
|
private String salesBankAccount;
|
||||||
|
|
||||||
|
@Schema(description = "乙方户号")
|
||||||
|
private String salesAccountNumber;
|
||||||
|
|
||||||
|
@Schema(description = "乙方税号/社会信用代码")
|
||||||
|
private String salesTaxNumber;
|
||||||
|
|
||||||
// 物料信息
|
// 物料信息
|
||||||
private List<DetailSaveReqVO> detail;
|
private List<DetailSaveReqVO> detail;
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,45 @@
|
|||||||
|
package com.zt.plat.module.contractorder.api.vo.contract;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 合同交易信息 Response VO")
|
||||||
|
@Data
|
||||||
|
public class TransactionInfoRespVO {
|
||||||
|
|
||||||
|
@Schema(description = "公司编号")
|
||||||
|
private String companyNumber;
|
||||||
|
|
||||||
|
@Schema(description = "公司名称")
|
||||||
|
private String companyName;
|
||||||
|
|
||||||
|
@Schema(description = "公司户名")
|
||||||
|
private String companyAccountName;
|
||||||
|
|
||||||
|
@Schema(description = "公司开户行")
|
||||||
|
private String companyBankAccount;
|
||||||
|
|
||||||
|
@Schema(description = "公司户号")
|
||||||
|
private String companyAccountNumber;
|
||||||
|
|
||||||
|
@Schema(description = "公司税号/社会信用代码")
|
||||||
|
private String companyTaxNumber;
|
||||||
|
|
||||||
|
@Schema(description = "客商编号")
|
||||||
|
private String supplierNumber;
|
||||||
|
|
||||||
|
@Schema(description = "客商名称")
|
||||||
|
private String supplierName;
|
||||||
|
|
||||||
|
@Schema(description = "客商户名")
|
||||||
|
private String supplierAccountName;
|
||||||
|
|
||||||
|
@Schema(description = "客商开户行")
|
||||||
|
private String supplierBankAccount;
|
||||||
|
|
||||||
|
@Schema(description = "客商户号")
|
||||||
|
private String supplierAccountNumber;
|
||||||
|
|
||||||
|
@Schema(description = "客商税号/社会信用代码")
|
||||||
|
private String supplierTaxNumber;
|
||||||
|
}
|
||||||
@@ -26,9 +26,7 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static com.zt.plat.framework.common.pojo.CommonResult.error;
|
|
||||||
import static com.zt.plat.framework.common.pojo.CommonResult.success;
|
import static com.zt.plat.framework.common.pojo.CommonResult.success;
|
||||||
import static com.zt.plat.module.contractorder.enums.ErrorCodeConstants.CONTRACT_SUBMIT_ERP_FAIL;
|
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Tag(name = "管理后台 - 合同管理")
|
@Tag(name = "管理后台 - 合同管理")
|
||||||
@@ -155,8 +153,10 @@ public class ContractController implements BusinessControllerMarker {
|
|||||||
@Operation(summary = "提交ERP")
|
@Operation(summary = "提交ERP")
|
||||||
@PreAuthorize("@ss.hasPermission('base:contract:erp')")
|
@PreAuthorize("@ss.hasPermission('base:contract:erp')")
|
||||||
public CommonResult<JSONObject> submitErp(@RequestParam("id") Long id) {
|
public CommonResult<JSONObject> submitErp(@RequestParam("id") Long id) {
|
||||||
JSONObject res = contractService.submitErp(id);
|
// JSONObject res = contractService.submitErp(id);
|
||||||
return res.getBool("success") ? success(res) : error(CONTRACT_SUBMIT_ERP_FAIL.getCode(), res.getStr("data"));
|
// return res.getBool("success") ? success(res) : error(CONTRACT_SUBMIT_ERP_FAIL.getCode(), res.getStr("data"));
|
||||||
|
// TODO ERP默认返回成功处理 SZHGYL-251
|
||||||
|
return success(new JSONObject().putOnce("success", true));
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/list/up-not-relation")
|
@GetMapping("/list/up-not-relation")
|
||||||
@@ -213,5 +213,14 @@ public class ContractController implements BusinessControllerMarker {
|
|||||||
@PreAuthorize("@ss.hasPermission('base:contract:query')")
|
@PreAuthorize("@ss.hasPermission('base:contract:query')")
|
||||||
public CommonResult<List<PurchaseOrderWithDetailsDTO>> getOrderByOrderNo(@RequestBody List<String> orderNoS){
|
public CommonResult<List<PurchaseOrderWithDetailsDTO>> getOrderByOrderNo(@RequestBody List<String> orderNoS){
|
||||||
return contractApi.getOrderByOrderNo(orderNoS);
|
return contractApi.getOrderByOrderNo(orderNoS);
|
||||||
};
|
}
|
||||||
|
|
||||||
|
@GetMapping("/transaction-info/by-paper-number")
|
||||||
|
@Operation(summary = "根据合同编号获得交易信息")
|
||||||
|
@PreAuthorize("@ss.hasPermission('base:contract:get')")
|
||||||
|
public CommonResult<TransactionInfoRespVO> transactionInfoByPaperNumber(
|
||||||
|
@RequestParam("contractPaperNumber") String contractPaperNumber
|
||||||
|
) {
|
||||||
|
return success(contractService.transactionInfoByPaperNumber(contractPaperNumber));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -195,4 +195,9 @@ public class PurchaseOrderDetailsRespVO {
|
|||||||
* 订单类型
|
* 订单类型
|
||||||
*/
|
*/
|
||||||
private String splyBsnTp;
|
private String splyBsnTp;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 单位
|
||||||
|
*/
|
||||||
|
private String unt;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -410,4 +410,44 @@ public class ContractMainDO extends BusinessBaseDO {
|
|||||||
*/
|
*/
|
||||||
@TableField("BSN_ID")
|
@TableField("BSN_ID")
|
||||||
private Long businessId;
|
private Long businessId;
|
||||||
|
/**
|
||||||
|
* 甲方户名
|
||||||
|
*/
|
||||||
|
@TableField("PRCH_ACCT_NAME")
|
||||||
|
private String purchaseAccountName;
|
||||||
|
/**
|
||||||
|
* 甲方开户行
|
||||||
|
*/
|
||||||
|
@TableField("PRCH_BNK_ACCT")
|
||||||
|
private String purchaseBankAccount;
|
||||||
|
/**
|
||||||
|
* 甲方户号
|
||||||
|
*/
|
||||||
|
@TableField("PRCH_ACCT_NUM")
|
||||||
|
private String purchaseAccountNumber;
|
||||||
|
/**
|
||||||
|
* 甲方税号/社会信用代码
|
||||||
|
*/
|
||||||
|
@TableField("PRCH_TAX_NUM")
|
||||||
|
private String purchaseTaxNumber;
|
||||||
|
/**
|
||||||
|
* 乙方户名
|
||||||
|
*/
|
||||||
|
@TableField("SALE_ACCT_NAME")
|
||||||
|
private String salesAccountName;
|
||||||
|
/**
|
||||||
|
* 乙方开户行
|
||||||
|
*/
|
||||||
|
@TableField("SALE_BNK_ACCT")
|
||||||
|
private String salesBankAccount;
|
||||||
|
/**
|
||||||
|
* 乙方户号
|
||||||
|
*/
|
||||||
|
@TableField("SALE_ACCT_NUM")
|
||||||
|
private String salesAccountNumber;
|
||||||
|
/**
|
||||||
|
* 乙方税号/社会信用代码
|
||||||
|
*/
|
||||||
|
@TableField("SALE_TAX_NUM")
|
||||||
|
private String salesTaxNumber;
|
||||||
}
|
}
|
||||||
@@ -231,4 +231,12 @@ public interface ContractService {
|
|||||||
* @return 系统合同编号
|
* @return 系统合同编号
|
||||||
*/
|
*/
|
||||||
String generateSystemContractNumber(String category);
|
String generateSystemContractNumber(String category);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据合同编号获得交易信息
|
||||||
|
*
|
||||||
|
* @param contractPaperNumber 合同编号
|
||||||
|
* @return 交易信息
|
||||||
|
*/
|
||||||
|
TransactionInfoRespVO transactionInfoByPaperNumber(String contractPaperNumber);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,10 +17,7 @@ import com.zt.plat.module.base.controller.admin.templtp.vo.TmplInscBsnRelSaveReq
|
|||||||
import com.zt.plat.module.base.controller.admin.templtp.vo.TmplInscDatBsnSaveReqVO;
|
import com.zt.plat.module.base.controller.admin.templtp.vo.TmplInscDatBsnSaveReqVO;
|
||||||
import com.zt.plat.module.base.controller.admin.templtp.vo.TmplInscItmBsnSaveReqVO;
|
import com.zt.plat.module.base.controller.admin.templtp.vo.TmplInscItmBsnSaveReqVO;
|
||||||
import com.zt.plat.module.base.dal.dataobject.tmpltp.TmplInscBsnRelDO;
|
import com.zt.plat.module.base.dal.dataobject.tmpltp.TmplInscBsnRelDO;
|
||||||
import com.zt.plat.module.base.dal.mysql.tmpltp.TemplateInstanceDataMapper;
|
|
||||||
import com.zt.plat.module.base.dal.mysql.tmpltp.TemplateInstanceItemMapper;
|
|
||||||
import com.zt.plat.module.base.dal.mysql.tmpltp.TmplInscBsnRelMapper;
|
import com.zt.plat.module.base.dal.mysql.tmpltp.TmplInscBsnRelMapper;
|
||||||
import com.zt.plat.module.base.service.tmpltp.TemplateInstanceDataService;
|
|
||||||
import com.zt.plat.module.base.service.tmpltp.TmplInscBsnRelService;
|
import com.zt.plat.module.base.service.tmpltp.TmplInscBsnRelService;
|
||||||
import com.zt.plat.module.base.service.tmpltp.TmplInscDatBsnService;
|
import com.zt.plat.module.base.service.tmpltp.TmplInscDatBsnService;
|
||||||
import com.zt.plat.module.base.service.tmpltp.TmplInscItmBsnService;
|
import com.zt.plat.module.base.service.tmpltp.TmplInscItmBsnService;
|
||||||
@@ -40,7 +37,6 @@ import com.zt.plat.module.contractorder.enums.contract.DictEnum;
|
|||||||
import com.zt.plat.module.erp.controller.admin.erp.vo.ErpContractPageReqVO;
|
import com.zt.plat.module.erp.controller.admin.erp.vo.ErpContractPageReqVO;
|
||||||
import com.zt.plat.module.erp.controller.admin.erp.vo.ErpContractSaveReqVO;
|
import com.zt.plat.module.erp.controller.admin.erp.vo.ErpContractSaveReqVO;
|
||||||
import com.zt.plat.module.erp.dal.dataobject.erp.ErpContractDO;
|
import com.zt.plat.module.erp.dal.dataobject.erp.ErpContractDO;
|
||||||
import com.zt.plat.module.erp.service.erp.ErpCompanyService;
|
|
||||||
import com.zt.plat.module.erp.service.erp.ErpContractService;
|
import com.zt.plat.module.erp.service.erp.ErpContractService;
|
||||||
import com.zt.plat.module.infra.api.file.FileApi;
|
import com.zt.plat.module.infra.api.file.FileApi;
|
||||||
import com.zt.plat.module.infra.api.file.dto.FileRespDTO;
|
import com.zt.plat.module.infra.api.file.dto.FileRespDTO;
|
||||||
@@ -88,12 +84,6 @@ public class ContractServiceImpl implements ContractService {
|
|||||||
@Resource
|
@Resource
|
||||||
private ContractPlanMapper contractPlanMapper;
|
private ContractPlanMapper contractPlanMapper;
|
||||||
@Resource
|
@Resource
|
||||||
private TemplateInstanceDataService templateInstanceDataService;
|
|
||||||
@Resource
|
|
||||||
private TemplateInstanceDataMapper templateInstanceDataMapper;
|
|
||||||
@Resource
|
|
||||||
private TemplateInstanceItemMapper templateInstanceItemMapper;
|
|
||||||
@Resource
|
|
||||||
private ContractFormulaMapper contractFormulaMapper;
|
private ContractFormulaMapper contractFormulaMapper;
|
||||||
@Resource
|
@Resource
|
||||||
private ContractCoefficientMapper contractCoefficientMapper;
|
private ContractCoefficientMapper contractCoefficientMapper;
|
||||||
@@ -114,8 +104,6 @@ public class ContractServiceImpl implements ContractService {
|
|||||||
@Resource
|
@Resource
|
||||||
private ContractDemoteMapper contractDemoteMapper;
|
private ContractDemoteMapper contractDemoteMapper;
|
||||||
@Resource
|
@Resource
|
||||||
private ErpCompanyService erpCompanyService;
|
|
||||||
@Resource
|
|
||||||
private ErpContractService erpContractService;
|
private ErpContractService erpContractService;
|
||||||
@Resource
|
@Resource
|
||||||
private SystemRelativityMapper systemRelativityMapper;
|
private SystemRelativityMapper systemRelativityMapper;
|
||||||
@@ -1255,8 +1243,26 @@ public class ContractServiceImpl implements ContractService {
|
|||||||
queryReqVO.getElementName()
|
queryReqVO.getElementName()
|
||||||
);
|
);
|
||||||
|
|
||||||
// 分页返回
|
// 分页返回结果
|
||||||
return new PageResult<FormulaRespVO>().setTotal(ipage.getTotal()).setList(ipage.getRecords());
|
PageResult<FormulaRespVO> results = new PageResult<FormulaRespVO>().setTotal(ipage.getTotal()).setList(ipage.getRecords());
|
||||||
|
if (results.getTotal() > 0) {
|
||||||
|
results.getList().forEach(respVO -> {
|
||||||
|
// 基础系数配置
|
||||||
|
List<ContractCoefficientDO> coefficientDOS = contractCoefficientMapper.selectList("FMU_ID", respVO.getId());
|
||||||
|
respVO.setCoefficients(BeanUtils.toBean(coefficientDOS, CoefficientRespVO.class));
|
||||||
|
// 品位等级价配置
|
||||||
|
List<ContractGradeDO> gradeDOS = contractGradeMapper.selectList("FMU_ID", respVO.getId());
|
||||||
|
respVO.setGrades(BeanUtils.toBean(gradeDOS, GradeRespVO.class));
|
||||||
|
// 调整价配置
|
||||||
|
List<ContractDeductDO> deductDOS = contractDeductMapper.selectList("FMU_ID", respVO.getId());
|
||||||
|
respVO.setDeducts(BeanUtils.toBean(deductDOS, DeductRespVO.class));
|
||||||
|
// 市场价配置
|
||||||
|
List<ContractPriceDO> priceDOS = contractPriceMapper.selectList("FMU_ID", respVO.getId());
|
||||||
|
respVO.setPrices(BeanUtils.toBean(priceDOS, PriceRespVO.class));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -1803,6 +1809,53 @@ public class ContractServiceImpl implements ContractService {
|
|||||||
return erpContractVO;
|
return erpContractVO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TransactionInfoRespVO transactionInfoByPaperNumber(String contractPaperNumber) {
|
||||||
|
|
||||||
|
// 通过合同编号查询合同信息
|
||||||
|
ContractMainDO contractMainDO = contractMainMapper
|
||||||
|
.selectOne(TableFieldConstants.BSE_CTRT_MAIN_CTRT_PPR_NUM, contractPaperNumber);
|
||||||
|
|
||||||
|
// 合同不存在
|
||||||
|
if (contractMainDO == null) {
|
||||||
|
throw exception(CONTRACT_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 交易信息
|
||||||
|
TransactionInfoRespVO infoRespVO = new TransactionInfoRespVO();
|
||||||
|
|
||||||
|
if (DictEnum.ERP_RCV_DLVY_INCOME.getCode().equals(contractMainDO.getDirection())) { // 收入
|
||||||
|
// 收支性质为收入,公司信息为乙方信息,客商信息为甲方信息
|
||||||
|
infoRespVO.setCompanyNumber(contractMainDO.getSalesCompanyNumber());
|
||||||
|
infoRespVO.setCompanyName(contractMainDO.getSalesCompanyName());
|
||||||
|
infoRespVO.setCompanyAccountName(contractMainDO.getSalesAccountName());
|
||||||
|
infoRespVO.setCompanyBankAccount(contractMainDO.getSalesBankAccount());
|
||||||
|
infoRespVO.setCompanyAccountNumber(contractMainDO.getSalesAccountNumber());
|
||||||
|
infoRespVO.setCompanyTaxNumber(contractMainDO.getSalesTaxNumber());
|
||||||
|
infoRespVO.setSupplierName(contractMainDO.getPurchaseCompanyNumber());
|
||||||
|
infoRespVO.setSupplierName(contractMainDO.getPurchaseCompanyName());
|
||||||
|
infoRespVO.setSupplierAccountName(contractMainDO.getPurchaseAccountName());
|
||||||
|
infoRespVO.setSupplierBankAccount(contractMainDO.getPurchaseBankAccount());
|
||||||
|
infoRespVO.setSupplierAccountNumber(contractMainDO.getPurchaseAccountNumber());
|
||||||
|
infoRespVO.setSupplierTaxNumber(contractMainDO.getPurchaseTaxNumber());
|
||||||
|
} else { // 支出
|
||||||
|
// 收支性质为支出,公司信息为甲方信息,客商信息为乙方信息
|
||||||
|
infoRespVO.setCompanyNumber(contractMainDO.getPurchaseCompanyNumber());
|
||||||
|
infoRespVO.setCompanyName(contractMainDO.getPurchaseCompanyName());
|
||||||
|
infoRespVO.setCompanyAccountName(contractMainDO.getPurchaseAccountName());
|
||||||
|
infoRespVO.setCompanyBankAccount(contractMainDO.getPurchaseBankAccount());
|
||||||
|
infoRespVO.setCompanyAccountNumber(contractMainDO.getPurchaseAccountNumber());
|
||||||
|
infoRespVO.setCompanyTaxNumber(contractMainDO.getPurchaseTaxNumber());
|
||||||
|
infoRespVO.setSupplierName(contractMainDO.getSalesCompanyNumber());
|
||||||
|
infoRespVO.setSupplierName(contractMainDO.getSalesCompanyName());
|
||||||
|
infoRespVO.setSupplierAccountName(contractMainDO.getSalesAccountName());
|
||||||
|
infoRespVO.setSupplierBankAccount(contractMainDO.getSalesBankAccount());
|
||||||
|
infoRespVO.setSupplierAccountNumber(contractMainDO.getSalesAccountNumber());
|
||||||
|
infoRespVO.setSupplierTaxNumber(contractMainDO.getSalesTaxNumber());
|
||||||
|
}
|
||||||
|
return infoRespVO;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 校验合同内容
|
* 校验合同内容
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
package com.zt.plat.module.erp.api;
|
package com.zt.plat.module.erp.api;
|
||||||
|
|
||||||
import com.zt.plat.framework.common.pojo.CommonResult;
|
import com.zt.plat.framework.common.pojo.CommonResult;
|
||||||
import com.zt.plat.module.erp.api.dto.ErpInvoiceticketSubmitReqDTO;
|
import com.zt.plat.module.erp.api.dto.*;
|
||||||
import com.zt.plat.module.erp.api.dto.ErpInvoiceticketSubmitRespDTO;
|
|
||||||
import com.zt.plat.module.erp.api.dto.ErpSubmitReqDTO;
|
|
||||||
import com.zt.plat.module.erp.enums.ApiConstants;
|
import com.zt.plat.module.erp.enums.ApiConstants;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
@@ -13,6 +11,7 @@ import org.springframework.web.bind.annotation.PostMapping;
|
|||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
@FeignClient(name = ApiConstants.NAME)
|
@FeignClient(name = ApiConstants.NAME)
|
||||||
@Tag(name = "RPC 服务 - ERP")
|
@Tag(name = "RPC 服务 - ERP")
|
||||||
@@ -23,4 +22,13 @@ public interface InvoiceticketApi {
|
|||||||
@PostMapping(PREFIX + "/submit")
|
@PostMapping(PREFIX + "/submit")
|
||||||
@Operation(summary = "erp数据提交")
|
@Operation(summary = "erp数据提交")
|
||||||
CommonResult<ErpInvoiceticketSubmitRespDTO> submitDataToErp(@Valid @RequestBody ErpInvoiceticketSubmitReqDTO reqDTO);
|
CommonResult<ErpInvoiceticketSubmitRespDTO> submitDataToErp(@Valid @RequestBody ErpInvoiceticketSubmitReqDTO reqDTO);
|
||||||
|
@PostMapping(PREFIX + "/submit098")
|
||||||
|
@Operation(summary = "erp数据提交,参数需要billdoc和action,id")
|
||||||
|
CommonResult<HashMap<String, String>> submitDataToErp098(@Valid @RequestBody Map<String,Object> reqDTO);
|
||||||
|
@PostMapping(PREFIX + "/submit096")
|
||||||
|
@Operation(summary = "erp数据提交,参数需要billdoc和action,id")
|
||||||
|
CommonResult<HashMap<String, String>> submitDataToErp096(@Valid @RequestBody ErpElectronicInvoiceSubmitReqDTO reqDTO);
|
||||||
|
@PostMapping(PREFIX + "/submit097")
|
||||||
|
@Operation(summary = "erp数据提交")
|
||||||
|
CommonResult<HashMap<String, String>> submitDataToErp097(@Valid @RequestBody ErpElectronicInvoiceReversalReqDTO reqDTO);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,42 @@
|
|||||||
|
package com.zt.plat.module.erp.api.dto;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Schema(description = "管理后台 - 电子发票冲销请求DTO")
|
||||||
|
public class ErpElectronicInvoiceReversalReqDTO {
|
||||||
|
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
@Schema(description = "要冲销的发票号;长度10位字符", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
private String billdoc;
|
||||||
|
|
||||||
|
@Schema(description = "冲销过账日期;格式为YYYYMMDD(如20251106)", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
private String postingdate;
|
||||||
|
|
||||||
|
@Schema(description = "冲销原因描述;长度200位字符", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
private String reason;
|
||||||
|
|
||||||
|
@Schema(description = "不开具电子发票;X-不开票;长度1位字符")
|
||||||
|
private String no_invoicing;
|
||||||
|
|
||||||
|
@Schema(description = "红冲原因枚举值;no_invoicing为空时必填;枚举值:开票有误、销货退回、服务终止、销售折让;长度20位字符", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
private String reversal_reason;
|
||||||
|
|
||||||
|
@Schema(description = "冲销相关附件列表", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
private List<String> filedata;
|
||||||
|
|
||||||
|
// @Data
|
||||||
|
// @Schema(description = "冲销附件信息")
|
||||||
|
// public static class InvoiceReversalFileData {
|
||||||
|
//
|
||||||
|
// @Schema(description = "文件名;必须带文件后缀名;长度200位字符", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
// private String filename;
|
||||||
|
//
|
||||||
|
// @Schema(description = "文件内容;BASE64编码", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
// private String filect;
|
||||||
|
// }
|
||||||
|
}
|
||||||
@@ -0,0 +1,105 @@
|
|||||||
|
package com.zt.plat.module.erp.api.dto;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Schema(description = "管理后台 - 电子发票开具请求DTO")
|
||||||
|
public class ErpElectronicInvoiceSubmitReqDTO {
|
||||||
|
|
||||||
|
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
@Schema(description = "开票日期;格式为YYYYMMDD(如20251106)", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
private String bill_date;
|
||||||
|
|
||||||
|
@Schema(description = "是否暂估开票;长度1位字符")
|
||||||
|
private String provi_estimate;
|
||||||
|
|
||||||
|
@Schema(description = "发票抬头文本;长度25位字符")
|
||||||
|
private String bill_text;
|
||||||
|
|
||||||
|
@Schema(description = "最晚收款日期;格式为YYYYMMDD(如20251106)", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
private String bline_date;
|
||||||
|
|
||||||
|
@Schema(description = "不开具电子发票;X-不开票;长度1位字符")
|
||||||
|
private String no_invoicing;
|
||||||
|
|
||||||
|
@Schema(description = "电子发票类型;no_invoicing为空时必填;05-普通发票,06-增值税专用发票;长度2位字符")
|
||||||
|
private String invoice_type;
|
||||||
|
|
||||||
|
@Schema(description = "电子发票备注;会带入到电子发票上;长度200位字符")
|
||||||
|
private String invoice_note;
|
||||||
|
|
||||||
|
@Schema(description = "红冲原因;no_invoicing为空且生成的是红字发票时必填;枚举值:开票有误、销货退回、服务终止、销售折让;长度20位字符")
|
||||||
|
private String reversal_reason;
|
||||||
|
|
||||||
|
@Schema(description = "发票行项目列表", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
private List<InvoiceItem> item;
|
||||||
|
|
||||||
|
@Schema(description = "发票条件明细列表", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
private List<String> cond;
|
||||||
|
|
||||||
|
@Schema(description = "发票附件列表")
|
||||||
|
private List<InvoiceFileData> filedata;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Schema(description = "发票行项目明细")
|
||||||
|
public static class InvoiceItem {
|
||||||
|
|
||||||
|
@Schema(description = "发票行号;从1开始顺序编号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
private Integer data_index;
|
||||||
|
|
||||||
|
@Schema(description = "参照类别;C-参照销售订单开票,J-根据交货单开票", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
private String ref_doc_ca;
|
||||||
|
|
||||||
|
@Schema(description = "参照单号;长度10位字符", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
private String ref_doc;
|
||||||
|
|
||||||
|
@Schema(description = "参照行号;长度6位数字", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
private String ref_item;
|
||||||
|
|
||||||
|
@Schema(description = "开票数量;保留3位小数", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
private BigDecimal req_qty;
|
||||||
|
|
||||||
|
@Schema(description = "规格型号;会带入到电子发票上;长度100位字符")
|
||||||
|
private String model_note;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Schema(description = "发票条件明细")
|
||||||
|
public static class InvoiceCond {
|
||||||
|
|
||||||
|
@Schema(description = "发票行号;与item-data_index关联", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
private Integer data_index;
|
||||||
|
|
||||||
|
@Schema(description = "条件类型;长度4位字符", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
private String cond_type;
|
||||||
|
|
||||||
|
@Schema(description = "条件金额;保留4位小数", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
private BigDecimal cond_value;
|
||||||
|
|
||||||
|
@Schema(description = "货币码;长度5位字符", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
private String cond_curr;
|
||||||
|
|
||||||
|
@Schema(description = "条件单位;使用基本计量单位;长度3位字符", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
private String cond_d_unt;
|
||||||
|
|
||||||
|
@Schema(description = "条件定价单位;固定值1;长度5位数字", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
private BigDecimal cond_p_unt;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Schema(description = "发票附件信息")
|
||||||
|
public static class InvoiceFileData {
|
||||||
|
|
||||||
|
@Schema(description = "文件名;必须带文件后缀名;长度200位字符", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
private String filename;
|
||||||
|
|
||||||
|
@Schema(description = "文件内容;BASE64编码", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
private String filect;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
package com.zt.plat.module.erp.api;
|
package com.zt.plat.module.erp.api;
|
||||||
|
|
||||||
import com.zt.plat.framework.common.pojo.CommonResult;
|
import com.zt.plat.framework.common.pojo.CommonResult;
|
||||||
|
import com.zt.plat.module.erp.api.dto.ErpElectronicInvoiceReversalReqDTO;
|
||||||
|
import com.zt.plat.module.erp.api.dto.ErpElectronicInvoiceSubmitReqDTO;
|
||||||
import com.zt.plat.module.erp.api.dto.ErpInvoiceticketSubmitReqDTO;
|
import com.zt.plat.module.erp.api.dto.ErpInvoiceticketSubmitReqDTO;
|
||||||
import com.zt.plat.module.erp.api.dto.ErpInvoiceticketSubmitRespDTO;
|
import com.zt.plat.module.erp.api.dto.ErpInvoiceticketSubmitRespDTO;
|
||||||
import com.zt.plat.module.erp.service.erp.ErpInvoiceticketService;
|
import com.zt.plat.module.erp.service.erp.ErpInvoiceticketService;
|
||||||
@@ -9,6 +11,9 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import static com.zt.plat.framework.common.pojo.CommonResult.success;
|
import static com.zt.plat.framework.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@@ -22,4 +27,19 @@ public class InvoiceticketImpl implements InvoiceticketApi {
|
|||||||
public CommonResult<ErpInvoiceticketSubmitRespDTO> submitDataToErp(ErpInvoiceticketSubmitReqDTO reqDTO) {
|
public CommonResult<ErpInvoiceticketSubmitRespDTO> submitDataToErp(ErpInvoiceticketSubmitReqDTO reqDTO) {
|
||||||
return success(erpInvoiceticketService.sbumitToErp020(reqDTO));
|
return success(erpInvoiceticketService.sbumitToErp020(reqDTO));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CommonResult<HashMap<String, String>> submitDataToErp098(Map<String, Object> reqDTO) {
|
||||||
|
return success(erpInvoiceticketService.sbumitToErp098(reqDTO));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CommonResult<HashMap<String, String>> submitDataToErp096(ErpElectronicInvoiceSubmitReqDTO reqDTO) {
|
||||||
|
return success(erpInvoiceticketService.sbumitToErp096(reqDTO));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CommonResult<HashMap<String, String>> submitDataToErp097(ErpElectronicInvoiceReversalReqDTO reqDTO) {
|
||||||
|
return success(erpInvoiceticketService.sbumitToErp097(reqDTO));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -125,12 +125,4 @@ public class ErpCompanyController {
|
|||||||
return success(TEST);
|
return success(TEST);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/test2")
|
|
||||||
@Operation(summary = "获取base的金属元素")
|
|
||||||
@PreAuthorize("@ss.hasPermission('sply:erp-company:get')")
|
|
||||||
public CommonResult<String> test2() {
|
|
||||||
String TEST = erpCompanyService.test2();
|
|
||||||
return success(TEST);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -19,7 +19,7 @@ public class ErpProductiveOrderPageReqVO extends PageParam {
|
|||||||
private String companyNumber;
|
private String companyNumber;
|
||||||
|
|
||||||
@Schema(description = "工厂编码")
|
@Schema(description = "工厂编码")
|
||||||
@NotEmpty(message = "公司编号不能为空")
|
@NotEmpty(message = "工厂编码不能为空")
|
||||||
private String factoryNumber;
|
private String factoryNumber;
|
||||||
|
|
||||||
@Schema(description = "工厂名称", example = "赵六")
|
@Schema(description = "工厂名称", example = "赵六")
|
||||||
@@ -30,12 +30,12 @@ public class ErpProductiveOrderPageReqVO extends PageParam {
|
|||||||
|
|
||||||
@Schema(description = "基本开始日期")
|
@Schema(description = "基本开始日期")
|
||||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
@NotEmpty(message = "公司编号不能为空")
|
@NotEmpty(message = "基本开始日期不能为空")
|
||||||
private LocalDateTime[] startDate;
|
private LocalDateTime[] startDate;
|
||||||
|
|
||||||
@Schema(description = "基本完成日期")
|
@Schema(description = "基本完成日期")
|
||||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
@NotEmpty(message = "公司编号不能为空")
|
@NotEmpty(message = "基本完成日期不能为空")
|
||||||
private LocalDateTime[] endDate;
|
private LocalDateTime[] endDate;
|
||||||
|
|
||||||
@Schema(description = "主产品物料编号")
|
@Schema(description = "主产品物料编号")
|
||||||
|
|||||||
@@ -6,6 +6,9 @@ import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
|
|||||||
import com.zt.plat.module.erp.controller.admin.erp.vo.ErpCustomerPageReqVO;
|
import com.zt.plat.module.erp.controller.admin.erp.vo.ErpCustomerPageReqVO;
|
||||||
import com.zt.plat.module.erp.dal.dataobject.erp.ErpCustomerDO;
|
import com.zt.plat.module.erp.dal.dataobject.erp.ErpCustomerDO;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ERP客商主数据 Mapper
|
* ERP客商主数据 Mapper
|
||||||
@@ -29,4 +32,5 @@ public interface ErpCustomerMapper extends BaseMapperX<ErpCustomerDO> {
|
|||||||
.orderByDesc(ErpCustomerDO::getId));
|
.orderByDesc(ErpCustomerDO::getId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void updateBatchByNumber(@Param("toUpdate") List<ErpCustomerDO> toUpdate);
|
||||||
}
|
}
|
||||||
@@ -74,6 +74,4 @@ public interface ErpCompanyService {
|
|||||||
void test();
|
void test();
|
||||||
|
|
||||||
String test1();
|
String test1();
|
||||||
|
|
||||||
String test2();
|
|
||||||
}
|
}
|
||||||
@@ -286,11 +286,4 @@ public class ErpCompanyServiceImpl implements ErpCompanyService {
|
|||||||
return url + requestEntity;
|
return url + requestEntity;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String test2() {
|
|
||||||
ElementDTO respVO = new ElementDTO();
|
|
||||||
CommonResult<List<ElementDTO>> dtos = baseApi.getElementNoPage();
|
|
||||||
return dtos.toString();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -7,6 +7,7 @@ import com.xxl.job.core.handler.annotation.XxlJob;
|
|||||||
import com.zt.plat.framework.common.pojo.PageResult;
|
import com.zt.plat.framework.common.pojo.PageResult;
|
||||||
import com.zt.plat.framework.common.util.object.BeanUtils;
|
import com.zt.plat.framework.common.util.object.BeanUtils;
|
||||||
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
|
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
|
import com.zt.plat.module.erp.dal.dataobject.erp.ErpMaterialDO;
|
||||||
import com.zt.plat.module.erp.utils.ErpConfig;
|
import com.zt.plat.module.erp.utils.ErpConfig;
|
||||||
import com.zt.plat.module.erp.utils.MyRedisConfig;
|
import com.zt.plat.module.erp.utils.MyRedisConfig;
|
||||||
import com.zt.plat.module.erp.enums.OftenEnum;
|
import com.zt.plat.module.erp.enums.OftenEnum;
|
||||||
@@ -113,31 +114,37 @@ public class ErpCustomerServiceImpl implements ErpCustomerService {
|
|||||||
OftenEnum.FuncnrEnum funcnrEnum = OftenEnum.FuncnrEnum.客商信息;
|
OftenEnum.FuncnrEnum funcnrEnum = OftenEnum.FuncnrEnum.客商信息;
|
||||||
String funcnr = funcnrEnum.getFuncnr();
|
String funcnr = funcnrEnum.getFuncnr();
|
||||||
|
|
||||||
String key = "erpMap" + funcnrEnum.getFuncnr();
|
String key = "erp" + funcnrEnum.getFuncnr();
|
||||||
if (myRedisConfig.getRedisCacheMap(key).isEmpty()) {
|
if (myRedisConfig.getRedisCache(key) == null) {
|
||||||
initializeMap(key);
|
initialize(key);
|
||||||
}
|
}
|
||||||
// 构建req参数
|
//循环近五年日期,
|
||||||
Map<String, Object> req = new HashMap<>();
|
|
||||||
List<Map<String, String>> datumList = new ArrayList<>();
|
|
||||||
Map<String, String> datumEntry = new HashMap<>();
|
|
||||||
// 构建datum参数数组
|
|
||||||
datumEntry.put("sign", "I");
|
|
||||||
datumEntry.put("option", "EQ");
|
|
||||||
datumEntry.put("low", LocalDate.now().toString());
|
|
||||||
datumList.add(datumEntry);
|
|
||||||
req.put(funcnrEnum.getDatekey(), datumList);
|
|
||||||
|
|
||||||
// 1. 调用ERP接口获取数据
|
|
||||||
JSONArray dataArrayALL = new JSONArray();
|
JSONArray dataArrayALL = new JSONArray();
|
||||||
for (OftenEnum.ModeTypeEnum type : OftenEnum.ModeTypeEnum.values()) {
|
LocalDate endDate = LocalDate.now();
|
||||||
req.put("mode", type.modetype);
|
LocalDate startDate = endDate.minusYears(5);
|
||||||
HashMap<String, Object> dataFromERP = erpConfig.fetchDataFromERP(funcnr, req);
|
for (LocalDate date = startDate; !date.isAfter(endDate); date = date.plusDays(1)) {
|
||||||
JSONArray dataArray = (JSONArray) dataFromERP.get(funcnrEnum.getDatakey());
|
// 构建req参数
|
||||||
if (dataArray == null || dataArray.isEmpty()) {
|
Map<String, Object> req = new HashMap<>();
|
||||||
continue;
|
List<Map<String, String>> datumList = new ArrayList<>();
|
||||||
|
Map<String, String> datumEntry = new HashMap<>();
|
||||||
|
// 构建datum参数数组
|
||||||
|
datumEntry.put("sign", "I");
|
||||||
|
datumEntry.put("option", "EQ");
|
||||||
|
// 把每次循环的日期,放在这里
|
||||||
|
datumEntry.put("low", date.toString());
|
||||||
|
datumList.add(datumEntry);
|
||||||
|
req.put(funcnrEnum.getDatekey(), datumList);
|
||||||
|
|
||||||
|
// 1. 调用ERP接口获取数据
|
||||||
|
for (OftenEnum.ModeTypeEnum type : OftenEnum.ModeTypeEnum.values()) {
|
||||||
|
req.put("MODE", type.modetype);
|
||||||
|
HashMap<String, Object> dataFromERP = erpConfig.fetchDataFromERP(funcnr, req);
|
||||||
|
JSONArray dataArray = (JSONArray) dataFromERP.get(funcnrEnum.getDatakey());
|
||||||
|
if (dataArray == null || dataArray.isEmpty()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
dataArrayALL.addAll(dataArray);
|
||||||
}
|
}
|
||||||
dataArrayALL.addAll(dataArray);
|
|
||||||
}
|
}
|
||||||
if (dataArrayALL.isEmpty()) {
|
if (dataArrayALL.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
@@ -153,17 +160,18 @@ public class ErpCustomerServiceImpl implements ErpCustomerService {
|
|||||||
/**
|
/**
|
||||||
* 处理数据,区分新增和更新
|
* 处理数据,区分新增和更新
|
||||||
*/
|
*/
|
||||||
private ProcessingResult processData(JSONArray dataArray, OftenEnum.FuncnrEnum funcnrEnum) {
|
private ProcessingResult processData(JSONArray dataArray, OftenEnum.FuncnrEnum funcnr) {
|
||||||
String key = "erpMap" + funcnrEnum.getFuncnr();
|
String key = "erp" + funcnr.getFuncnr();
|
||||||
Map<String, Long> numbers = myRedisConfig.getRedisCacheMap(key);
|
Map<String, List<String>> numbers = myRedisConfig.numbers(dataArray, key, funcnr.getDatakey());
|
||||||
|
List<String> allnumbers = numbers.get("all");
|
||||||
|
List<String> comnumbers = numbers.get("com");
|
||||||
List<ErpCustomerDO> toUpdate = new ArrayList<>();
|
List<ErpCustomerDO> toUpdate = new ArrayList<>();
|
||||||
List<ErpCustomerDO> toInsert = new ArrayList<>();
|
List<ErpCustomerDO> toInsert = new ArrayList<>();
|
||||||
|
|
||||||
for (int i = 0; i < dataArray.size(); i++) {
|
for (int i = 0; i < dataArray.size(); i++) {
|
||||||
JSONObject dataJson = dataArray.getJSONObject(i);
|
JSONObject dataJson = dataArray.getJSONObject(i);
|
||||||
if (dataJson != null) {
|
if (dataJson != null) {
|
||||||
String number = dataJson.getString(funcnrEnum.getDatakey());
|
String number = dataJson.getString(funcnr.getDatakey());
|
||||||
if (number != null) {
|
if (number != null) {
|
||||||
number = number.trim();
|
number = number.trim();
|
||||||
}
|
}
|
||||||
@@ -185,10 +193,8 @@ public class ErpCustomerServiceImpl implements ErpCustomerService {
|
|||||||
DO.setIsProvisional(dataJson.getString("XBLCK"));
|
DO.setIsProvisional(dataJson.getString("XBLCK"));
|
||||||
DO.setTaxNumber(dataJson.getString("TAXNO"));
|
DO.setTaxNumber(dataJson.getString("TAXNO"));
|
||||||
|
|
||||||
// 使用 Map 优化查找效率,避免每次遍历 comnumbers 列表
|
if (comnumbers.contains(number)) {
|
||||||
if (number != null && numbers.get(number) != null) {
|
|
||||||
// 更新
|
// 更新
|
||||||
DO.setId(numbers.get(number));
|
|
||||||
toUpdate.add(DO);
|
toUpdate.add(DO);
|
||||||
} else {
|
} else {
|
||||||
// 新增
|
// 新增
|
||||||
@@ -197,7 +203,7 @@ public class ErpCustomerServiceImpl implements ErpCustomerService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return new ProcessingResult(toUpdate, toInsert, key);
|
return new ProcessingResult(toUpdate, toInsert, key, allnumbers);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -207,21 +213,11 @@ public class ErpCustomerServiceImpl implements ErpCustomerService {
|
|||||||
// 批量新增和更新
|
// 批量新增和更新
|
||||||
if (!result.toInsert.isEmpty()) {
|
if (!result.toInsert.isEmpty()) {
|
||||||
erpCustomerMapper.insertBatch(result.toInsert);
|
erpCustomerMapper.insertBatch(result.toInsert);
|
||||||
// 批量查询刚插入数据的id,提升效率
|
|
||||||
List<String> insertedNumbers = result.toInsert.stream()
|
|
||||||
.map(ErpCustomerDO::getNumber)
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
List<ErpCustomerDO> insertedRecords = erpCustomerMapper.selectList(
|
|
||||||
new LambdaQueryWrapperX<ErpCustomerDO>()
|
|
||||||
.in(ErpCustomerDO::getNumber, insertedNumbers)
|
|
||||||
);
|
|
||||||
Map<String, Long> numberIdMap = insertedRecords.stream()
|
|
||||||
.collect(Collectors.toMap(ErpCustomerDO::getNumber, ErpCustomerDO::getId));
|
|
||||||
myRedisConfig.addRedisCacheMap(result.key, numberIdMap);
|
|
||||||
}
|
}
|
||||||
if (!result.toUpdate.isEmpty()) {
|
if (!result.toUpdate.isEmpty()) {
|
||||||
erpCustomerMapper.updateBatch(result.toUpdate);
|
erpCustomerMapper.updateBatchByNumber(result.toUpdate);
|
||||||
}
|
}
|
||||||
|
myRedisConfig.updateRedisCache(result.key, result.allnumbers);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -231,18 +227,21 @@ public class ErpCustomerServiceImpl implements ErpCustomerService {
|
|||||||
private final List<ErpCustomerDO> toUpdate;
|
private final List<ErpCustomerDO> toUpdate;
|
||||||
private final List<ErpCustomerDO> toInsert;
|
private final List<ErpCustomerDO> toInsert;
|
||||||
private final String key;
|
private final String key;
|
||||||
|
private final List<String> allnumbers;
|
||||||
|
|
||||||
public ProcessingResult(List<ErpCustomerDO> toUpdate, List<ErpCustomerDO> toInsert, String key) {
|
public ProcessingResult(List<ErpCustomerDO> toUpdate, List<ErpCustomerDO> toInsert, String key, List<String> allnumbers) {
|
||||||
this.toUpdate = toUpdate;
|
this.toUpdate = toUpdate;
|
||||||
this.toInsert = toInsert;
|
this.toInsert = toInsert;
|
||||||
this.key = key;
|
this.key = key;
|
||||||
|
this.allnumbers = allnumbers;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initializeMap(String key) {
|
private void initialize(String key) {
|
||||||
Map<String, Long> existingNumbers = erpCustomerMapper.selectList(new LambdaQueryWrapperX<ErpCustomerDO>())
|
List<String> existingNumbers = erpCustomerMapper.selectList(new LambdaQueryWrapperX<ErpCustomerDO>())
|
||||||
.stream()
|
.stream()
|
||||||
.collect(Collectors.toMap(ErpCustomerDO::getNumber, ErpCustomerDO::getId));
|
.map(ErpCustomerDO::getNumber)
|
||||||
myRedisConfig.addRedisCacheMap(key, existingNumbers);
|
.collect(Collectors.toList());
|
||||||
|
myRedisConfig.updateRedisCache(key, existingNumbers);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,8 +1,16 @@
|
|||||||
package com.zt.plat.module.erp.service.erp;
|
package com.zt.plat.module.erp.service.erp;
|
||||||
|
|
||||||
|
import com.zt.plat.module.erp.api.dto.ErpElectronicInvoiceReversalReqDTO;
|
||||||
|
import com.zt.plat.module.erp.api.dto.ErpElectronicInvoiceSubmitReqDTO;
|
||||||
import com.zt.plat.module.erp.api.dto.ErpInvoiceticketSubmitReqDTO;
|
import com.zt.plat.module.erp.api.dto.ErpInvoiceticketSubmitReqDTO;
|
||||||
import com.zt.plat.module.erp.api.dto.ErpInvoiceticketSubmitRespDTO;
|
import com.zt.plat.module.erp.api.dto.ErpInvoiceticketSubmitRespDTO;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
public interface ErpInvoiceticketService {
|
public interface ErpInvoiceticketService {
|
||||||
ErpInvoiceticketSubmitRespDTO sbumitToErp020(ErpInvoiceticketSubmitReqDTO reqDTO);
|
ErpInvoiceticketSubmitRespDTO sbumitToErp020(ErpInvoiceticketSubmitReqDTO reqDTO);
|
||||||
|
HashMap<String, String> sbumitToErp098(Map<String, Object> reqDTO);
|
||||||
|
HashMap<String, String> sbumitToErp096(ErpElectronicInvoiceSubmitReqDTO reqDTO);
|
||||||
|
HashMap<String, String> sbumitToErp097(ErpElectronicInvoiceReversalReqDTO reqDTO);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,9 +2,7 @@ package com.zt.plat.module.erp.service.erp;
|
|||||||
|
|
||||||
import com.zt.plat.framework.security.core.util.SecurityFrameworkUtils;
|
import com.zt.plat.framework.security.core.util.SecurityFrameworkUtils;
|
||||||
import com.zt.plat.module.erp.api.ErpExternalApi;
|
import com.zt.plat.module.erp.api.ErpExternalApi;
|
||||||
import com.zt.plat.module.erp.api.dto.ErpInvoiceticketSubmitReqDTO;
|
import com.zt.plat.module.erp.api.dto.*;
|
||||||
import com.zt.plat.module.erp.api.dto.ErpInvoiceticketSubmitRespDTO;
|
|
||||||
import com.zt.plat.module.erp.api.dto.ErpSubmitReqDTO;
|
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@@ -59,6 +57,7 @@ public class ErpInvoiceticketServiceImpl implements ErpInvoiceticketService {
|
|||||||
return respDTO;
|
return respDTO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 转换采购发票过账差异明细列表
|
* 转换采购发票过账差异明细列表
|
||||||
* 假设HashMap中子列表字段格式为:callBackSettlementDetails[0].factoryCode、callBackSettlementDetails[0].materialCode...
|
* 假设HashMap中子列表字段格式为:callBackSettlementDetails[0].factoryCode、callBackSettlementDetails[0].materialCode...
|
||||||
@@ -123,4 +122,57 @@ public class ErpInvoiceticketServiceImpl implements ErpInvoiceticketService {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HashMap<String, String> sbumitToErp098(Map<String, Object> param) {
|
||||||
|
ErpSubmitReqDTO reqDTO = new ErpSubmitReqDTO();
|
||||||
|
reqDTO.setFuncnr("098");
|
||||||
|
reqDTO.setBskey(param.get("id").toString());
|
||||||
|
reqDTO.setUsrid(String.valueOf(SecurityFrameworkUtils.getLoginUserId()));
|
||||||
|
reqDTO.setUsrnm((SecurityFrameworkUtils.getLoginUserNickname()));
|
||||||
|
param.remove("id");
|
||||||
|
reqDTO.setReq(param);
|
||||||
|
return erpExternalApi.submitDataToErp(reqDTO);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HashMap<String, String> sbumitToErp096(ErpElectronicInvoiceSubmitReqDTO erpElectronicInvoiceSubmitReqDTO) {
|
||||||
|
ErpSubmitReqDTO reqDTO = new ErpSubmitReqDTO();
|
||||||
|
reqDTO.setFuncnr("096");
|
||||||
|
reqDTO.setBskey(erpElectronicInvoiceSubmitReqDTO.getId());
|
||||||
|
reqDTO.setUsrid(String.valueOf(SecurityFrameworkUtils.getLoginUserId()));
|
||||||
|
reqDTO.setUsrnm((SecurityFrameworkUtils.getLoginUserNickname()));
|
||||||
|
Map<String, Object> req = new HashMap<>();
|
||||||
|
req.put("bill_date", erpElectronicInvoiceSubmitReqDTO.getBill_date());
|
||||||
|
req.put("provi_estimate", erpElectronicInvoiceSubmitReqDTO.getProvi_estimate());
|
||||||
|
req.put("bline_date", erpElectronicInvoiceSubmitReqDTO.getBline_date());
|
||||||
|
req.put("bill_text", erpElectronicInvoiceSubmitReqDTO.getBill_text());
|
||||||
|
req.put("no_invoicing", erpElectronicInvoiceSubmitReqDTO.getNo_invoicing());
|
||||||
|
req.put("invoice_type", erpElectronicInvoiceSubmitReqDTO.getInvoice_type());
|
||||||
|
req.put("invoice_note", erpElectronicInvoiceSubmitReqDTO.getInvoice_note());
|
||||||
|
req.put("reversal_reason", erpElectronicInvoiceSubmitReqDTO.getReversal_reason());
|
||||||
|
req.put("item", erpElectronicInvoiceSubmitReqDTO.getItem());
|
||||||
|
req.put("cond", erpElectronicInvoiceSubmitReqDTO.getCond());
|
||||||
|
req.put("filedata", erpElectronicInvoiceSubmitReqDTO.getBline_date());
|
||||||
|
reqDTO.setReq(req);
|
||||||
|
return erpExternalApi.submitDataToErp(reqDTO);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HashMap<String, String> sbumitToErp097(ErpElectronicInvoiceReversalReqDTO reqDTO) {
|
||||||
|
ErpSubmitReqDTO submitReqDTO = new ErpSubmitReqDTO();
|
||||||
|
submitReqDTO.setFuncnr("097");
|
||||||
|
submitReqDTO.setBskey(reqDTO.getId());
|
||||||
|
submitReqDTO.setUsrid(String.valueOf(SecurityFrameworkUtils.getLoginUserId()));
|
||||||
|
submitReqDTO.setUsrnm((SecurityFrameworkUtils.getLoginUserNickname()));
|
||||||
|
Map<String, Object> req = new HashMap<>();
|
||||||
|
req.put("billdoc", reqDTO.getBilldoc());
|
||||||
|
req.put("postingdate", reqDTO.getPostingdate());
|
||||||
|
req.put("reason", reqDTO.getReason());
|
||||||
|
req.put("no_invoicing", reqDTO.getNo_invoicing());
|
||||||
|
req.put("filedata", reqDTO.getFiledata());
|
||||||
|
return erpExternalApi.submitDataToErp(submitReqDTO);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,8 +6,10 @@ import com.alibaba.fastjson.JSONObject;
|
|||||||
import com.xxl.job.core.handler.annotation.XxlJob;
|
import com.xxl.job.core.handler.annotation.XxlJob;
|
||||||
import com.zt.plat.framework.common.pojo.PageResult;
|
import com.zt.plat.framework.common.pojo.PageResult;
|
||||||
import com.zt.plat.framework.common.util.object.BeanUtils;
|
import com.zt.plat.framework.common.util.object.BeanUtils;
|
||||||
|
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
import com.zt.plat.module.erp.controller.admin.erp.vo.ErpProductiveVersionPageReqVO;
|
import com.zt.plat.module.erp.controller.admin.erp.vo.ErpProductiveVersionPageReqVO;
|
||||||
import com.zt.plat.module.erp.dal.dataobject.erp.ErpProductiveVersionDO;
|
import com.zt.plat.module.erp.dal.dataobject.erp.ErpProductiveVersionDO;
|
||||||
|
import com.zt.plat.module.erp.dal.dataobject.erp.ErpPurchaseOrganizationDO;
|
||||||
import com.zt.plat.module.erp.utils.ErpConfig;
|
import com.zt.plat.module.erp.utils.ErpConfig;
|
||||||
import com.zt.plat.module.erp.utils.MyRedisConfig;
|
import com.zt.plat.module.erp.utils.MyRedisConfig;
|
||||||
import com.zt.plat.module.erp.enums.OftenEnum;
|
import com.zt.plat.module.erp.enums.OftenEnum;
|
||||||
@@ -28,6 +30,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static com.zt.plat.framework.common.exception.util.ServiceExceptionUtil.exception;
|
import static com.zt.plat.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
import static com.zt.plat.module.erp.enums.ErrorCodeConstants.*;
|
import static com.zt.plat.module.erp.enums.ErrorCodeConstants.*;
|
||||||
@@ -102,123 +105,158 @@ public class ErpProductiveOrderServiceImpl implements ErpProductiveOrderService
|
|||||||
return erpProductiveOrderMapper.selectById(id);
|
return erpProductiveOrderMapper.selectById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public PageResult<ErpProductiveOrderDO> getErpProductiveOrderPage(ErpProductiveOrderPageReqVO pageReqVO) {
|
|
||||||
return erpProductiveOrderMapper.selectPage(pageReqVO);
|
|
||||||
}
|
|
||||||
|
|
||||||
//直接从erp查询生产订单
|
|
||||||
// @Override
|
// @Override
|
||||||
// public PageResult<ErpProductiveOrderDO> getErpProductiveOrderPage(ErpProductiveOrderPageReqVO pageReqVO) {
|
// public PageResult<ErpProductiveOrderDO> getErpProductiveOrderPage(ErpProductiveOrderPageReqVO pageReqVO) {
|
||||||
// OftenEnum.FuncnrEnum funcnrEnum = OftenEnum.FuncnrEnum.生产订单;
|
// return erpProductiveOrderMapper.selectPage(pageReqVO);
|
||||||
// String funcnr = funcnrEnum.getFuncnr();
|
|
||||||
// Map<String, Object> req = new HashMap<>();
|
|
||||||
//
|
|
||||||
// // 构建查询参数
|
|
||||||
// req.put("BUKRS", pageReqVO.getCompanyNumber());
|
|
||||||
// req.put("WERKS", pageReqVO.getFactoryNumber());
|
|
||||||
//
|
|
||||||
// // 处理日期参数
|
|
||||||
// if (pageReqVO.getStartDate() != null) {
|
|
||||||
// req.put("BEGDA", pageReqVO.getStartDate()[0].format(DateTimeFormatter.ofPattern("yyyyMMdd")));
|
|
||||||
// }
|
|
||||||
// if (pageReqVO.getEndDate() != null) {
|
|
||||||
// req.put("ENDDA", pageReqVO.getEndDate()[0].format(DateTimeFormatter.ofPattern("yyyyMMdd")));
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// // 调用ERP接口获取数据
|
|
||||||
// HashMap<String, Object> dataFromERP = erpConfig.fetchDataFromERP(funcnr, req);
|
|
||||||
// JSONArray dataArray = (JSONArray) dataFromERP.get("E_RESP");
|
|
||||||
// if (dataArray == null || dataArray.isEmpty()) {
|
|
||||||
// // 返回空结果而不是抛出异常
|
|
||||||
// return new PageResult<>(new ArrayList<>(), 0L);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// List<ErpProductiveOrderDO> list = new ArrayList<>();
|
|
||||||
// for (int i = 0; i < dataArray.size(); i++) {
|
|
||||||
// JSONObject dataJson = dataArray.getJSONObject(i);
|
|
||||||
// if (dataJson != null) {
|
|
||||||
// ErpProductiveOrderDO orderDO = new ErpProductiveOrderDO();
|
|
||||||
//
|
|
||||||
// // 基本信息
|
|
||||||
// orderDO.setCompanyNumber(dataJson.getString("BUKRS"));
|
|
||||||
// orderDO.setFactoryNumber(dataJson.getString("WERKS").trim());
|
|
||||||
// orderDO.setFactoryName(dataJson.getString("NAME1"));
|
|
||||||
// orderDO.setOrderNumber(dataJson.getString("AUFNR"));
|
|
||||||
//
|
|
||||||
// // 日期处理
|
|
||||||
// String plannedStartDate = dataJson.getString("GLTRP");
|
|
||||||
// String actualStartDate = dataJson.getString("GSTRP");
|
|
||||||
//
|
|
||||||
// if (plannedStartDate != null && !plannedStartDate.equals("0000-00-00")) {
|
|
||||||
// try {
|
|
||||||
// orderDO.setStartDate(LocalDateTime.parse(plannedStartDate));
|
|
||||||
// } catch (Exception e) {
|
|
||||||
// // 忽略日期解析错误
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if (actualStartDate != null && !actualStartDate.equals("0000-00-00")) {
|
|
||||||
// try {
|
|
||||||
// orderDO.setEndDate(LocalDateTime.parse(actualStartDate));
|
|
||||||
// } catch (Exception e) {
|
|
||||||
// // 忽略日期解析错误
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// // 物料和工艺信息
|
|
||||||
// orderDO.setMainMaterialNumber(dataJson.getString("STLBEZ"));
|
|
||||||
// orderDO.setUnit(dataJson.getString("GMEIN"));
|
|
||||||
// orderDO.setMaterialDescription(dataJson.getString("MAKTX"));
|
|
||||||
// orderDO.setProcessingList(dataJson.getString("L_AFVC"));
|
|
||||||
// orderDO.setProcessingNumber(dataJson.getString("VORNR"));
|
|
||||||
// orderDO.setProcessingDescription(dataJson.getString("LTXA1"));
|
|
||||||
// orderDO.setObjectNumber(dataJson.getString("OBJID"));
|
|
||||||
// orderDO.setWorkCenterNumber(dataJson.getString("ARBPL"));
|
|
||||||
// orderDO.setWorkCenterDescription(dataJson.getString("KTEXT"));
|
|
||||||
// orderDO.setCostcenterNumber(dataJson.getString("KOSTL"));
|
|
||||||
// orderDO.setCostcenterName(dataJson.getString("TEXT_C"));
|
|
||||||
//
|
|
||||||
// list.add(orderDO);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// // 返回分页结果
|
|
||||||
// return new PageResult<>(list, (long) list.size());
|
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
// 直接从erp查询生产订单
|
||||||
|
@Override
|
||||||
|
public PageResult<ErpProductiveOrderDO> getErpProductiveOrderPage(ErpProductiveOrderPageReqVO pageReqVO) {
|
||||||
|
OftenEnum.FuncnrEnum funcnrEnum = OftenEnum.FuncnrEnum.生产订单明细;
|
||||||
|
String funcnr = funcnrEnum.getFuncnr();
|
||||||
|
Map<String, Object> req = new HashMap<>();
|
||||||
|
|
||||||
|
// 构建查询参数
|
||||||
|
req.put("BUKRS", pageReqVO.getCompanyNumber());
|
||||||
|
req.put("WERKS", pageReqVO.getFactoryNumber());
|
||||||
|
|
||||||
|
// 处理日期参数
|
||||||
|
if (pageReqVO.getStartDate() != null) {
|
||||||
|
req.put("BEGDA", pageReqVO.getStartDate()[0].format(DateTimeFormatter.ofPattern("yyyyMMdd")));
|
||||||
|
}
|
||||||
|
if (pageReqVO.getEndDate() != null) {
|
||||||
|
req.put("ENDDA", pageReqVO.getEndDate()[0].format(DateTimeFormatter.ofPattern("yyyyMMdd")));
|
||||||
|
}
|
||||||
|
|
||||||
|
// 调用ERP接口获取数据
|
||||||
|
HashMap<String, Object> dataFromERP = erpConfig.fetchDataFromERP(funcnr, req);
|
||||||
|
JSONArray dataArray = (JSONArray) dataFromERP.get("E_RESP");
|
||||||
|
if (dataArray == null || dataArray.isEmpty()) {
|
||||||
|
// 返回空结果而不是抛出异常
|
||||||
|
return new PageResult<>(new ArrayList<>(), 0L);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<ErpProductiveOrderDO> list = new ArrayList<>();
|
||||||
|
for (int i = 0; i < dataArray.size(); i++) {
|
||||||
|
JSONObject dataJson = dataArray.getJSONObject(i);
|
||||||
|
if (dataJson != null) {
|
||||||
|
ErpProductiveOrderDO orderDO = new ErpProductiveOrderDO();
|
||||||
|
|
||||||
|
// 基本信息
|
||||||
|
orderDO.setCompanyNumber(dataJson.getString("BUKRS"));
|
||||||
|
orderDO.setFactoryNumber(dataJson.getString("WERKS").trim());
|
||||||
|
orderDO.setFactoryName(dataJson.getString("NAME1"));
|
||||||
|
orderDO.setOrderNumber(dataJson.getString("AUFNR"));
|
||||||
|
|
||||||
|
// 日期处理
|
||||||
|
String plannedStartDate = dataJson.getString("GLTRP");
|
||||||
|
String actualStartDate = dataJson.getString("GSTRP");
|
||||||
|
|
||||||
|
if (plannedStartDate != null && !plannedStartDate.equals("0000-00-00")) {
|
||||||
|
try {
|
||||||
|
orderDO.setStartDate(LocalDateTime.parse(plannedStartDate));
|
||||||
|
} catch (Exception e) {
|
||||||
|
// 忽略日期解析错误
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (actualStartDate != null && !actualStartDate.equals("0000-00-00")) {
|
||||||
|
try {
|
||||||
|
orderDO.setEndDate(LocalDateTime.parse(actualStartDate));
|
||||||
|
} catch (Exception e) {
|
||||||
|
// 忽略日期解析错误
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 物料和工艺信息
|
||||||
|
orderDO.setMainMaterialNumber(dataJson.getString("STLBEZ"));
|
||||||
|
orderDO.setUnit(dataJson.getString("GMEIN"));
|
||||||
|
orderDO.setMaterialDescription(dataJson.getString("MAKTX"));
|
||||||
|
orderDO.setProcessingList(dataJson.getString("L_AFVC"));
|
||||||
|
orderDO.setProcessingNumber(dataJson.getString("VORNR"));
|
||||||
|
orderDO.setProcessingDescription(dataJson.getString("LTXA1"));
|
||||||
|
orderDO.setObjectNumber(dataJson.getString("OBJID"));
|
||||||
|
orderDO.setWorkCenterNumber(dataJson.getString("ARBPL"));
|
||||||
|
orderDO.setWorkCenterDescription(dataJson.getString("KTEXT"));
|
||||||
|
orderDO.setCostcenterNumber(dataJson.getString("KOSTL"));
|
||||||
|
orderDO.setCostcenterName(dataJson.getString("TEXT_C"));
|
||||||
|
|
||||||
|
list.add(orderDO);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
List<ErpProductiveOrderDO> listLast = list.stream()
|
||||||
|
.filter(orderDO -> pageReqVO.getFactoryName() == null || pageReqVO.getFactoryName().equals(orderDO.getFactoryName()))
|
||||||
|
.filter(orderDO -> pageReqVO.getOrderNumber() == null || pageReqVO.getOrderNumber().equals(orderDO.getOrderNumber()))
|
||||||
|
.filter(orderDO -> pageReqVO.getMainMaterialNumber() == null || pageReqVO.getMainMaterialNumber().equals(orderDO.getMainMaterialNumber()))
|
||||||
|
.filter(orderDO -> pageReqVO.getProcessingList() == null || pageReqVO.getProcessingList().equals(orderDO.getProcessingList()))
|
||||||
|
.filter(orderDO -> pageReqVO.getProcessingNumber() == null || pageReqVO.getProcessingNumber().equals(orderDO.getProcessingNumber()))
|
||||||
|
.filter(orderDO -> pageReqVO.getProcessingDescription() == null || pageReqVO.getProcessingDescription().equals(orderDO.getProcessingDescription()))
|
||||||
|
.filter(orderDO -> pageReqVO.getObjectNumber() == null || pageReqVO.getObjectNumber().equals(orderDO.getObjectNumber()))
|
||||||
|
.filter(orderDO -> pageReqVO.getWorkCenterNumber() == null || pageReqVO.getWorkCenterNumber().equals(orderDO.getWorkCenterNumber()))
|
||||||
|
.filter(orderDO -> pageReqVO.getWorkCenterDescription() == null || pageReqVO.getWorkCenterDescription().equals(orderDO.getWorkCenterDescription()))
|
||||||
|
.filter(orderDO -> pageReqVO.getCostcenterNumber() == null || pageReqVO.getCostcenterNumber().equals(orderDO.getCostcenterNumber()))
|
||||||
|
.filter(orderDO -> pageReqVO.getCostcenterName() == null || pageReqVO.getCostcenterName().equals(orderDO.getCostcenterName()))
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
// 返回分页结果
|
||||||
|
return new PageResult<>(listLast, (long) listLast.size());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
@XxlJob("getErpProductiveOrderTask")
|
// @XxlJob("getErpProductiveOrderTask")
|
||||||
public void callErpRfcInterface() {
|
public void callErpRfcInterface() {
|
||||||
OftenEnum.FuncnrEnum funcnrEnum = OftenEnum.FuncnrEnum.生产订单;
|
OftenEnum.FuncnrEnum funcnrEnum = OftenEnum.FuncnrEnum.生产订单明细;
|
||||||
String funcnr = funcnrEnum.getFuncnr();
|
String funcnr = funcnrEnum.getFuncnr();
|
||||||
|
|
||||||
|
//防止缓存数据丢失
|
||||||
|
String key = "erpMap" + funcnrEnum.getFuncnr();
|
||||||
|
if (myRedisConfig.getRedisCacheMap(key).isEmpty()) {
|
||||||
|
initializeMap(key);
|
||||||
|
}
|
||||||
Map<String, Object> req = new HashMap<>();
|
Map<String, Object> req = new HashMap<>();
|
||||||
List<Map<String, String>> datumList = new ArrayList<>();
|
List<Map<String, String>> datumListS = new ArrayList<>();
|
||||||
Map<String, String> datumEntry = new HashMap<>();
|
Map<String, String> datumEntryS = new HashMap<>();
|
||||||
// 构建datum参数数组
|
// 构建datum参数数组
|
||||||
datumEntry.put("sign", "I");
|
datumEntryS.put("sign", "I");
|
||||||
datumEntry.put("option", "EQ");
|
datumEntryS.put("option", "EQ");
|
||||||
datumEntry.put("low", LocalDate.now().toString());
|
datumEntryS.put("low", LocalDate.now().toString());
|
||||||
datumList.add(datumEntry);
|
datumListS.add(datumEntryS);
|
||||||
req.put(funcnrEnum.getDatekey(), datumList);
|
req.put("BEGDA", datumListS);
|
||||||
|
List<Map<String, String>> datumListE = new ArrayList<>();
|
||||||
|
Map<String, String> datumEntryE = new HashMap<>();
|
||||||
|
// 构建datum参数数组
|
||||||
|
datumEntryE.put("sign", "I");
|
||||||
|
datumEntryE.put("option", "EQ");
|
||||||
|
datumEntryE.put("low", LocalDate.now().toString());
|
||||||
|
datumListE.add(datumEntryE);
|
||||||
|
req.put("ENDDA", datumListE);
|
||||||
JSONArray dataArrayALL = new JSONArray();
|
JSONArray dataArrayALL = new JSONArray();
|
||||||
List<String> redisCache = myRedisConfig.getRedisCache(OftenEnum.FuncnrEnum.工厂信息.getFuncnr());
|
List<String> redisCacheF = myRedisConfig.getRedisCache(OftenEnum.FuncnrEnum.工厂信息.getFuncnr());
|
||||||
if (CollUtil.isEmpty(redisCache)) {
|
if (CollUtil.isEmpty(redisCacheF)) {
|
||||||
|
throw exception(ERP_FACTORY_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
List<String> redisCacheC = myRedisConfig.getRedisCache(OftenEnum.FuncnrEnum.公司代码.getFuncnr());
|
||||||
|
if (CollUtil.isEmpty(redisCacheC)) {
|
||||||
throw exception(ERP_FACTORY_NOT_EXISTS);
|
throw exception(ERP_FACTORY_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
// 1. 调用ERP接口获取数据
|
// 1. 调用ERP接口获取数据
|
||||||
for (String number : redisCache) {
|
for (String numberC : redisCacheC) {
|
||||||
req.put("WERKS", number);
|
for (String numberF : redisCacheF) {
|
||||||
// 1. 调用ERP接口获取数据
|
req.put("BUKRS", numberC);
|
||||||
HashMap<String, Object> dataFromERP = erpConfig.fetchDataFromERP(funcnr, req);
|
req.put("WERKS", numberF);
|
||||||
JSONArray dataArray = (JSONArray) dataFromERP.get("E_RESP");
|
// 1. 调用ERP接口获取数据
|
||||||
if (dataArray == null || dataArray.isEmpty()) {
|
HashMap<String, Object> dataFromERP = erpConfig.fetchDataFromERP(funcnr, req);
|
||||||
continue;
|
JSONArray dataArray = (JSONArray) dataFromERP.get("E_RESP");
|
||||||
|
if (dataArray == null || dataArray.isEmpty()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
dataArrayALL.addAll(dataArray);
|
||||||
}
|
}
|
||||||
dataArrayALL.addAll(dataArray);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dataArrayALL.isEmpty()) {
|
if (dataArrayALL.isEmpty()) {
|
||||||
throw exception(ERP_PRODUCTIVE_ORDER_NOT_EXISTS);
|
throw exception(ERP_PRODUCTIVE_ORDER_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
@@ -234,34 +272,58 @@ public class ErpProductiveOrderServiceImpl implements ErpProductiveOrderService
|
|||||||
* 处理数据,区分新增和更新
|
* 处理数据,区分新增和更新
|
||||||
*/
|
*/
|
||||||
private ProcessingResult processData(JSONArray dataArray, OftenEnum.FuncnrEnum funcnr) {
|
private ProcessingResult processData(JSONArray dataArray, OftenEnum.FuncnrEnum funcnr) {
|
||||||
String key = "erp" + funcnr.getFuncnr();
|
String key = "erpMap" + funcnr.getFuncnr();
|
||||||
Map<String, List<String>> numbers = myRedisConfig.numbers(dataArray, key, funcnr.getDatakey());
|
Map<String, Long> numbers = myRedisConfig.getRedisCacheMap(key);
|
||||||
List<String> allnumbers = numbers.get("all");
|
|
||||||
List<String> comnumbers = numbers.get("com");
|
|
||||||
List<ErpProductiveOrderDO> toUpdate = new ArrayList<>();
|
List<ErpProductiveOrderDO> toUpdate = new ArrayList<>();
|
||||||
List<ErpProductiveOrderDO> toInsert = new ArrayList<>();
|
List<ErpProductiveOrderDO> toInsert = new ArrayList<>();
|
||||||
|
|
||||||
|
List<String> dataArrayNumbers = new ArrayList<>();
|
||||||
for (int i = 0; i < dataArray.size(); i++) {
|
for (int i = 0; i < dataArray.size(); i++) {
|
||||||
JSONObject dataJson = dataArray.getJSONObject(i);
|
JSONObject dataJson = dataArray.getJSONObject(i);
|
||||||
if (dataJson != null) {
|
if (dataJson != null) {
|
||||||
String number = dataJson.getString("BUKRS").trim();
|
String number = dataJson.getString("AUFNR").trim();
|
||||||
if (number != null) {
|
ErpProductiveOrderDO DO = new ErpProductiveOrderDO();
|
||||||
ErpProductiveOrderDO DO = new ErpProductiveOrderDO();
|
DO.setCompanyNumber(dataJson.getString("BUKRS").trim());
|
||||||
// DO.setName(dataJson.getString("BUTXT"));
|
DO.setFactoryNumber(dataJson.getString("WERKS").trim());
|
||||||
// DO.setNumber(number);
|
DO.setFactoryName(dataJson.getString("NAME1").trim());
|
||||||
// DO.setCurrency(dataJson.getString("WAERS"));
|
DO.setOrderNumber(dataJson.getString("AUFNR").trim());
|
||||||
if (comnumbers.contains(number)) {
|
if (!dataJson.getString("GLTRP").equals("0000-00-00")) {
|
||||||
// 更新
|
DO.setStartDate(LocalDateTime.parse(dataJson.getString("GLTRP") + "T00:00:00"));
|
||||||
toUpdate.add(DO);
|
|
||||||
} else {
|
|
||||||
// 新增
|
|
||||||
toInsert.add(DO);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
if (!dataJson.getString("GSTRP").equals("0000-00-00")) {
|
||||||
|
DO.setEndDate(LocalDateTime.parse(dataJson.getString("GSTRP") + "T00:00:00"));
|
||||||
|
}
|
||||||
|
DO.setMainMaterialNumber(dataJson.getString("STLBEZ").trim());
|
||||||
|
DO.setUnit(dataJson.getString("GMEIN").trim());
|
||||||
|
DO.setMaterialDescription(dataJson.getString("MAKTX").trim());
|
||||||
|
DO.setProcessingList(dataJson.getString("L_AFVC").trim());
|
||||||
|
DO.setProcessingNumber(dataJson.getString("VORNR").trim());
|
||||||
|
DO.setProcessingDescription(dataJson.getString("LTXA1").trim());
|
||||||
|
DO.setObjectNumber(dataJson.getString("OBJID").trim());
|
||||||
|
DO.setWorkCenterNumber(dataJson.getString("ARBPL").trim());
|
||||||
|
DO.setWorkCenterDescription(dataJson.getString("KTEXT").trim());
|
||||||
|
DO.setCostcenterNumber(dataJson.getString("KOSTL").trim());
|
||||||
|
DO.setCostcenterName(dataJson.getString("TEXT_C").trim());
|
||||||
|
if (numbers.get(number) != null) {
|
||||||
|
// 更新
|
||||||
|
DO.setId(numbers.get(number));
|
||||||
|
toUpdate.add(DO);
|
||||||
|
} else {
|
||||||
|
// 新增
|
||||||
|
toInsert.add(DO);
|
||||||
|
}
|
||||||
|
dataArrayNumbers.add(number);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 过滤出numbers中有,但dataArray中KOSTL没有的记录,即为需要删除的数据
|
||||||
|
List<String> deleteNumbers = new ArrayList<>();
|
||||||
|
for (String number : numbers.keySet()) {
|
||||||
|
if (!dataArrayNumbers.contains(number)) {
|
||||||
|
deleteNumbers.add(number);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return new ProcessingResult(toUpdate, toInsert, key, allnumbers);
|
return new ProcessingResult(toUpdate, toInsert, key, deleteNumbers);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -271,11 +333,26 @@ public class ErpProductiveOrderServiceImpl implements ErpProductiveOrderService
|
|||||||
// 批量新增和更新
|
// 批量新增和更新
|
||||||
if (!result.toInsert.isEmpty()) {
|
if (!result.toInsert.isEmpty()) {
|
||||||
erpProductiveOrderMapper.insertBatch(result.toInsert);
|
erpProductiveOrderMapper.insertBatch(result.toInsert);
|
||||||
|
// 批量查询刚插入数据的id,提升效率
|
||||||
|
List<String> insertedNumbers = result.toInsert.stream()
|
||||||
|
.map(ErpProductiveOrderDO::getOrderNumber)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
List<ErpProductiveOrderDO> insertedRecords = erpProductiveOrderMapper.selectList(
|
||||||
|
new LambdaQueryWrapperX<ErpProductiveOrderDO>()
|
||||||
|
.in(ErpProductiveOrderDO::getOrderNumber, insertedNumbers)
|
||||||
|
);
|
||||||
|
Map<String, Long> numberIdMap = insertedRecords.stream()
|
||||||
|
.collect(Collectors.toMap(ErpProductiveOrderDO::getOrderNumber, ErpProductiveOrderDO::getId));
|
||||||
|
myRedisConfig.addRedisCacheMap(result.key, numberIdMap);
|
||||||
}
|
}
|
||||||
if (!result.toUpdate.isEmpty()) {
|
if (!result.toUpdate.isEmpty()) {
|
||||||
erpProductiveOrderMapper.updateBatch(result.toUpdate);
|
erpProductiveOrderMapper.updateBatch(result.toUpdate);
|
||||||
}
|
}
|
||||||
myRedisConfig.updateRedisCache(result.key, result.allnumbers);
|
if (!result.deleteNumbers.isEmpty()) {
|
||||||
|
// 使用 in 条件批量删除,提高删除效率
|
||||||
|
erpProductiveOrderMapper.delete(new LambdaQueryWrapperX<ErpProductiveOrderDO>().in(ErpProductiveOrderDO::getOrderNumber, result.deleteNumbers));
|
||||||
|
myRedisConfig.deleteRedisCacheMap(result.key, result.deleteNumbers);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -285,13 +362,24 @@ public class ErpProductiveOrderServiceImpl implements ErpProductiveOrderService
|
|||||||
private final List<ErpProductiveOrderDO> toUpdate;
|
private final List<ErpProductiveOrderDO> toUpdate;
|
||||||
private final List<ErpProductiveOrderDO> toInsert;
|
private final List<ErpProductiveOrderDO> toInsert;
|
||||||
private final String key;
|
private final String key;
|
||||||
private final List<String> allnumbers;
|
private final List<String> deleteNumbers;
|
||||||
|
|
||||||
public ProcessingResult(List<ErpProductiveOrderDO> toUpdate, List<ErpProductiveOrderDO> toInsert, String key, List<String> allnumbers) {
|
public ProcessingResult(List<ErpProductiveOrderDO> toUpdate, List<ErpProductiveOrderDO> toInsert, String key, List<String> deleteNumbers) {
|
||||||
this.toUpdate = toUpdate;
|
this.toUpdate = toUpdate;
|
||||||
this.toInsert = toInsert;
|
this.toInsert = toInsert;
|
||||||
this.key = key;
|
this.key = key;
|
||||||
this.allnumbers = allnumbers;
|
this.deleteNumbers = deleteNumbers;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void initializeMap(String key) {
|
||||||
|
List<ErpProductiveOrderDO> assets = erpProductiveOrderMapper.selectList(new LambdaQueryWrapperX<ErpProductiveOrderDO>());
|
||||||
|
Map<String, Long> existingNumbers = new HashMap<>();
|
||||||
|
for (ErpProductiveOrderDO asset : assets) {
|
||||||
|
String mapKey = asset.getOrderNumber();
|
||||||
|
existingNumbers.put(mapKey, asset.getId());
|
||||||
|
}
|
||||||
|
myRedisConfig.addRedisCacheMap(key, existingNumbers);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -8,4 +8,22 @@
|
|||||||
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
||||||
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||||
-->
|
-->
|
||||||
|
<update id="updateBatchByNumber">
|
||||||
|
<foreach collection="toUpdate" item="item" separator=";" open="BEGIN" close=";END;">
|
||||||
|
UPDATE sply_erp_cstm
|
||||||
|
<set>
|
||||||
|
<if test="item.number != null">NUM = #{item.number},</if>
|
||||||
|
<if test="item.name != null">NAME = #{item.name},</if>
|
||||||
|
<if test="item.accountGroup != null">ACCT_GRP = #{item.accountGroup},</if>
|
||||||
|
<if test="item.description != null">DSP = #{item.description},</if>
|
||||||
|
<if test="item.centerNumber != null">CTR_NUM = #{item.centerNumber},</if>
|
||||||
|
<if test="item.createDate != null">CRT_DT = #{item.createDate},</if>
|
||||||
|
<if test="item.repairDate != null">RPR_DT = #{item.repairDate},</if>
|
||||||
|
<if test="item.isGiveback != null">IS_GIV = #{item.isGiveback},</if>
|
||||||
|
<if test="item.isProvisional != null">IS_PRVS = #{item.isProvisional},</if>
|
||||||
|
<if test="item.taxNumber != null">TAX_NUM = #{item.taxNumber},</if>
|
||||||
|
</set>
|
||||||
|
WHERE NUM = #{item.downCenterNumber}
|
||||||
|
</foreach>
|
||||||
|
</update>
|
||||||
</mapper>
|
</mapper>
|
||||||
Reference in New Issue
Block a user