skyouc
6 天以前 5f13213af588444a59d0b3725f3d028cbdaffca4
rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/CompanysController.java
@@ -13,8 +13,11 @@
import com.vincent.rsf.server.manager.entity.Companys;
import com.vincent.rsf.server.manager.entity.Warehouse;
import com.vincent.rsf.server.manager.service.CompanysService;
import com.vincent.rsf.server.system.constant.SerialRuleCode;
import com.vincent.rsf.server.system.controller.BaseController;
import com.vincent.rsf.server.system.utils.SerialRuleUtils;
import io.swagger.annotations.Api;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
@@ -85,6 +88,13 @@
        companys.setCreateBy(getLoginUserId());
        companys.setUpdateBy(getLoginUserId());
        if (StringUtils.isNotBlank(companys.getCode())) {
            String ruleCode = SerialRuleUtils.generateRuleCode(SerialRuleCode.SYS_COMPANYS_CODE, companys);
            if (StringUtils.isBlank(ruleCode)) {
                throw new CoolException("编码规则错误:请检查「SYS_COMPANYS_CODE」是否设置完成!!");
            }
            companys.setCode(ruleCode);
        }
        if (!companysService.save(companys)) {
            return R.error("Save Fail");
        }