From 461c42ed70eb590af38bbd83396662523f6a0ca0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91=E6=98=8E=E6=A2=81?= <2429105222@qq.com> Date: Wed, 11 Jan 2023 15:01:25 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=A7=E5=93=81=E4=BF=A1=E6=81=AF=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E5=AE=9E=E4=BD=93=E7=B1=BB=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../thrsys/ThrProductsController.java | 12 +++++ .../api/service/auth/CustomerService.java | 7 +++ .../mybatis/mapper/thrsys/ThrProductsDao.xml | 44 +++---------------- 3 files changed, 24 insertions(+), 39 deletions(-) diff --git a/src/main/java/com/glxp/api/controller/thrsys/ThrProductsController.java b/src/main/java/com/glxp/api/controller/thrsys/ThrProductsController.java index f48dd40d9..4f868a438 100644 --- a/src/main/java/com/glxp/api/controller/thrsys/ThrProductsController.java +++ b/src/main/java/com/glxp/api/controller/thrsys/ThrProductsController.java @@ -8,6 +8,7 @@ import com.glxp.api.annotation.AuthRuleAnnotation; 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.auth.AuthAdmin; import com.glxp.api.entity.basic.BasicThirdSysDetailEntity; import com.glxp.api.entity.basic.BasicThirdSysEntity; import com.glxp.api.entity.thrsys.ThrProductsEntity; @@ -17,6 +18,7 @@ import com.glxp.api.req.thrsys.FilterThrProductsRequest; import com.glxp.api.req.thrsys.ThrProductsRequest; import com.glxp.api.res.PageSimpleResponse; import com.glxp.api.res.thrsys.ThrProductsResponse; +import com.glxp.api.service.auth.CustomerService; import com.glxp.api.service.basic.BasicThirdSysDetailService; import com.glxp.api.service.thrsys.ThrProductsService; import org.springframework.beans.BeanUtils; @@ -47,6 +49,9 @@ public class ThrProductsController { @Resource private ErpBasicClient erpBasicClient; + @Resource + private CustomerService customerService; + //获取ERP产品信息 @AuthRuleAnnotation("") @@ -162,9 +167,16 @@ public class ThrProductsController { @AuthRuleAnnotation("") @PostMapping("/udiwms/udiinfo/erp/products/saveProduct") public BaseResponse saveProduct(@RequestBody ThrProductsEntity thrProductsEntity) { + + + if (null == thrProductsEntity) return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL); + + thrProductsEntity.setUpdateUser(customerService.getUserName()); + thrProductsEntity.setCreateUser(customerService.getUserName()); thrProductsEntity.setUpdateTime(new Date()); + thrProductsEntity.setCreateTime(new Date()); thrProductsService.insertThrProducts(thrProductsEntity); diff --git a/src/main/java/com/glxp/api/service/auth/CustomerService.java b/src/main/java/com/glxp/api/service/auth/CustomerService.java index cbfe4334b..07b485c22 100644 --- a/src/main/java/com/glxp/api/service/auth/CustomerService.java +++ b/src/main/java/com/glxp/api/service/auth/CustomerService.java @@ -8,6 +8,7 @@ import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.ServletRequestAttributes; import javax.annotation.Resource; +import javax.naming.Name; import javax.servlet.http.HttpServletRequest; @Service @@ -33,4 +34,10 @@ public class CustomerService { return Integer.parseInt(userId); } + public String getUserName() { + Integer userId = getUserId(); + AuthAdmin authAdmin = authAdminService.findById(userId.longValue()); + return authAdmin.getUserName(); + } + } diff --git a/src/main/resources/mybatis/mapper/thrsys/ThrProductsDao.xml b/src/main/resources/mybatis/mapper/thrsys/ThrProductsDao.xml index e28759837..dad0b8d16 100644 --- a/src/main/resources/mybatis/mapper/thrsys/ThrProductsDao.xml +++ b/src/main/resources/mybatis/mapper/thrsys/ThrProductsDao.xml @@ -2,43 +2,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - id, code, name, measname, spec, registerNo, manufactory, thirdSysFk, cplb, flbm, qxlb, ybbm, sptm, tyshxydm, zczbhhzbapzbh, ylqxzcrbarmc, ylqxzcrbarywmc, cpms, updateTime, supName, model, standard, qtbm, zczyxqz, remark, remark1, remark2, remark3, price -