fuint-application/application-service/src/main/java/com/fuint/application/service/address/AddressServiceImpl.java

(开头部分) 3KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

package com.fuint.application.service.address;

import com.fuint.application.dao.entities.MtAddress;
import com.fuint.application.dao.repositories.MtAddressRepository;
import com.fuint.base.annoation.OperationServiceLog;
import com.fuint.exception.BusinessCheckException;
import com.fuint.application.enums.StatusEnum;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Sort;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Date;
import java.util.Map;
import java.util.HashMap;

/**
 * 收货地址业务实现类
 * Created by FSQ
 * Contact wx fsq_better
 * Site https://www.fuint.cn
 */
@Service
public class AddressServiceImpl implements AddressService {

    private static final Logger log = LoggerFactory.getLogger(AddressServiceImpl.class);

    @Autowired
    private MtAddressRepository addressRepository;

    /**
     * 保存收货地址
     *
     * @param mtAddress
     * @throws BusinessCheckException
     */
    @Override
    @OperationServiceLog(description = "保存收货地址")
    @Transactional
    public MtAddress saveAddress(MtAddress mtAddress) throws BusinessCheckException {
        if (mtAddress.getId() > 0) {
            MtAddress address = addressRepository.findOne(mtAddress.getId());
            if (StringUtils.isNotEmpty(mtAddress.getName())) {
                address.setName(mtAddress.getName());
            }
            if (StringUtils.isNotEmpty(mtAddress.getMobile())) {
                address.setMobile(mtAddress.getMobile());
            }
            if (StringUtils.isNotEmpty(mtAddress.getDetail())) {
                address.setDetail(mtAddress.getDetail());
            }
            if (StringUtils.isNotEmpty(mtAddress.getIsDefault())) {
                if (mtAddress.getIsDefault().equals("Y")) {
                    addressRepository.setDefault(mtAddress.getUserId(), mtAddress.getId());
                }
                address.setIsDefault(mtAddress.getIsDefault());
后面还有 56 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。