From 96a020c6bc4f03cb27e70ceeb647fb8f53580757 Mon Sep 17 00:00:00 2001 From: x_z Date: Tue, 10 Jan 2023 17:54:38 +0800 Subject: [PATCH 1/2] =?UTF-8?q?1.=E6=B7=BB=E5=8A=A0=E7=AC=AC=E4=B8=89?= =?UTF-8?q?=E6=96=B9=E5=8D=95=E6=8D=AE=E7=B1=BB=E5=9E=8B=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../basic/BasicBusTypePreController.java | 7 +- .../thrsys/ThrBusTypeOriginController.java | 196 ++++++++++++++++++ .../api/dao/thrsys/ThrBusTypeOriginDao.java | 27 +++ .../com/glxp/api/http/ErpBasicClient.java | 8 +- .../req/basic/FilterBusTypePreRequest.java | 8 + .../thrsys/FilterThrBusTypeOriginRequest.java | 52 ++++- .../thrsys/IThrBusTypeOriginService.java | 75 +++++++ .../impl/ThrBusTypeOriginServiceImpl.java | 93 +++++++++ .../mapper/thrsys/ThrBusTypeOriginDao.xml | 72 +++++++ 9 files changed, 534 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/glxp/api/controller/basic/BasicBusTypePreController.java b/src/main/java/com/glxp/api/controller/basic/BasicBusTypePreController.java index 5370e4a2..8578cf1a 100644 --- a/src/main/java/com/glxp/api/controller/basic/BasicBusTypePreController.java +++ b/src/main/java/com/glxp/api/controller/basic/BasicBusTypePreController.java @@ -10,6 +10,7 @@ import com.glxp.api.req.basic.FilterBusTypeChangeRequest; import com.glxp.api.req.basic.FilterBusTypePreRequest; import com.glxp.api.req.system.DeleteRequest; import com.glxp.api.res.PageSimpleResponse; +import com.glxp.api.service.auth.InvWarehouseService; import com.glxp.api.service.basic.IBasicBusTypePreService; import lombok.extern.slf4j.Slf4j; import org.springframework.validation.BindingResult; @@ -30,6 +31,8 @@ public class BasicBusTypePreController { @Resource private IBasicBusTypePreService basicBusTypePreService; + @Resource + private InvWarehouseService invWarehouseService; @GetMapping("/spms/bussinessChangeType/filter") @@ -100,14 +103,14 @@ public class BasicBusTypePreController { } /*if (basicBusTypePreEntity != null) { if (StrUtil.isNotEmpty(basicBusTypePreEntity.getDefaultSubInv())) { - InvSubWarehouseEntity invSubWarehouseEntity = invSubWarehouseService.findByInvSubByCode(basicBusTypePreEntity.getDefaultSubInv()); + InvWarehouseEntity byInvSubByCode = invWarehouseService.findByInvSubByCode(basicBusTypePreEntity.getDefaultSubInv()); basicBusTypePreEntity.setDefaultInv(invSubWarehouseEntity.getParentId()); } if (StrUtil.isNotEmpty(basicBusTypePreEntity.getLocSubInv())) { InvSubWarehouseEntity invSubWarehouseEntity = invSubWarehouseService.findByInvSubByCode(basicBusTypePreEntity.getLocSubInv()); basicBusTypePreEntity.setLocInv(invSubWarehouseEntity.getParentId()); } - bussinessChangeTypeService.insertBusChangeTypee(basicBusTypePreEntity); + basicBusTypePreService.insertBusChangeTypee(basicBusTypePreEntity); } else { ResultVOUtils.error(999, "参数错误"); }*/ diff --git a/src/main/java/com/glxp/api/controller/thrsys/ThrBusTypeOriginController.java b/src/main/java/com/glxp/api/controller/thrsys/ThrBusTypeOriginController.java index 4fa59c7c..9e9f3c7e 100644 --- a/src/main/java/com/glxp/api/controller/thrsys/ThrBusTypeOriginController.java +++ b/src/main/java/com/glxp/api/controller/thrsys/ThrBusTypeOriginController.java @@ -1,8 +1,34 @@ package com.glxp.api.controller.thrsys; +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.StrUtil; +import com.github.pagehelper.PageInfo; +import com.glxp.api.common.enums.ResultEnum; +import com.glxp.api.common.res.BaseResponse; +import com.glxp.api.common.util.ResultVOUtils; +import com.glxp.api.entity.thrsys.ThrBusTypeOriginEntity; +import com.glxp.api.entity.thrsys.ThrSystemBusApiEntity; +import com.glxp.api.entity.thrsys.ThrSystemEntity; +import com.glxp.api.http.ErpBasicClient; +import com.glxp.api.req.system.DeleteRequest; +import com.glxp.api.req.thrsys.FilterBasicThirdSysDetailRequest; +import com.glxp.api.req.thrsys.FilterThrBusTypeOriginRequest; +import com.glxp.api.res.PageSimpleResponse; +import com.glxp.api.res.thrsys.ThrBusTypeOriginResponse; +import com.glxp.api.service.thrsys.IThrBusTypeOriginService; +import com.glxp.api.service.thrsys.ThrSystemService; import lombok.extern.slf4j.Slf4j; +import org.springframework.validation.BindingResult; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RestController; +import javax.annotation.Resource; +import javax.validation.Valid; +import java.util.Date; +import java.util.List; + /** * 第三方单据类型接口 */ @@ -10,6 +36,176 @@ import org.springframework.web.bind.annotation.RestController; @RestController public class ThrBusTypeOriginController { + @Resource + private IThrBusTypeOriginService thrBusTypeOriginService; + @Resource + private ThrSystemService thrSystemService; + @Resource + private ErpBasicClient erpBasicClient; + + /** + * 查询第三方单据类型 + * + * @param filterThrBusTypeOriginRequest + * @param bindingResult + * @return + */ + @GetMapping("/udiwms/originBusType/filter") + public BaseResponse filterList(FilterThrBusTypeOriginRequest filterThrBusTypeOriginRequest, + BindingResult bindingResult) { + if (bindingResult.hasErrors()) { + return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage()); + } + if (filterThrBusTypeOriginRequest.isOnlyMain()) { + ThrSystemEntity thrSystemEntity = thrSystemService.selectMainThrSys(); + filterThrBusTypeOriginRequest.setThirdSys(thrSystemEntity.getThirdId()); + } else if (StrUtil.isEmpty(filterThrBusTypeOriginRequest.getThirdSys())) { + ThrSystemEntity thrSystemEntity = thrSystemService.selectMainThrSys(); + filterThrBusTypeOriginRequest.setThirdSys(thrSystemEntity.getThirdId()); + } + List thrBusTypeOriginEntities = thrBusTypeOriginService.filterEnableList(filterThrBusTypeOriginRequest); + PageInfo pageInfo = new PageInfo<>(thrBusTypeOriginEntities); + return ResultVOUtils.page(pageInfo); + } + + /** + * 关联查询第三方单据类型 + * + * @param filterThrBusTypeOriginRequest + * @param bindingResult + * @return + */ + @GetMapping("/udiwms/originBusType/filterJoin") + public BaseResponse filterJoinList(FilterThrBusTypeOriginRequest filterThrBusTypeOriginRequest, + BindingResult bindingResult) { + if (bindingResult.hasErrors()) { + return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage()); + } + List list = thrBusTypeOriginService.filterJoinList(filterThrBusTypeOriginRequest); + PageInfo pageInfo = new PageInfo<>(list); + return ResultVOUtils.page(pageInfo); + } + + /** + * 更新第三方单据类型 + * + * @param thrBusTypeOriginEntity + * @param bindingResult + * @return + */ + @PostMapping("/udiwms/originBusType/update") + public BaseResponse updateBussinessType(@RequestBody @Valid ThrBusTypeOriginEntity thrBusTypeOriginEntity, + BindingResult bindingResult) { + + if (bindingResult.hasErrors()) { + return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage()); + } + if (thrBusTypeOriginEntity != null) { + //校验单据类型代码是否重复 + boolean exists = thrBusTypeOriginService.checkActionExists(thrBusTypeOriginEntity.getAction(), thrBusTypeOriginEntity.getThirdSys()); + if (exists) { + return ResultVOUtils.error(500, "单据类型已存在!"); + } + thrBusTypeOriginService.updateBusOriginType(thrBusTypeOriginEntity); + } else { + ResultVOUtils.error(999, "参数错误"); + } + return ResultVOUtils.success("更新成功"); + } + + /** + * 新增第三方单据类型 + * + * @param thrBusTypeOriginEntity + * @param bindingResult + * @return + */ + @PostMapping("/udiwms/originBusType/add") + public BaseResponse addBussinessType(@RequestBody ThrBusTypeOriginEntity thrBusTypeOriginEntity, + BindingResult bindingResult) { + if (bindingResult.hasErrors()) { + return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage()); + } + if (thrBusTypeOriginEntity != null) { + boolean exists = thrBusTypeOriginService.checkActionExists(thrBusTypeOriginEntity.getAction(), thrBusTypeOriginEntity.getThirdSys()); + if (exists) { + return ResultVOUtils.error(500, "单据类型已存在!"); + } + thrBusTypeOriginService.insertBusOriginType(thrBusTypeOriginEntity); + } else { + return ResultVOUtils.error(999, "参数错误"); + } + return ResultVOUtils.success("更新成功"); + } + + /** + * 删除第三方单据类型 + * + * @param deleteRequest + * @param bindingResult + * @return + */ + @PostMapping("/udiwms/originBusType/delete") + public BaseResponse delBussinessType(@RequestBody DeleteRequest deleteRequest, BindingResult bindingResult) { + if (bindingResult.hasErrors()) { + return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage()); + } + if (deleteRequest != null) { + thrBusTypeOriginService.deleteById(deleteRequest.getId()); + } else { + return ResultVOUtils.error(999, "参数错误"); + } + return ResultVOUtils.success("更新成功"); + } + + /** + * 下载第三方单据类型 + * + * @param filterThrBusTypeOriginRequest + * @param bindingResult + * @return + */ + @PostMapping("/udiwms/originBusType/download") + public BaseResponse dlBusType(@RequestBody @Valid FilterThrBusTypeOriginRequest filterThrBusTypeOriginRequest, + BindingResult bindingResult) { + if (bindingResult.hasErrors()) { + return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage()); + } + FilterBasicThirdSysDetailRequest filterBasicThirdSysDetailRequest = new FilterBasicThirdSysDetailRequest(); + filterBasicThirdSysDetailRequest.setThirdSysFk(filterThrBusTypeOriginRequest.getThirdSys()); + int page = 1; + int limit = 100; + while (true) { + filterBasicThirdSysDetailRequest.setPage(page); + filterBasicThirdSysDetailRequest.setLimit(limit); + BaseResponse> baseResponse = erpBasicClient.getBusTypes(filterBasicThirdSysDetailRequest); + if (baseResponse != null && baseResponse.getCode() == 20000) { + List thrSystemBusApiList = baseResponse.getData().getList(); + if (CollUtil.isNotEmpty(thrSystemBusApiList)) { + for (ThrSystemBusApiEntity basicThirdSysBusApiEntity : thrSystemBusApiList) { + ThrBusTypeOriginEntity thrBusTypeOriginEntity = new ThrBusTypeOriginEntity(); + thrBusTypeOriginEntity.setName(basicThirdSysBusApiEntity.getName()); + thrBusTypeOriginEntity.setAction(basicThirdSysBusApiEntity.getCode()); + thrBusTypeOriginEntity.setThirdSys(filterThrBusTypeOriginRequest.getThirdSys()); + thrBusTypeOriginEntity.setInoutType(basicThirdSysBusApiEntity.getInoutType()); + thrBusTypeOriginEntity.setRemark(basicThirdSysBusApiEntity.getRemark()); + thrBusTypeOriginEntity.setEnable(true); + thrBusTypeOriginEntity.setUpdateTime(new Date()); + thrBusTypeOriginService.insertBusOriginType(thrBusTypeOriginEntity); + } + if (thrSystemBusApiList.size() >= 100) { + page++; + } else + break; + } else { + break; + } + } else { + return baseResponse; + } + } + return ResultVOUtils.success("下载成功"); + } } diff --git a/src/main/java/com/glxp/api/dao/thrsys/ThrBusTypeOriginDao.java b/src/main/java/com/glxp/api/dao/thrsys/ThrBusTypeOriginDao.java index 4f44e924..3882a682 100644 --- a/src/main/java/com/glxp/api/dao/thrsys/ThrBusTypeOriginDao.java +++ b/src/main/java/com/glxp/api/dao/thrsys/ThrBusTypeOriginDao.java @@ -2,12 +2,39 @@ package com.glxp.api.dao.thrsys; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.glxp.api.entity.thrsys.ThrBusTypeOriginEntity; +import com.glxp.api.req.thrsys.FilterThrBusTypeOriginRequest; +import com.glxp.api.res.thrsys.ThrBusTypeOriginResponse; import org.apache.ibatis.annotations.Mapper; +import java.util.List; + /** * 第三方单据类型表查询接口 */ @Mapper public interface ThrBusTypeOriginDao extends BaseMapper { + /** + * 查询第三方单据类型列表 + * + * @param filterThrBusTypeOriginRequest + * @return + */ + List filterEnableList(FilterThrBusTypeOriginRequest filterThrBusTypeOriginRequest); + + /** + * 联合查询第三方单据类型 + * + * @param filterThrBusTypeOriginRequest + * @return + */ + List filterJoinList(FilterThrBusTypeOriginRequest filterThrBusTypeOriginRequest); + + /** + * 新增第三方单据类型 + * + * @param thrBusTypeOriginEntity + * @return + */ + boolean insertBusOriginType(ThrBusTypeOriginEntity thrBusTypeOriginEntity); } \ No newline at end of file diff --git a/src/main/java/com/glxp/api/http/ErpBasicClient.java b/src/main/java/com/glxp/api/http/ErpBasicClient.java index 7bac156d..a665bcc7 100644 --- a/src/main/java/com/glxp/api/http/ErpBasicClient.java +++ b/src/main/java/com/glxp/api/http/ErpBasicClient.java @@ -4,7 +4,10 @@ import cn.hutool.core.util.StrUtil; import com.alibaba.fastjson.JSONObject; import com.glxp.api.common.res.BaseResponse; import com.glxp.api.common.util.ResultVOUtils; +import com.glxp.api.entity.thrsys.ThrSystemBusApiEntity; import com.glxp.api.entity.thrsys.ThrSystemEntity; +import com.glxp.api.req.thrsys.FilterBasicThirdSysDetailRequest; +import com.glxp.api.res.PageSimpleResponse; import com.glxp.api.service.thrsys.ThrSystemService; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; @@ -127,5 +130,8 @@ public class ErpBasicClient { } } - + //下载第三方系统单据类型 + public BaseResponse> getBusTypes(FilterBasicThirdSysDetailRequest filterBasicThirdSysDetailRequest) { + return null; + } } diff --git a/src/main/java/com/glxp/api/req/basic/FilterBusTypePreRequest.java b/src/main/java/com/glxp/api/req/basic/FilterBusTypePreRequest.java index eb62f18c..c7d3decb 100644 --- a/src/main/java/com/glxp/api/req/basic/FilterBusTypePreRequest.java +++ b/src/main/java/com/glxp/api/req/basic/FilterBusTypePreRequest.java @@ -9,6 +9,14 @@ import lombok.Data; @Data public class FilterBusTypePreRequest extends ListPageRequest { + /** + * 单据类型编码 + */ + private String action; + /** + * 第三方单据类型编码 + */ + private String thirdAction; } diff --git a/src/main/java/com/glxp/api/req/thrsys/FilterThrBusTypeOriginRequest.java b/src/main/java/com/glxp/api/req/thrsys/FilterThrBusTypeOriginRequest.java index 408932dc..016fc374 100644 --- a/src/main/java/com/glxp/api/req/thrsys/FilterThrBusTypeOriginRequest.java +++ b/src/main/java/com/glxp/api/req/thrsys/FilterThrBusTypeOriginRequest.java @@ -10,13 +10,63 @@ import lombok.Data; public class FilterThrBusTypeOriginRequest extends ListPageRequest { /** - * 单据类型编码 + * 第三方单据类型编码 */ private String action; + /** + * 第三方单据类型名称 + */ + private String name; + + /** + * 第三方系统标识 + */ + private String thirdSys; + + /** + * 第三方系统名称 + */ + private String thirdSysName; + + /** + * 是否启用 + */ + private Boolean enable; + /** * 第三方单据类型编码 */ private String thirdAction; + /** + * 进出库类型 + */ + private String mainAction; + + /** + * 单据类型编码 + */ + private String busAction; + + /** + * 上一次更新时间 + */ + private String lastUpdateTime; + + /** + * 往来单位类型 + */ + private Integer corpType; + + /** + * 查询关键字 + */ + private String key; + + /** + * 是否是主系统 + */ + private boolean onlyMain; + } diff --git a/src/main/java/com/glxp/api/service/thrsys/IThrBusTypeOriginService.java b/src/main/java/com/glxp/api/service/thrsys/IThrBusTypeOriginService.java index 2c21072f..6321c85f 100644 --- a/src/main/java/com/glxp/api/service/thrsys/IThrBusTypeOriginService.java +++ b/src/main/java/com/glxp/api/service/thrsys/IThrBusTypeOriginService.java @@ -1,7 +1,82 @@ package com.glxp.api.service.thrsys; +import com.glxp.api.entity.thrsys.ThrBusTypeOriginEntity; +import com.glxp.api.entity.thrsys.ThrSystemDetailEntity; +import com.glxp.api.req.thrsys.FilterThrBusTypeOriginRequest; +import com.glxp.api.res.thrsys.ThrBusTypeOriginResponse; + +import java.util.List; + /** * 第三方单据类型Service */ public interface IThrBusTypeOriginService { + + /** + * 查询启用的第三方单据类型列表 + * + * @param filterThrBusTypeOriginRequest + * @return + */ + List filterEnableList(FilterThrBusTypeOriginRequest filterThrBusTypeOriginRequest); + + /** + * 关联查询第三方单据类型列表 + * + * @param filterThrBusTypeOriginRequest + * @return + */ + List filterJoinList(FilterThrBusTypeOriginRequest filterThrBusTypeOriginRequest); + + /** + * 新增第三方单据类型 + * + * @param thrBusTypeOriginEntity + */ + boolean insertBusOriginType(ThrBusTypeOriginEntity thrBusTypeOriginEntity); + + /** + * 删除第三方单据类型 + * + * @param id + * @return + */ + boolean deleteById(String id); + + /** + * 校验第三方单据类型是否存在 + * + * @param action + * @param thirdSys + * @return + */ + boolean checkActionExists(String action, String thirdSys); + + /** + * 更新第三方单据类型 + * + * @param thrBusTypeOriginEntity + * @return + */ + boolean updateBusOriginType(ThrBusTypeOriginEntity thrBusTypeOriginEntity); + + /** + * 根据单据类型编码查询第三方单据类型 + * + * @param action + * @return + */ + ThrBusTypeOriginEntity findByAction(String action); + + /** + * 根据单据类型编码查询第三方系统详情 + * + * @param action + * @param key + * @return + */ + ThrSystemDetailEntity findSysByAction(String action, String key); + + //ThrBusTypeOriginResponse findByThirdAction + } diff --git a/src/main/java/com/glxp/api/service/thrsys/impl/ThrBusTypeOriginServiceImpl.java b/src/main/java/com/glxp/api/service/thrsys/impl/ThrBusTypeOriginServiceImpl.java index 00e65df2..0894ab7a 100644 --- a/src/main/java/com/glxp/api/service/thrsys/impl/ThrBusTypeOriginServiceImpl.java +++ b/src/main/java/com/glxp/api/service/thrsys/impl/ThrBusTypeOriginServiceImpl.java @@ -1,12 +1,105 @@ package com.glxp.api.service.thrsys.impl; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.github.pagehelper.PageHelper; +import com.glxp.api.dao.thrsys.ThrBusTypeOriginDao; +import com.glxp.api.entity.thrsys.ThrBusTypeOriginEntity; +import com.glxp.api.entity.thrsys.ThrSystemDetailEntity; +import com.glxp.api.req.thrsys.FilterThrBusTypeOriginRequest; +import com.glxp.api.res.thrsys.ThrBusTypeOriginResponse; +import com.glxp.api.service.auth.CustomerService; import com.glxp.api.service.thrsys.IThrBusTypeOriginService; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import javax.annotation.Resource; +import java.util.Collections; +import java.util.Date; +import java.util.List; + @Slf4j @Service @Transactional(rollbackFor = Exception.class) public class ThrBusTypeOriginServiceImpl implements IThrBusTypeOriginService { + + @Resource + private CustomerService customerService; + @Resource + private ThrBusTypeOriginDao thrBusTypeOriginDao; + + @Override + public List filterEnableList(FilterThrBusTypeOriginRequest filterThrBusTypeOriginRequest) { + if (null != filterThrBusTypeOriginRequest.getPage() && null != filterThrBusTypeOriginRequest.getLimit()) { + PageHelper.offsetPage((filterThrBusTypeOriginRequest.getPage() - 1) * filterThrBusTypeOriginRequest.getLimit(), filterThrBusTypeOriginRequest.getLimit()); + } + return thrBusTypeOriginDao.filterEnableList(filterThrBusTypeOriginRequest); + } + + @Override + public List filterJoinList(FilterThrBusTypeOriginRequest filterThrBusTypeOriginRequest) { + if (null == filterThrBusTypeOriginRequest) { + return Collections.emptyList(); + } + if (null != filterThrBusTypeOriginRequest.getPage() && null != filterThrBusTypeOriginRequest.getLimit()) { + PageHelper.offsetPage((filterThrBusTypeOriginRequest.getPage() - 1) * filterThrBusTypeOriginRequest.getLimit(), filterThrBusTypeOriginRequest.getLimit()); + } + return thrBusTypeOriginDao.filterJoinList(filterThrBusTypeOriginRequest); + } + + @Override + public boolean insertBusOriginType(ThrBusTypeOriginEntity thrBusTypeOriginEntity) { + //设置创建信息 + setUpdateInfo(thrBusTypeOriginEntity); + return thrBusTypeOriginDao.insertBusOriginType(thrBusTypeOriginEntity); + } + + @Override + public boolean deleteById(String id) { + return thrBusTypeOriginDao.deleteById(id) != 0; + } + + @Override + public boolean checkActionExists(String action, String thirdSys) { + Long count = thrBusTypeOriginDao.selectCount(new QueryWrapper().eq("action", action).eq("thirdSys", thirdSys)); + if (count > 0) { + return true; + } + return false; + } + + @Override + public boolean updateBusOriginType(ThrBusTypeOriginEntity thrBusTypeOriginEntity) { + //设置更新信息 + setUpdateInfo(thrBusTypeOriginEntity); + thrBusTypeOriginEntity.setEnable(true); + return thrBusTypeOriginDao.updateById(thrBusTypeOriginEntity) != 0; + } + + @Override + public ThrBusTypeOriginEntity findByAction(String action) { + return null; + } + + @Override + public ThrSystemDetailEntity findSysByAction(String action, String key) { + return null; + } + + /** + * 设置创建/更新信息 + * + * @param thrBusTypeOriginEntity + */ + private void setUpdateInfo(ThrBusTypeOriginEntity thrBusTypeOriginEntity) { + Date now = new Date(); + String userId = String.valueOf(customerService.getUserId()); + if (null == thrBusTypeOriginEntity.getId()) { + thrBusTypeOriginEntity.setCreateUser(userId); + thrBusTypeOriginEntity.setCreateTime(now); + } + thrBusTypeOriginEntity.setUpdateUser(userId); + thrBusTypeOriginEntity.setUpdateTime(now); + } + } diff --git a/src/main/resources/mybatis/mapper/thrsys/ThrBusTypeOriginDao.xml b/src/main/resources/mybatis/mapper/thrsys/ThrBusTypeOriginDao.xml index bbaae311..988d80d8 100644 --- a/src/main/resources/mybatis/mapper/thrsys/ThrBusTypeOriginDao.xml +++ b/src/main/resources/mybatis/mapper/thrsys/ThrBusTypeOriginDao.xml @@ -1,5 +1,77 @@ + + + + + replace into thr_bustype_origin + (`name`, `action`, thirdSys, thirdSysName, `enable`, inoutType, updateTime, remark, createUser, updateUser, + createTime) + values (#{name}, + #{action}, + #{thirdSys}, + #{thirdSysName}, + #{enable}, + #{inoutType}, + #{updateTime}, + #{remark}, + #{createUser}, + #{updateUser}, + #{createTime}) + \ No newline at end of file From 4a058dc0fff021c84027b84aa8fe2dd642bfed28 Mon Sep 17 00:00:00 2001 From: anthonywj Date: Wed, 11 Jan 2023 09:19:12 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=9D=83=E9=99=90=E7=9B=B8=E5=85=B3bug?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/glxp/api/controller/auth/SysRoleController.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/glxp/api/controller/auth/SysRoleController.java b/src/main/java/com/glxp/api/controller/auth/SysRoleController.java index bbfae2a4..fcfabef9 100644 --- a/src/main/java/com/glxp/api/controller/auth/SysRoleController.java +++ b/src/main/java/com/glxp/api/controller/auth/SysRoleController.java @@ -21,6 +21,7 @@ import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import java.util.Date; import java.util.List; +import java.util.UUID; @Validated @RequiredArgsConstructor @@ -64,7 +65,7 @@ public class SysRoleController extends BaseController { */ @PostMapping public BaseResponse add(@Validated @RequestBody SysRole role) { - + role.setRoleKey(UUID.randomUUID() + ""); if (Constant.NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role))) { return ResultVOUtils.error(500, "新增角色'" + role.getRoleName() + "'失败,角色名称已存在"); } else if (Constant.NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role))) {