洪城义警-正式版后台
tangzy
2022-02-19 eb4b52e8185465a98d92566259a8bcdf6ed0801e
注册判断
1 files modified
23 ■■■■ changed files
src/main/java/org/springblade/modules/zc/controller/ZcController.java 23 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/zc/controller/ZcController.java
@@ -29,6 +29,7 @@
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.DigestUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.StringUtil;
import org.springblade.modules.FTP.FtpUtil;
import org.springblade.modules.system.service.IDeptService;
import org.springblade.modules.system.service.IUserService;
@@ -211,8 +212,11 @@
        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String times = df.format(new Date());
        zc.setZctime(times);
        Integer userCount = iUserService.selectCount(zc.getUsername());
        if (userCount > 0) {
            throw new org.springblade.core.log.exception.ServiceException(StringUtil.format("当前用户 [{}] 已存在!", zc.getUsername()));
        }
        zcService.inster(zc);
        String s = "insert into act_zc(id,username,password,sname,sex,phone,zctime,deptid,parent_id,jurisdiction,cardid)" +
            "values(" + "'" + zc.getId() + "'" +
            "," + "'" + zc.getUsername() + "'" +
@@ -225,11 +229,22 @@
            "," + "'" + zc.getParentId() + "'" +
            "," + "'" + zc.getJurisdiction() + "'" +
            "," + "'" + zc.getCardid() + "'" + ")";
        System.out.println(s);
        FtpUtil.sqlFileUpload(s);
        return R.success("新增成功");
    }
    /**
     * 用户验证
     * @param username
     * @return
     */
    @GetMapping("/inspect")
    public R inspect(String username) {
        Integer userCount = iUserService.selectCount(username);
        if (userCount > 0) {
            throw new org.springblade.core.log.exception.ServiceException(StringUtil.format("当前用户{}已存在!", username));
        }
        return R.success("当前用户已存在!");
    }
}