Prechádzať zdrojové kódy

Merge branch 'dev' of http://192.168.1.220:10080/jiwei/wlyy2.0 into dev

yeshijie 6 rokov pred
rodič
commit
95a08b991f

+ 11 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/saas/SaasDO.java

@ -52,6 +52,8 @@ public class SaasDO extends UuidIdentityEntityWithOperator {
    List<BaseOrgDO> orgList;
    //业务模块
    List<SaasModuleDO> saasModuleList;
    //主题风格
    List<SaasThemeDO> saasThemeList;
	@Column(name = "name", nullable = false, length = 200)
	public String getName() {
@ -205,4 +207,13 @@ public class SaasDO extends UuidIdentityEntityWithOperator {
    public void setThemeColor(String themeColor) {
        this.themeColor = themeColor;
    }
    @Transient
    public List<SaasThemeDO> getSaasThemeList() {
        return saasThemeList;
    }
    public void setSaasThemeList(List<SaasThemeDO> saasThemeList) {
        this.saasThemeList = saasThemeList;
    }
}

+ 10 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/saas/SaasVO.java

@ -56,6 +56,8 @@ public class SaasVO extends UuidIdentityVOWithOperator {
	List<BaseOrgVO> orgList;
	@ApiModelProperty(value = "业务模块", example = "业务模块")
	List<SaasModuleVO> saasModuleList;
	@ApiModelProperty(value = "主题风格", example = "主题风格")
	List<SaasThemeVO> saasThemeList;
	public String getOrgCode() {
@ -209,4 +211,12 @@ public class SaasVO extends UuidIdentityVOWithOperator {
	public void setThemeColor(String themeColor) {
		this.themeColor = themeColor;
	}
	public List<SaasThemeVO> getSaasThemeList() {
		return saasThemeList;
	}
	public void setSaasThemeList(List<SaasThemeVO> saasThemeList) {
		this.saasThemeList = saasThemeList;
	}
}

+ 8 - 5
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/saas/SaasEndpoint.java

@ -45,10 +45,14 @@ public class SaasEndpoint extends EnvelopRestEndpoint {
    @PostMapping(value = BaseRequestMapping.Saas.CREATE, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "创建-基本信息")
    public Envelop create (
            @ApiParam(name = "saasDO", value = "Json数据", required = true)
            @RequestParam(value = "saasDO") SaasDO saasDO,
            @ApiParam(name = "userDO", value = "Json数据", required = true)
            @RequestParam(value = "userDO") UserDO userDO) throws Exception {
            @ApiParam(name = "jsonSaas", value = "租户数据", required = true)
            @RequestParam String jsonSaas) throws Exception {
        SaasDO saasDO = toEntity(jsonSaas, SaasDO.class);
        UserDO userDO = new UserDO();
        userDO.setEmail(saasDO.getEmail());
        userDO.setMobile(saasDO.getMobile());
        userDO.setName(saasDO.getManagerName());
        userDO.setUsername(userDO.getEmail());
        if (saasService.search("name=" + userDO.getName()).size() > 0) {
            return failed(errorCodeUtil.getErrorMsg(BaseErrorCode.Saas.NAME_IS_EXIST), Envelop.class);
        }
@ -58,7 +62,6 @@ public class SaasEndpoint extends EnvelopRestEndpoint {
        if (userService.search("username=" + userDO.getEmail()).size() > 0) {
            return failed(errorCodeUtil.getErrorMsg(BaseErrorCode.Saas.EMAIL_IS_EXIST), Envelop.class);
        }
        userDO.setUsername(userDO.getEmail());
        saasService.save(saasDO, userDO);
        return success("创建成功");
    }

+ 23 - 2
svr/svr-base/src/main/java/com/yihu/jw/base/service/saas/SaasService.java

@ -16,6 +16,8 @@ import com.yihu.jw.entity.base.module.SaasModuleDO;
import com.yihu.jw.entity.base.org.BaseOrgDO;
import com.yihu.jw.entity.base.role.RoleDO;
import com.yihu.jw.entity.base.saas.SaasDO;
import com.yihu.jw.entity.base.saas.SaasThemeDO;
import com.yihu.jw.entity.base.saas.SaasThemeExtendDO;
import com.yihu.jw.entity.base.system.SystemDictEntryDO;
import com.yihu.jw.entity.base.user.UserDO;
import com.yihu.jw.entity.base.user.UserRoleDO;
@ -82,7 +84,7 @@ public class SaasService extends BaseJpaService<SaasDO, SaasDao> {
     */
    private final String roleCode = "saasAdmin";
    @Transactional
    @Transactional(rollbackFor = Exception.class)
    public SaasDO save(SaasDO saas, UserDO user) {
        //初始化租户信息
        String saasId = getCode();
@ -237,7 +239,7 @@ public class SaasService extends BaseJpaService<SaasDO, SaasDao> {
     * 系统配置
     * @param saasDO
     */
    @Transactional
    @Transactional(rollbackFor = Exception.class)
    public void saveSystemConfig(SaasDO saasDO){
        SaasDO oldSaas = saasDao.findById(saasDO.getId());
@ -256,8 +258,27 @@ public class SaasService extends BaseJpaService<SaasDO, SaasDao> {
     * 主题风格
     * @param saasDO
     */
    @Transactional(rollbackFor = Exception.class)
    public void createThemeConfig(SaasDO saasDO){
        SaasDO oldSaas = saasDao.findById(saasDO.getId());
        oldSaas.setThemeColor(saasDO.getThemeColor());
        List<SaasThemeDO> themeDOList = saasDO.getSaasThemeList();
        List<SaasThemeExtendDO> themeExtendDOList = new ArrayList<>(16);
        themeDOList.forEach(saasThemeDO -> {
            String themeId = getCode();
            saasThemeDO.setSaasId(saasDO.getId());
            saasThemeDO.setId(themeId);
            if(saasThemeDO.getThemeExtendList()!=null&&saasThemeDO.getThemeExtendList().size()>0){
                saasThemeDO.getThemeExtendList().forEach(saasThemeExtendDO -> {
                    saasThemeExtendDO.setThemeId(themeId);
                    themeExtendDOList.add(saasThemeExtendDO);
                });
            }
        });
        saasDao.save(oldSaas);
        saasThemeDao.save(themeDOList);
        saasThemeExtendDao.save(themeExtendDOList);
    }
    @Transactional