智慧保安后台管理-外网项目备份
Administrator
2021-09-29 7c9742190965b22f4ea3864aa8588fad19e0be58
培训审核查询修改
8 files modified
158 ■■■■ changed files
src/main/java/org/springblade/modules/exam/mapper/ExamPaperMapper.xml 17 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/exam/vo/ExamPaperVO.java 12 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/information/controller/InformationController.java 107 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/information/service/IInformationService.java 1 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/information/service/impl/InformationServiceImpl.java 7 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/system/mapper/UserMapper.xml 5 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/training/controller/TrainingRegistrationController.java 4 ●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/training/vo/TrainingRegistrationVo.java 5 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/exam/mapper/ExamPaperMapper.xml
@@ -101,9 +101,19 @@
    <select id="selectExamPaperPage" resultType="org.springblade.modules.exam.vo.ExamPaperVO">
        SELECT
            *
            ke.*,
            bu.real_name realName,
            bd.dept_name deptName
        FROM
            ksxt_exam
            ksxt_exam ke
        left join
            blade_user bu
        on
            ke.creator = bu.id
        left join
            blade_dept bd
        on
            bd.id = bu.dept_id
        where
        1=1
        <if test="paper.examType!=null and paper.examType!=''">
@@ -112,6 +122,9 @@
        <if test="paper.examName!=null and paper.examName!=''">
            and exam_name like concat('%',#{paper.examName},'%')
        </if>
        <if test="paper.deptId!=null and paper.deptId!=''">
            and bd.id = #{paper.deptId}
        </if>
        <if test="paper.auditStatus!=null and paper.auditStatus!=''">
            and audit_status = #{paper.auditStatus}
        </if>
src/main/java/org/springblade/modules/exam/vo/ExamPaperVO.java
@@ -13,7 +13,7 @@
@EqualsAndHashCode(callSuper = true)
public class ExamPaperVO extends ExamPaper {
    /**
     * 考试人员姓名
     * 考试人员姓名/申请人名字
     */
    private String realName;
@@ -41,4 +41,14 @@
     * 报名人数
     */
    private Integer num;
    /**
     * 申请人部门名称
     */
    private String deptName;
    /**
     * 申请人部门id
     */
    private String deptId;
}
src/main/java/org/springblade/modules/information/controller/InformationController.java
@@ -17,6 +17,7 @@
package org.springblade.modules.information.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@@ -28,10 +29,14 @@
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.cache.utils.CacheUtil;
import org.springblade.core.excel.util.ExcelUtil;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.support.Kv;
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.FTP.OutJson;
import org.springblade.modules.information.entity.Information;
@@ -40,7 +45,12 @@
import org.springblade.modules.information.service.IInformationService;
import org.springblade.modules.information.vo.InformationVO;
import org.springblade.modules.system.entity.Dept;
import org.springblade.modules.system.entity.Role;
import org.springblade.modules.system.entity.User;
import org.springblade.modules.system.service.IDeptService;
import org.springblade.modules.system.service.IRoleService;
import org.springblade.modules.system.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
@@ -77,6 +87,11 @@
    private final IInformationService informationService;
    private final IDeptService iDeptService;
    private final IUserService userService;
    private final IRoleService roleService;
    /**
     * 详情
@@ -128,7 +143,7 @@
    @PostMapping("/save")
    @ApiOperationSupport(order = 4)
    @ApiOperation(value = "新增", notes = "传入information")
    public R save(@Valid @RequestBody Information information) throws Exception {
    public R save(@Valid @RequestBody Information information){
        Dept dept = new Dept();
        //自招保安公司
        if (information.getStats().equals("0")) {
@@ -183,26 +198,76 @@
            String id = kv.get("id").toString();
            information.setDepartmentid(id);
        }
        informationService.save(information);
        String formatStr = new SimpleDateFormat("yyyy-MM-dd").format(information.getEstablishtime());
        Integer isDeleted = 0;
        //Integer id = information.getId();
        String s = "insert into sys_information(id,creditCode,enterpriseName,representative,establishTime," +
            "registeredCapital,organizationCode,registrationNumber, enterprises, address," +
            " business,region,registration,industry,departmentid,stats,jurisdiction,representativecell,contacts,contactscell) " +
            "values(" + "'" + information.getId() + "'" + "," + "'" + information.getCreditcode() + "'" + "," + "'" + information.getEnterprisename() + "'" + "," + "'" + information.getRepresentative() + "'" + "," +
            "'" + formatStr + "'" + "," + "'" + information.getRegisteredcapital() + "'" + "," + "'" + information.getOrganizationcode() + "'" + "," + "'" + information.getRegistrationnumber() + "'" + "," + "'" + information.getEnterprises() + "'" + "," + "'" +
            information.getAddress() + "'" + "," + "'" + information.getBusiness() + "'" + "," + "'" +
            information.getRegion() + "'" + "," + "'" + information.getRegistration() + "'" + "," + "'" + information.getIndustry() + "'" + "," + "'" + information.getDepartmentid() + "'" + "," +
            "'" + information.getStats() + "'" + "," + "'" + information.getJurisdiction() + "'" + "," + "'" + information.getRepresentativecell() + "'" + "," +
            "'" + information.getContacts() + "'" + "," + "'" + information.getContactscell() + "'" + ");" +
            "insert into blade_dept(id,parent_id,tenant_id,dept_name,ancestors,dept_category,is_deleted) values(" + "'" + information.getDepartmentid() + "'" + "," + "'" + dept.getParentId() + "'" + ","
            + "'" + dept.getTenantId() + "'" +
            "," + "'" + information.getEnterprisename() + "'" +
            "," + "'" + dept.getAncestors() + "'" +
            "," + "'" + dept.getDeptCategory() + "'" +
            "," + "'" + isDeleted + "'" + ")";
        FtpUtil.sqlFileUpload(s);
        //公司新增
        boolean status = informationService.save(information);
        //公司新增成功则创建默认账户,公司名即为账号名,默认密码为 123456
        if (status) {
            User user = new User();
            user.setAccount(information.getEnterprisename());
            user.setPassword(DigestUtil.encrypt("123456"));
            Integer userCount = userService.selectCount(information.getEnterprisename());
            if (userCount > 0 && Func.isEmpty(user.getId())) {
                throw new ServiceException(StringUtil.format("当前用户 [{}] 已存在!", user.getAccount()));
            }
            user.setDeptId(information.getDepartmentid());
            user.setTenantId("000000");
            user.setCreateTime(new Date());
            user.setUpdateTime(new Date());
            user.setStatus(1);
            user.setIsDeleted(0);
            //分配保安角色
            Role role = new Role();
            role.setRoleAlias("保安公司管理员");
            Role oneRole = roleService.getOne(Condition.getQueryWrapper(role));
            user.setRoleId(oneRole.getId().toString());
            //插入用户数据
            userService.save(user);
            Integer isDeleted = 0;
            //Integer id = information.getId();
            String s = "insert into sys_information(id,creditCode,enterpriseName,representative" +
                        ",registeredCapital,organizationCode,registrationNumber, enterprises, address," +
                        " business,region,registration,industry,departmentid,stats,jurisdiction,representativecell,contacts,contactscell) " +
                        "values(" + "'" + information.getId() + "'" +
                        "," + "'" + information.getCreditcode() + "'" +
                        "," + "'" + information.getEnterprisename() + "'" +
                        "," + "'" + information.getRepresentative() + "'" +
                        "," + "'" + information.getRegisteredcapital() + "'" +
                        "," + "'" + information.getOrganizationcode() + "'" +
                        "," + "'" + information.getRegistrationnumber() + "'" +
                        "," + "'" + information.getEnterprises() + "'" +
                        "," + "'" + information.getAddress() + "'" +
                        "," + "'" + information.getBusiness() + "'" +
                        "," + "'" + information.getRegion() + "'" +
                        "," + "'" + information.getRegistration() + "'" +
                        "," + "'" + information.getIndustry() + "'" +
                        "," + "'" + information.getDepartmentid() + "'" +
                        "," + "'" + information.getStats() + "'" +
                        "," + "'" + information.getJurisdiction() + "'" +
                        "," + "'" + information.getRepresentativecell() + "'" +
                        "," + "'" + information.getContacts() + "'" +
                        "," + "'" + information.getContactscell() + "'" + ");" +
                        "insert into blade_dept(id,parent_id,tenant_id,dept_name,ancestors,dept_category,is_deleted) values(" + "'" + information.getDepartmentid() + "'" + "," + "'" + dept.getParentId() + "'" + ","
                        + "'" + dept.getTenantId() + "'" +
                        "," + "'" + information.getEnterprisename() + "'" +
                        "," + "'" + dept.getAncestors() + "'" +
                        "," + "'" + dept.getDeptCategory() + "'" +
                        "," + "'" + isDeleted + "'" + ");" +
                        "insert into blade_user(id,tenant_id,account,password,role_id,dept_id,create_time,update_time,status,is_deleted) " +
                        "values(" + "'" + user.getId() + "'" +
                        "," + "'" + user.getTenantId() + "'"
                        + "," + "'" + user.getAccount() + "'" +
                        "," + "'" + user.getPassword() + "'" +
                        "," + "'" + user.getRoleId() + "'" +
                        "," + "'" + user.getDeptId() + "'" +
                        "," + "'" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(user.getCreateTime()) + "'" +
                        "," + "'" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(user.getUpdateTime()) + "'" +
                        "," + "'" + user.getStatus() + "'" +
                        "," + "'" + user.getIsDeleted() + "'" + ")";
            FtpUtil.sqlFileUpload(s);
        }
        return R.success("成功");
    }
src/main/java/org/springblade/modules/information/service/IInformationService.java
@@ -21,6 +21,7 @@
import org.springblade.modules.information.entity.Information;
import org.springblade.modules.information.excel.InforExcel;
import org.springblade.modules.information.vo.InformationVO;
import org.springblade.modules.system.entity.User;
import org.springblade.modules.system.excel.UserExcel;
import java.util.List;
src/main/java/org/springblade/modules/information/service/impl/InformationServiceImpl.java
@@ -25,6 +25,7 @@
import org.springblade.common.enums.DictEnum;
import org.springblade.common.utils.arg;
import org.springblade.core.cache.utils.CacheUtil;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.support.Kv;
import org.springblade.core.tool.utils.BeanUtil;
@@ -36,10 +37,15 @@
import org.springblade.modules.information.service.IInformationService;
import org.springblade.modules.information.vo.InformationVO;
import org.springblade.modules.system.entity.Dept;
import org.springblade.modules.system.entity.Role;
import org.springblade.modules.system.entity.User;
import org.springblade.modules.system.service.IDeptService;
import org.springblade.modules.system.service.IRoleService;
import org.springblade.modules.system.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Objects;
@@ -57,6 +63,7 @@
@Service
public class InformationServiceImpl extends ServiceImpl<InformationMapper, Information> implements IInformationService {
    @Override
    public IPage<InformationVO> selectInformationPage(IPage<InformationVO> page, InformationVO information) {
        return page.setRecords(baseMapper.selectInformationPage(page, information));
src/main/java/org/springblade/modules/system/mapper/UserMapper.xml
@@ -516,7 +516,10 @@
    <!--查询账号相同的数量-->
    <select id="selectCountAccount" resultType="java.lang.Integer">
        select count(*) from blade_user where account = #{account}
        select count(*) from blade_user where 1=1
        and status = 1
        and is_deleted = 0
        and account = #{account}
    </select>
    <!--查询当前部门名称及父级部门名称-->
src/main/java/org/springblade/modules/training/controller/TrainingRegistrationController.java
@@ -562,6 +562,7 @@
                int day = instance.get(Calendar.DAY_OF_MONTH);
                String examName = year + "年" + month+ "月"+ day +"日" +"保安员证培训考试";
                examPaper.setExamName(examName);
                examPaper.setCreator(trainingRegistrationVo.getCreator());
                //待审核
                examPaper.setAuditStatus(3);
                //创建时间
@@ -573,12 +574,13 @@
                String format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(examPaper.getStartTime());
                String endTimeFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(examPaper.getEndTime());
                String creatorTimeFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(examPaper.getCreatorDate());
                String s = "insert into ksxt_exam(id,exam_name,exam_type,start_time,end_time,creator_date,audit_status) " +
                String s = "insert into ksxt_exam(id,exam_name,exam_type,start_time,end_time,creator,creator_date,audit_status) " +
                    "values(" + "'" + sid + "'" +
                    "," + "'" + examPaper.getExamName() + "'" +
                    "," + "'" + examPaper.getExamType() +"'" +
                    "," + "'" + format +"'" +
                    "," + "'" + endTimeFormat +"'" +
                    "," + "'" + examPaper.getCreator() +"'" +
                    "," + "'" + creatorTimeFormat +"'" +
                    ","  +"'" + examPaper.getAuditStatus() + "'" + ")";
                FtpUtil.sqlFileUpload(s);
src/main/java/org/springblade/modules/training/vo/TrainingRegistrationVo.java
@@ -109,4 +109,9 @@
     * 是否培训报名
     */
    private Integer isTrain;
    /**
     * 申请人
     */
    private String creator;
}