tangzy
2021-08-26 de8c601144b2f11850dad407e9020f7c269702da
1.登录返回角色
6 files modified
43 ■■■■■ changed files
src/main/java/org/springblade/modules/auth/utils/TokenUtil.java 3 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/recordk/controller/RecordkController.java 21 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/system/mapper/RoleMapper.java 1 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/system/mapper/RoleMapper.xml 11 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/system/service/IRoleService.java 2 ●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/system/service/impl/RoleServiceImpl.java 5 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/auth/utils/TokenUtil.java
@@ -26,6 +26,7 @@
import org.springblade.core.tool.jackson.JsonUtil;
import org.springblade.core.tool.support.Kv;
import org.springblade.core.tool.utils.*;
import org.springblade.modules.system.entity.Role;
import org.springblade.modules.system.entity.Tenant;
import org.springblade.modules.system.entity.User;
import org.springblade.modules.system.entity.UserInfo;
@@ -97,6 +98,7 @@
        param.put("jurisdiction", user.getJurisdiction());
        param.put("cardid", user.getCardid());
        param.put("Id", user.getId());
        param.put("rname", userInfo.getRoles());
        //拼装accessToken
        try {
@@ -110,6 +112,7 @@
                .set("jurisdiction", user.getJurisdiction())
                .set("cardid", user.getCardid())
                .set("Id", user.getId())
                .set("rname", userInfo.getRoles())
                .set(TokenConstant.OAUTH_ID, userInfo.getOauthId())
                .set(TokenConstant.ACCOUNT, user.getAccount())
                .set(TokenConstant.USER_NAME, user.getAccount())
src/main/java/org/springblade/modules/recordk/controller/RecordkController.java
@@ -27,6 +27,7 @@
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springblade.modules.FTP.FtpUtil;
import org.springblade.modules.permit.entity.Permit;
import org.springblade.modules.recordk.entity.Recordk;
import org.springblade.modules.recordk.service.IRecordkService;
@@ -34,6 +35,7 @@
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Map;
@@ -102,7 +104,24 @@
        recordk.setStorage("1");
        recordk.setType("2");
        recordk.setPermitime(new Date());
        return R.status(recordkService.save(recordk));
        recordkService.save(recordk);
        String formatStr = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(recordk.getEstablishtime());
        String offtime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(recordk.getOfficetime());
        String pertime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(recordk.getPermitime());
        String s = "insert into sys_record(id,creditCode,enterpriseName,representative,establishTime," +
            "registeredCapital,organizationCode,registrationNumber,identificationNumber,enterprises," +
            "address,business,region,registration,industry,type,permitime,deptid,ptype,representativecell,contacts,contactscell,perid,offices,officetime,jurisdiction)" +
            "values(" + "'" + recordk.getId() + "'" + "," + "'" + recordk.getCreditcode() + "'" + "," + "'" + recordk.getEnterprisename() + "'" + "," + "'"
            + recordk.getRepresentative() + "'" + "," +
            "'" + formatStr + "'" + "," + "'" + recordk.getRegisteredcapital() + "'" + "," + "'"
            + recordk.getOrganizationcode() + "'" + "," + "'" + recordk.getRegistrationnumber() + "'" + "," +
            "'" + recordk.getIdentificationnumber() + "'" + "," + "'" + recordk.getEnterprises() + "'" + "," + "'" +
            recordk.getAddress() + "'" + "," + "'" + recordk.getBusiness() + "'" + "," + "'" +
            recordk.getRegion() + "'" + "," + "'" + recordk.getRegistration() + "'" + "," + "'" + recordk.getIndustry() + "'" + "," + "'" + recordk.getType() + "'" + "," + "'" + pertime + "'" + "," + "'" + recordk.getDeptid() + "'" + "," + "'" + recordk.getPtype() + "'" + "," +
            "'" + recordk.getRepresentativecell() + "'" + "," + "'" + recordk.getContacts() + "'" + "," + "'" + recordk.getContactscell() + "'" + "," +
            "'" + recordk.getPerid() + "'" + "," + "'" + recordk.getOffices() + "'" + "," + "'" + offtime + "'" + "," + "'"+ ")";
        FtpUtil.sqlFileUpload(s);
        return R.success("成功");
    }
    /**
src/main/java/org/springblade/modules/system/mapper/RoleMapper.java
@@ -55,6 +55,7 @@
     * @return
     */
    List<String> getRoleNames(Long[] ids);
    String Info(String id);
    /**
     * 获取角色名
src/main/java/org/springblade/modules/system/mapper/RoleMapper.xml
@@ -63,4 +63,15 @@
        and is_deleted = 0
    </select>
    <select id="Info" resultType="java.lang.String">
        SELECT
        role_alias as rolename
        FROM
        blade_role
        WHERE
        id=#{id}
        and is_deleted = 0
    </select>
</mapper>
src/main/java/org/springblade/modules/system/service/IRoleService.java
@@ -91,7 +91,7 @@
     * @return
     */
    boolean submit(Role role);
    String Info(String id);
    /**
     * 角色信息查询
     *
src/main/java/org/springblade/modules/system/service/impl/RoleServiceImpl.java
@@ -202,6 +202,11 @@
    }
    @Override
    public String Info(String id) {
        return baseMapper.Info(id);
    }
    @Override
    public List<RoleVO> search(String roleName, Long parentId) {
        LambdaQueryWrapper<Role> queryWrapper = Wrappers.<Role>query().lambda();
        if (Func.isNotEmpty(roleName)) {