src/main/java/com/mzl/flower/dto/request/customer/QueryCustomerDTO.java
@@ -28,4 +28,7 @@ @ApiModelProperty(hidden = true) private String partnerUserId; @ApiModelProperty("启用/禁用(USER_ENABLED_OR_DISABLED)") private Integer isEnabled; } src/main/java/com/mzl/flower/dto/request/partner/QueryPartnerDTO.java
@@ -34,4 +34,7 @@ @ApiModelProperty(value = "申请时间(yyyy-mm-dd)", hidden = true) private LocalDateTime createDateEnd; @ApiModelProperty("启用/禁用(USER_ENABLED_OR_DISABLED)") private Integer isEnabled; } src/main/java/com/mzl/flower/dto/request/supplier/QuerySupplierDTO.java
@@ -29,4 +29,7 @@ @ApiModelProperty(value = "申请时间(yyyy-mm-dd)", hidden = true) private LocalDateTime createDateEnd; @ApiModelProperty("启用/禁用(USER_ENABLED_OR_DISABLED)") private Integer isEnabled; } src/main/java/com/mzl/flower/dto/response/customer/CustomerDTO.java
@@ -52,4 +52,7 @@ @ApiModelProperty("更新时间") private LocalDateTime updateTime; @ApiModelProperty("启用/禁用") private Boolean isEnabled; } src/main/java/com/mzl/flower/dto/response/partner/PartnerDTO.java
@@ -64,4 +64,7 @@ @ApiModelProperty("更新时间") private LocalDateTime updateTime; @ApiModelProperty("启用/禁用") private Boolean isEnabled; } src/main/java/com/mzl/flower/dto/response/supplier/SupplierDTO.java
@@ -93,4 +93,7 @@ @ApiModelProperty("是否显示商品") private Boolean showed; @ApiModelProperty("启用/禁用") private Boolean isEnabled; } src/main/java/com/mzl/flower/entity/customer/Customer.java
@@ -6,7 +6,6 @@ import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.time.LocalDateTime; @Data @TableName("t_customer_info") @@ -42,4 +41,6 @@ @ApiModelProperty("店铺简介") private String description; @ApiModelProperty("启用/禁用") private Boolean isEnabled; } src/main/java/com/mzl/flower/entity/partner/Partner.java
@@ -53,4 +53,6 @@ @ApiModelProperty("推广二维码-设计后") private String codeUrl; @ApiModelProperty("启用/禁用") private Boolean isEnabled; } src/main/java/com/mzl/flower/entity/supplier/Supplier.java
@@ -70,5 +70,7 @@ @ApiModelProperty("是否显示商品") private Boolean showed; @ApiModelProperty("启用/禁用") private Boolean isEnabled; } src/main/java/com/mzl/flower/service/customer/CustomerService.java
@@ -65,6 +65,7 @@ } customer.create(SecurityUtils.getUserId()); customer.setIsEnabled(true); customerMapper.insert(customer); } else {//重新修改 customer = customerMapper.selectById(dto.getId()); @@ -200,4 +201,17 @@ } return null; } public void isEnable(Long id) { Customer customer = customerMapper.selectById(id); if (customer == null) { throw new ValidationException("商户信息不存在"); } if (customer.getIsEnabled()) { customer.setIsEnabled(false); } else { customer.setIsEnabled(true); } customer.update(SecurityUtils.getUserId()); customerMapper.updateById(customer); } } src/main/java/com/mzl/flower/service/partner/PartnerService.java
@@ -10,6 +10,7 @@ import com.mzl.flower.dto.request.partner.*; import com.mzl.flower.dto.response.partner.PartnerDTO; import com.mzl.flower.entity.partner.Partner; import com.mzl.flower.entity.supplier.Supplier; import com.mzl.flower.mapper.partner.PartnerMapper; import com.mzl.flower.service.UploadService; import com.mzl.flower.utils.DateUtils; @@ -59,6 +60,7 @@ partner.setIdCards(JSON.toJSONString(dto.getIdCards())); partner.create(SecurityUtils.getUserId()); partner.setStatus(PARTNER_STATUS_AUDIT); partner.setIsEnabled(true); partnerMapper.insert(partner); }else{//重新修改 partner = partnerMapper.selectById(dto.getId()); @@ -161,4 +163,18 @@ partner.update(SecurityUtils.getUserId()); partnerMapper.updateById(partner); } public void isEnable(Long id) { Partner partner = partnerMapper.selectById(id); if (partner == null) { throw new ValidationException("合伙人信息不存在"); } if (partner.getIsEnabled()) { partner.setIsEnabled(false); } else { partner.setIsEnabled(true); } partner.update(SecurityUtils.getUserId()); partnerMapper.updateById(partner); } } src/main/java/com/mzl/flower/service/supplier/SupplierService.java
@@ -50,6 +50,7 @@ supplier.create(SecurityUtils.getUserId()); supplier.setShowed(true); supplier.setStatus(SUPPLIER_STATUS_AUDIT); supplier.setIsEnabled(true); supplierMapper.insert(supplier); }else{//重新修改 supplier = supplierMapper.selectById(dto.getId()); @@ -187,4 +188,18 @@ supplier.update(SecurityUtils.getUserId()); supplierMapper.updateById(supplier); } public void isEnable(Long id) { Supplier supplier = supplierMapper.selectById(id); if (supplier == null) { throw new ValidationException("供应商信息不存在"); } if (supplier.getIsEnabled()) { supplier.setIsEnabled(false); } else { supplier.setIsEnabled(true); } supplier.update(SecurityUtils.getUserId()); supplierMapper.updateById(supplier); } } src/main/java/com/mzl/flower/web/customer/CustomerController.java
@@ -4,15 +4,11 @@ import com.mzl.flower.base.BaseController; import com.mzl.flower.base.R; import com.mzl.flower.base.ReturnDataDTO; import com.mzl.flower.config.exception.ValidationException; import com.mzl.flower.config.security.SecurityUtils; import com.mzl.flower.dto.request.customer.BindPartnerDTO; import com.mzl.flower.dto.request.customer.ChangePartnerDTO; import com.mzl.flower.dto.request.customer.QueryCustomerDTO; import com.mzl.flower.dto.request.customer.UpdateCustomerDTO; import com.mzl.flower.dto.request.supplier.AuditSupplierDTO; import com.mzl.flower.dto.request.supplier.QuerySupplierDTO; import com.mzl.flower.dto.request.supplier.UpdateSupplierDTO; import com.mzl.flower.dto.response.customer.CustomerDTO; import com.mzl.flower.dto.response.supplier.SupplierDTO; import com.mzl.flower.service.customer.CustomerService; @@ -24,6 +20,7 @@ import org.springframework.web.bind.annotation.*; import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotNull; @RestController @RequestMapping("/api/customer") @@ -85,4 +82,11 @@ public ResponseEntity<ReturnDataDTO<SupplierDTO>> getPartnerName(@NotBlank(message = "参数不能为空") String id) { return returnData(R.SUCCESS.getCode(),customerService.getPartnerName(id)); } @GetMapping("/page/isEnable") @ApiOperation(value = "启用/禁用", notes = "启用/禁用商品") public ResponseEntity<ReturnDataDTO<String>> isEnable(@NotNull(message = "id不能为空") Long id) { customerService.isEnable(id); return returnData(R.SUCCESS.getCode(),null); } } src/main/java/com/mzl/flower/web/login/CustomerLoginController.java
@@ -14,7 +14,10 @@ import com.mzl.flower.constant.Constants; import com.mzl.flower.dto.request.CreateWechatUserDTO; import com.mzl.flower.dto.request.UserLoginDTO; import com.mzl.flower.dto.response.customer.CustomerDTO; import com.mzl.flower.entity.system.User; import com.mzl.flower.mapper.customer.CustomerMapper; import com.mzl.flower.service.customer.CustomerService; import com.mzl.flower.service.login.LoginService; import com.mzl.flower.service.system.UserService; import com.mzl.flower.service.system.WeChatService; @@ -33,6 +36,7 @@ import org.springframework.security.oauth2.common.OAuth2RefreshToken; import org.springframework.security.oauth2.provider.token.TokenStore; import org.springframework.security.web.authentication.WebAuthenticationDetailsSource; import org.springframework.util.ObjectUtils; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletRequest; @@ -60,6 +64,9 @@ @Autowired private UserService userService; @Autowired private CustomerMapper customerMapper; @Autowired @@ -125,6 +132,13 @@ if(user == null){ throw new ValidationException("用户不存在"); } CustomerDTO currentCustomer = customerMapper.getCurrentCustomer(user.getId()); if (ObjectUtils.isEmpty(currentCustomer)) { throw new ValidationException("用户不存在"); } if (currentCustomer.getIsEnabled() == false) { throw new ValidationException("用户已禁用,请联系管理员"); } String tokenCache = stringCacheClient.get(TOKEN_KEY + SEPARATOR + user.getId()); if (StringUtils.isNotBlank(tokenCache)) { //强制删除token,下线 src/main/java/com/mzl/flower/web/login/PartnerLoginController.java
@@ -11,7 +11,9 @@ import com.mzl.flower.config.security.token.PhoneAuthenticationToken; import com.mzl.flower.constant.Constants; import com.mzl.flower.dto.request.UserLoginDTO; import com.mzl.flower.dto.response.partner.PartnerDTO; import com.mzl.flower.entity.system.User; import com.mzl.flower.mapper.partner.PartnerMapper; import com.mzl.flower.service.login.LoginService; import com.mzl.flower.service.system.UserService; import io.swagger.annotations.Api; @@ -29,6 +31,7 @@ import org.springframework.security.oauth2.common.OAuth2RefreshToken; import org.springframework.security.oauth2.provider.token.TokenStore; import org.springframework.security.web.authentication.WebAuthenticationDetailsSource; import org.springframework.util.ObjectUtils; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; @@ -59,7 +62,8 @@ @Autowired private TokenStore tokenStore; @Autowired private PartnerMapper partnerMapper; public static final String SMS_CODE_KEY = "SMS-CODE-KEY"; public static final String TOKEN_KEY = "TOKEN-KEY"; @@ -82,6 +86,13 @@ if(user == null){ throw new ValidationException("用户不存在"); } PartnerDTO partnerDTO = partnerMapper.getCurrentPartner(user.getId()); if (ObjectUtils.isEmpty(partnerDTO)) { throw new ValidationException("用户不存在"); } if (partnerDTO.getIsEnabled() == false) { throw new ValidationException("用户已禁用,请联系管理员"); } String tokenCache = stringCacheClient.get(TOKEN_KEY + SEPARATOR + user.getId()); if (StringUtils.isNotBlank(tokenCache)) { //强制删除token,下线 src/main/java/com/mzl/flower/web/login/SupplierLoginController.java
@@ -11,7 +11,9 @@ import com.mzl.flower.config.security.token.SupAuthenticationToken; import com.mzl.flower.constant.Constants; import com.mzl.flower.dto.request.UserLoginDTO; import com.mzl.flower.dto.response.supplier.SupplierDTO; import com.mzl.flower.entity.system.User; import com.mzl.flower.mapper.supplier.SupplierMapper; import com.mzl.flower.service.login.LoginService; import com.mzl.flower.service.system.UserService; import io.swagger.annotations.Api; @@ -29,6 +31,7 @@ import org.springframework.security.oauth2.common.OAuth2RefreshToken; import org.springframework.security.oauth2.provider.token.TokenStore; import org.springframework.security.web.authentication.WebAuthenticationDetailsSource; import org.springframework.util.ObjectUtils; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; @@ -59,6 +62,9 @@ @Autowired private TokenStore tokenStore; @Autowired private SupplierMapper supplierMapper; public static final String SMS_CODE_KEY = "SMS-CODE-KEY"; public static final String TOKEN_KEY = "TOKEN-KEY"; @@ -81,6 +87,13 @@ if(user == null){ throw new ValidationException("用户不存在"); } SupplierDTO supplierDTO = supplierMapper.getCurrentSupplier(user.getId()); if (ObjectUtils.isEmpty(supplierDTO)) { throw new ValidationException("用户不存在"); } if (supplierDTO.getIsEnabled() == false) { throw new ValidationException("用户已禁用,请联系管理员"); } String tokenCache = stringCacheClient.get(TOKEN_KEY + SEPARATOR + user.getId()); if (StringUtils.isNotBlank(tokenCache)) { //强制删除token,下线 src/main/java/com/mzl/flower/web/partner/PartnerController.java
@@ -77,4 +77,11 @@ return returnData(R.SUCCESS.getCode(),null); } @GetMapping("/page/isEnable") @ApiOperation(value = "启用/禁用", notes = "启用/禁用商品") public ResponseEntity<ReturnDataDTO<String>> isEnable(@NotNull(message = "id不能为空") Long id) { partnerService.isEnable(id); return returnData(R.SUCCESS.getCode(),null); } } src/main/java/com/mzl/flower/web/supplier/SupplierController.java
@@ -103,4 +103,11 @@ supplierService.configShow(id); return returnData(R.SUCCESS.getCode(),null); } @GetMapping("/page/isEnable") @ApiOperation(value = "启用/禁用", notes = "启用/禁用商品") public ResponseEntity<ReturnDataDTO<String>> isEnable(@NotNull(message = "id不能为空") Long id) { supplierService.isEnable(id); return returnData(R.SUCCESS.getCode(),null); } } src/main/resources/mapper/customer/CustomerMapper.xml
@@ -40,6 +40,9 @@ <if test="dto.partnerUserId != null and dto.partnerUserId != ''"> and c.partner_user_id = #{dto.partnerUserId} </if> <if test="dto.isEnabled!=null"> AND c.is_enabled = #{dto.isEnabled} </if> order by c.create_time desc </select> <select id="getCurrentCustomer" resultType="com.mzl.flower.dto.response.customer.CustomerDTO" src/main/resources/mapper/partner/PartnerMapper.xml
@@ -32,6 +32,9 @@ <if test="dto.region!=null and dto.region!=''"> AND t.region like CONCAT('%',#{dto.region}, '%') </if> <if test="dto.isEnabled!=null"> AND t.is_enabled = #{dto.isEnabled} </if> order by t.create_time desc </select> <select id="getCurrentPartner" resultType="com.mzl.flower.dto.response.partner.PartnerDTO" src/main/resources/mapper/supplier/SupplierMapper.xml
@@ -35,6 +35,9 @@ AND t.create_time <= #{dto.createDateEnd} ]]> </if> <if test="dto.isEnabled!=null"> AND t.is_enabled = #{dto.isEnabled} </if> order by t.create_time desc </select> <select id="findSupplierDetail" resultType="com.mzl.flower.dto.response.supplier.SupplierDTO"