| | |
| | | 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.BaseService; |
| | | import com.mzl.flower.service.UploadService; |
| | | import com.mzl.flower.utils.DateUtils; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.io.File; |
| | | import java.io.FileInputStream; |
| | | import java.io.InputStream; |
| | |
| | | |
| | | private final UploadService uploadService; |
| | | |
| | | @Resource |
| | | private BaseService baseService; |
| | | |
| | | public PartnerService(PartnerMapper partnerMapper, WxMaService maService, UploadService uploadService) { |
| | | this.partnerMapper = partnerMapper; |
| | | this.maService = maService; |
| | |
| | | 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()); |
| | |
| | | partner.setProvince(dto.getProvince()); |
| | | partner.setCity(dto.getCity()); |
| | | partner.setRegion(dto.getRegion()); |
| | | if(StringUtils.isNotBlank(dto.getName())){ |
| | | partner.setName(dto.getName()); |
| | | } |
| | | if(StringUtils.isNotBlank(dto.getContactTel())){ |
| | | partner.setContactTel(dto.getContactTel()); |
| | | } |
| | | partner.update(SecurityUtils.getUserId()); |
| | | partnerMapper.updateById(partner); |
| | | } |
| | |
| | | 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); |
| | | //强制下线 |
| | | baseService.removeToken(partner.getUserId()); |
| | | } else { |
| | | partner.setIsEnabled(true); |
| | | } |
| | | partner.update(SecurityUtils.getUserId()); |
| | | partnerMapper.updateById(partner); |
| | | } |
| | | } |