|
@@ -123,7 +123,11 @@ public class AuthProductApi {
|
|
|
*/
|
|
|
@ApiOperation("添加/编辑授权商品")
|
|
|
@PostMapping("/save")
|
|
|
- public ResponseJson saveProduct(@RequestBody ProductSaveDto productSaveDto) throws IOException {
|
|
|
+ public ResponseJson saveProduct(@CurrentUser SysUser sysUser, @RequestBody ProductSaveDto productSaveDto) throws IOException {
|
|
|
+ // 获取创建人用户id
|
|
|
+ Integer userIdentity = sysUser.getUserIdentity();
|
|
|
+ Integer createBy = (2 == userIdentity || 3 == userIdentity) ? sysUser.getId() : null;
|
|
|
+ productSaveDto.setCreateBy(createBy);
|
|
|
return authProductService.saveProduct(productSaveDto);
|
|
|
}
|
|
|
|
|
@@ -165,12 +169,19 @@ public class AuthProductApi {
|
|
|
"invalidReason:审核不通过原因;auditBy:审核人用户id;source:来源:1管理员审核,2供应商审核", required = true)
|
|
|
@Idempotent(prefix = "idempotent_product", keys = {"#params"}, expire = 5)
|
|
|
@PostMapping("/audit")
|
|
|
- public ResponseJson auditProduct(@RequestBody String params) {
|
|
|
+ public ResponseJson auditProduct(@CurrentUser SysUser sysUser, @RequestBody String params) {
|
|
|
+ if (null == sysUser) {
|
|
|
+ return ResponseJson.error("用户信息异常", null);
|
|
|
+ }
|
|
|
+ // 获取审核人用户id
|
|
|
+ Integer auditBy = sysUser.getId();
|
|
|
+ if (null == auditBy) {
|
|
|
+ return ResponseJson.error("审核人用户id不能为空", null);
|
|
|
+ }
|
|
|
JSONObject paramsMap = JSONObject.parseObject(params);
|
|
|
Integer productId = paramsMap.getInteger("productId");
|
|
|
Integer auditStatus = paramsMap.getInteger("auditStatus");
|
|
|
String invalidReason = paramsMap.getString("invalidReason");
|
|
|
- Integer auditBy = paramsMap.getInteger("auditBy");
|
|
|
Integer source = paramsMap.getInteger("source");
|
|
|
return authProductService.auditProduct(productId, auditStatus, invalidReason, auditBy, source);
|
|
|
}
|
|
@@ -232,25 +243,9 @@ public class AuthProductApi {
|
|
|
return authProductService.deleteProductType(productTypeId);
|
|
|
}
|
|
|
|
|
|
- @ApiOperation("更新设备分类状态")
|
|
|
- @ApiImplicitParam(name = "params", value = "productTypeId:设备分类id;status:上线状态:0已下线,1已上线,2待上线", required = true)
|
|
|
- @PostMapping("/type/update/status")
|
|
|
- public ResponseJson updateProductTypeStatus(@RequestBody Map<String,Integer> params) {
|
|
|
- Integer productTypeId = params.get("productTypeId");
|
|
|
- Integer status = params.get("status");
|
|
|
- if (productTypeId == null) {
|
|
|
- return ResponseJson.error("请输入设备分类id");
|
|
|
- }
|
|
|
- if (status == null) {
|
|
|
- return ResponseJson.error("请输入要更新的状态值");
|
|
|
- } else if (status != 0 && status != 1) {
|
|
|
- return ResponseJson.error("状态值只能为0或1");
|
|
|
- }
|
|
|
- return authProductService.updateProductTypeStatus(productTypeId, status);
|
|
|
- }
|
|
|
-
|
|
|
@ApiOperation("设备分类列表")
|
|
|
@ApiImplicitParams({
|
|
|
+ @ApiImplicitParam(name = "authUserId", required = false, value = "供应商用户id"),
|
|
|
@ApiImplicitParam(name = "listType", required = false, value = "列表类型:1设备分类列表,2设备分类审核列表"),
|
|
|
@ApiImplicitParam(name = "name", required = false, value = "设备分类名称"),
|
|
|
@ApiImplicitParam(name = "status", required = false, value = "上线状态:0下线,1上线,2待上线"),
|
|
@@ -259,21 +254,40 @@ public class AuthProductApi {
|
|
|
@ApiImplicitParam(name = "pageSize", required = false, value = "一页多少条")
|
|
|
})
|
|
|
@GetMapping("/type/list")
|
|
|
- public ResponseJson<PageInfo<ProductTypeListVo>> getProductTypeList(@CurrentUser SysUser sysUser, Integer listType, String name, Integer status, Integer auditStatus,
|
|
|
+ public ResponseJson<PageInfo<ProductTypeListVo>> getProductTypeList(@CurrentUser SysUser sysUser, Integer authUserId, Integer listType, String name, Integer status, Integer auditStatus,
|
|
|
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
|
|
|
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
|
|
|
- if (null == sysUser) {
|
|
|
- return ResponseJson.error("用户信息异常", null);
|
|
|
- }
|
|
|
- // 获取供应商用户id
|
|
|
- Integer userIdentity = sysUser.getUserIdentity();
|
|
|
- Integer authUserId = 2 == userIdentity ? sysUser.getId() : 3 == userIdentity ? sysUser.getParentId() : null;
|
|
|
- if (null == authUserId) {
|
|
|
+ // 管理员/供应商公用接口,管理员调用时传authUserId,供应商调用不传
|
|
|
+ if (null != sysUser && 1 != sysUser.getId()) {
|
|
|
+ // 获取供应商用户id
|
|
|
+ Integer userIdentity = sysUser.getUserIdentity();
|
|
|
+ authUserId = 2 == userIdentity ? sysUser.getId() : 3 == userIdentity ? sysUser.getParentId() : null;
|
|
|
+ if (null == authUserId) {
|
|
|
+ return ResponseJson.error("供应商用户id不能为空", null);
|
|
|
+ }
|
|
|
+ } else if (null == authUserId) {
|
|
|
return ResponseJson.error("供应商用户id不能为空", null);
|
|
|
}
|
|
|
return authProductService.getProductTypeList(listType, authUserId, name, status, auditStatus, pageNum, pageSize);
|
|
|
}
|
|
|
|
|
|
+ @ApiOperation("更新设备分类状态")
|
|
|
+ @ApiImplicitParam(name = "params", value = "productTypeId:设备分类id;status:上线状态:0已下线,1已上线,2待上线", required = true)
|
|
|
+ @PostMapping("/type/update/status")
|
|
|
+ public ResponseJson updateProductTypeStatus(@RequestBody Map<String,Integer> params) {
|
|
|
+ Integer productTypeId = params.get("productTypeId");
|
|
|
+ Integer status = params.get("status");
|
|
|
+ if (productTypeId == null) {
|
|
|
+ return ResponseJson.error("请输入设备分类id");
|
|
|
+ }
|
|
|
+ if (status == null) {
|
|
|
+ return ResponseJson.error("请输入要更新的状态值");
|
|
|
+ } else if (status != 0 && status != 1) {
|
|
|
+ return ResponseJson.error("状态值只能为0或1");
|
|
|
+ }
|
|
|
+ return authProductService.updateProductTypeStatus(productTypeId, status);
|
|
|
+ }
|
|
|
+
|
|
|
@ApiOperation("设备分类下拉框列表")
|
|
|
@GetMapping("/type/select")
|
|
|
public ResponseJson<List<ProductTypeListVo>> getProductTypeSelectList(@CurrentUser SysUser sysUser) {
|
|
@@ -292,12 +306,19 @@ public class AuthProductApi {
|
|
|
@ApiOperation("审核设备分类")
|
|
|
@ApiImplicitParam(name = "params", value = "productTypeId:设备分类id;auditStatus:审核状态:0审核未通过,1审核通过,2待审核;invalidReason:审核不通过原因;auditBy:审核人用户id", required = true)
|
|
|
@PostMapping("/type/audit")
|
|
|
- public ResponseJson auditProductType(@RequestBody String params) {
|
|
|
+ public ResponseJson auditProductType(@CurrentUser SysUser sysUser, @RequestBody String params) {
|
|
|
+ if (null == sysUser) {
|
|
|
+ return ResponseJson.error("用户信息异常", null);
|
|
|
+ }
|
|
|
+ // 获取审核人用户id
|
|
|
+ Integer auditBy = sysUser.getId();
|
|
|
+ if (null == auditBy) {
|
|
|
+ return ResponseJson.error("审核人用户id不能为空", null);
|
|
|
+ }
|
|
|
JSONObject paramsMap = JSONObject.parseObject(params);
|
|
|
Integer productTypeId = paramsMap.getInteger("productTypeId");
|
|
|
Integer auditStatus = paramsMap.getInteger("auditStatus");
|
|
|
String invalidReason = paramsMap.getString("invalidReason");
|
|
|
- Integer auditBy = paramsMap.getInteger("auditBy");
|
|
|
if (productTypeId == null) {
|
|
|
return ResponseJson.error("请输入商品id");
|
|
|
}
|
|
@@ -307,15 +328,18 @@ public class AuthProductApi {
|
|
|
if (auditStatus == 0 && StringUtils.isEmpty(invalidReason)) {
|
|
|
return ResponseJson.error("请输入审核不通过的原因");
|
|
|
}
|
|
|
- if (auditBy == null) {
|
|
|
- return ResponseJson.error("请输入审核人用户id");
|
|
|
- }
|
|
|
return authProductService.auditProductType(productTypeId, auditStatus, invalidReason, auditBy);
|
|
|
}
|
|
|
|
|
|
- @ApiOperation("更改查看标记")
|
|
|
+ @ApiOperation("更改设备查看标记")
|
|
|
@PostMapping("/check/{id}")
|
|
|
public ResponseJson checkAuthProduct(@PathVariable("id") Integer productId) {
|
|
|
return authProductService.checkAuthProduct(productId);
|
|
|
}
|
|
|
+
|
|
|
+ @ApiOperation("更改设备分类查看标记")
|
|
|
+ @PostMapping("/type/check/{id}")
|
|
|
+ public ResponseJson checkProductType(@PathVariable("id") Integer productTypeId) {
|
|
|
+ return authProductService.checkProductType(productTypeId);
|
|
|
+ }
|
|
|
}
|