From a25fd6b83254e44aca3c9a50cce400c181729fc1 Mon Sep 17 00:00:00 2001 From: zhangtq <2452618307@qq.com> Date: Mon, 20 Jan 2025 18:34:23 +0800 Subject: [PATCH 01/13] =?UTF-8?q?=E4=BA=BA=E5=91=98=E4=B8=8A=E4=BC=A0?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../project/service/impl/ImportServiceImpl.java | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/bonus-modules/bonus-project/src/main/java/com/bonus/project/service/impl/ImportServiceImpl.java b/bonus-modules/bonus-project/src/main/java/com/bonus/project/service/impl/ImportServiceImpl.java index c6147eb..60160fc 100644 --- a/bonus-modules/bonus-project/src/main/java/com/bonus/project/service/impl/ImportServiceImpl.java +++ b/bonus-modules/bonus-project/src/main/java/com/bonus/project/service/impl/ImportServiceImpl.java @@ -414,7 +414,7 @@ public class ImportServiceImpl implements ImportService { nameList = new ArrayList<>(); namePhoneList = new ArrayList<>(); map = new HashMap<>(); - String encoding = "UTF-8"; + String encoding = "GBK"; ZipFile zipFile = new ZipFile(path); zipFile.setFileNameCharset(encoding); List list = zipFile.getFileHeaders(); @@ -440,7 +440,6 @@ public class ImportServiceImpl implements ImportService { String name = fileName.split("/")[_index + 1]; map.put(beforeName, "其他文件".equals(fileName.split("/")[_index + 1]) ? "" : fileName.split("/")[_index + 1]); } - // 设置编码 if (isMessyCode(fileName)) { encoding = "UTF-8"; @@ -450,9 +449,6 @@ public class ImportServiceImpl implements ImportService { nameList.add(fileName); try { - if (i == (list.size() - 1)) { - map.put(beforeName, folderName.toString()); - } String currentName = fileName.split("/")[_index].split("_")[1]; if (!beforeName.equals(currentName)) { // 不相同名称时,对map进行赋值 @@ -460,7 +456,9 @@ public class ImportServiceImpl implements ImportService { beforeName = currentName; folderName = new StringBuilder(); } - + if (i == (list.size() - 1)) { + map.put(beforeName, folderName.toString()); + } if (!"其他文件".equals(fileName.split("/")[_index + 1])) { folderName.append(fileName.split("/")[_index + 1]).append(","); } @@ -468,10 +466,6 @@ public class ImportServiceImpl implements ImportService { folderName.append(fileName.split("/")[_index + 1]).append(","); } - if (i == list.size() - 1) { - map.put(beforeName, folderName.toString()); - } - // 使用set方法对名称进行过滤 保持namePhoneList数据的唯一性 if (uniqueNames.add(currentName)) { namePhoneList.add(currentName); @@ -479,6 +473,8 @@ public class ImportServiceImpl implements ImportService { } catch (ArrayIndexOutOfBoundsException e) { log.error("文件导入识别到不存在文件夹的文件"); } + }else if (i == (list.size() - 1)){ + map.put(beforeName, folderName.toString()); } i++; } From e2ee7bc418595f9b0a37e2aa18f06e2a7b0553fa Mon Sep 17 00:00:00 2001 From: zhangtq <2452618307@qq.com> Date: Tue, 21 Jan 2025 09:27:21 +0800 Subject: [PATCH 02/13] =?UTF-8?q?=E4=BA=BA=E5=91=98=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E5=AF=BC=E5=85=A5=E4=B9=B1=E7=A0=81=E5=8A=A8=E6=80=81=E5=A4=84?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/bonus/project/service/impl/ImportServiceImpl.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/bonus-modules/bonus-project/src/main/java/com/bonus/project/service/impl/ImportServiceImpl.java b/bonus-modules/bonus-project/src/main/java/com/bonus/project/service/impl/ImportServiceImpl.java index 60160fc..53fc441 100644 --- a/bonus-modules/bonus-project/src/main/java/com/bonus/project/service/impl/ImportServiceImpl.java +++ b/bonus-modules/bonus-project/src/main/java/com/bonus/project/service/impl/ImportServiceImpl.java @@ -418,6 +418,14 @@ public class ImportServiceImpl implements ImportService { ZipFile zipFile = new ZipFile(path); zipFile.setFileNameCharset(encoding); List list = zipFile.getFileHeaders(); + //判断文件名是否乱码 + if (isMessyCode(list.get(0).getFileName())) { + encoding = "UTF-8"; + //对文件名进行重新编码 + zipFile = new ZipFile(path); + zipFile.setFileNameCharset(encoding); + list = zipFile.getFileHeaders(); + } Set uniqueNames = new HashSet<>(); String beforeName = ""; StringBuilder folderName = new StringBuilder(); From a6e3f6137f84b592dba325f1e4f87e71b854a20c Mon Sep 17 00:00:00 2001 From: zhangtq <2452618307@qq.com> Date: Wed, 22 Jan 2025 15:08:21 +0800 Subject: [PATCH 03/13] =?UTF-8?q?=E7=9B=91=E7=90=86=E3=80=81=E6=89=BF?= =?UTF-8?q?=E5=8C=85=E3=80=81=E5=88=86=E5=8C=85=E6=96=B0=E5=A2=9E=E4=BA=BA?= =?UTF-8?q?=E5=91=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bonus/project/mapper/ProjectMapper.java | 28 ++++++++++ .../com/bonus/project/mapper/SubMapper.java | 8 +++ .../service/impl/ProjectServiceImpl.java | 53 ++++++++++++++++-- .../project/service/impl/SubServiceImpl.java | 27 +++++++++- .../resources/mapper/system/ProjectMapper.xml | 54 +++++++++++++++++++ .../resources/mapper/system/SubMapper.xml | 20 +++++++ 6 files changed, 186 insertions(+), 4 deletions(-) diff --git a/bonus-modules/bonus-project/src/main/java/com/bonus/project/mapper/ProjectMapper.java b/bonus-modules/bonus-project/src/main/java/com/bonus/project/mapper/ProjectMapper.java index c4fbdca..a6115bd 100644 --- a/bonus-modules/bonus-project/src/main/java/com/bonus/project/mapper/ProjectMapper.java +++ b/bonus-modules/bonus-project/src/main/java/com/bonus/project/mapper/ProjectMapper.java @@ -290,4 +290,32 @@ public interface ProjectMapper { * @return */ List selectPhone(String proId); + /** + * 查询监理信息 + * @param supervisorUnitId + * @return + */ + SubPerson getSupPerson(String supervisorUnitId); + /** + * 查询承包商信息 + * @param consId + * @return + */ + SubPerson getConsPerson(String consId); + + int addSupPersonToPsi(SubPerson subPerson); + + int addSupPersonToLk(SubPerson subPerson); + + int addConsPersonToPcp(SubPerson subPerson); + + int addConsPersonToLk(SubPerson subPerson); + + void delSupPersonToPsi(Project project); + + void delSupPersonToLk(Project project); + + void delConsPersonToPcp(Project project); + + void delConsPersonToLk(Project project); } diff --git a/bonus-modules/bonus-project/src/main/java/com/bonus/project/mapper/SubMapper.java b/bonus-modules/bonus-project/src/main/java/com/bonus/project/mapper/SubMapper.java index 0de4be7..d9a86c0 100644 --- a/bonus-modules/bonus-project/src/main/java/com/bonus/project/mapper/SubMapper.java +++ b/bonus-modules/bonus-project/src/main/java/com/bonus/project/mapper/SubMapper.java @@ -67,4 +67,12 @@ public interface SubMapper { * @return 是否删除成功 */ int delSub(int id); + + int addSubPersonToPcp(SubPerson subPerson); + + int addSubPersonToLk(SubPerson subPerson); + + int delSubPersonToPcp(int id); + + int delSubPersonToLk(int id); } diff --git a/bonus-modules/bonus-project/src/main/java/com/bonus/project/service/impl/ProjectServiceImpl.java b/bonus-modules/bonus-project/src/main/java/com/bonus/project/service/impl/ProjectServiceImpl.java index 87f9e05..84a5f0f 100644 --- a/bonus-modules/bonus-project/src/main/java/com/bonus/project/service/impl/ProjectServiceImpl.java +++ b/bonus-modules/bonus-project/src/main/java/com/bonus/project/service/impl/ProjectServiceImpl.java @@ -151,6 +151,11 @@ public class ProjectServiceImpl implements ProjectService { // if (code == 0) { // throw new RuntimeException("Failed to delete project"); // } + projectMapper.delSupPersonToPsi(project); + projectMapper.delSupPersonToLk(project); + projectMapper.delConsPersonToPcp(project); + projectMapper.delConsPersonToLk(project); + }catch (Exception e){ TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); log.error("Failed to delete project due to exception", e); @@ -348,7 +353,8 @@ public class ProjectServiceImpl implements ProjectService { result = addRelateInfoForPro(project); } catch (Exception e) { - throw new RuntimeException("Failed to add supervisory unit due to exception", e); + result = 0; + TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); } return result; } @@ -420,9 +426,14 @@ public class ProjectServiceImpl implements ProjectService { projectMapper.delMaterialProject(project); projectMapper.delAddressProject(project); projectMapper.delSupervisoryProject(project); + projectMapper.delSupPersonToPsi(project); + projectMapper.delSupPersonToLk(project); + projectMapper.delConsPersonToPcp(project); + projectMapper.delConsPersonToLk(project); result = addRelateInfoForPro(project); } catch (Exception e) { - throw new RuntimeException("Failed to add supervisory unit due to exception", e); + result = 0; + TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); } return result; } @@ -458,7 +469,8 @@ public class ProjectServiceImpl implements ProjectService { } } } catch (Exception e) { - throw new RuntimeException("Failed to add supervisory unit due to exception", e); + result = 0; + TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); } return result; } @@ -479,6 +491,8 @@ public class ProjectServiceImpl implements ProjectService { if (result <= 0) { throw new RuntimeException("Failed to add supervisory project"); } + //TODO 获取监理信息 --- 新增监理信息到监理人员表 + addSupPerson(project); } //插入承包商-工程关联信息 for (int i = 0; i < project.getConsArr().size(); i++) { @@ -498,6 +512,8 @@ public class ProjectServiceImpl implements ProjectService { throw new RuntimeException("Failed to add material project"); } } + // TODO 获取承包商信息 --- 新增承包商信息到承包商人员表 + addConsPerson(project); } for (int i = 0; i < project.getProAddress().size(); i++) { //插入工程地址-工程关联信息 @@ -510,6 +526,37 @@ public class ProjectServiceImpl implements ProjectService { } return result; } + /** + * 新增监理人员 + * + * @param project 工程实体 + */ + private void addSupPerson(Project project) { + // TODO 获取监理信息 --- 新增监理信息到监理人员表 + SubPerson subPerson = projectMapper.getSupPerson(project.getSupervisorUnitId()); + subPerson.setUuid(StringUtils.getUuid()); + subPerson.setProId(Math.toIntExact(project.getProId())); + //插入人员表 + projectMapper.addSupPersonToPsi(subPerson); + //插入关联表 + projectMapper.addSupPersonToLk(subPerson); + } + /** + * 新增承包商人员 + * + * @param project 工程实体 + */ + private void addConsPerson(Project project) { + // TODO 获取承包商信息 --- 新增承包商信息到承包商人员表 + SubPerson subPerson = projectMapper.getConsPerson(project.getConsId()); + subPerson.setUuid(StringUtils.getUuid()); + subPerson.setProId(Math.toIntExact(project.getProId())); + //插入人员表 + projectMapper.addConsPersonToPcp(subPerson); + //插入关联表 + projectMapper.addConsPersonToLk(subPerson); + } + /** * 新增用户岗位信息 diff --git a/bonus-modules/bonus-project/src/main/java/com/bonus/project/service/impl/SubServiceImpl.java b/bonus-modules/bonus-project/src/main/java/com/bonus/project/service/impl/SubServiceImpl.java index a596930..5d8a5f4 100644 --- a/bonus-modules/bonus-project/src/main/java/com/bonus/project/service/impl/SubServiceImpl.java +++ b/bonus-modules/bonus-project/src/main/java/com/bonus/project/service/impl/SubServiceImpl.java @@ -21,6 +21,7 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import org.springframework.transaction.interceptor.TransactionAspectSupport; import javax.annotation.Resource; import java.util.List; @@ -111,14 +112,36 @@ public class SubServiceImpl implements SubService { // 抛出异常触发事务回滚 throw new RuntimeException("Failed to add subcontractor unit"); } + // TODO 添加分包商人员信息到人员表 + addSubPerson(bean); // 返回操作结果,可能是插入的记录数或者其他标识 return result; } catch (Exception e) { log.error("Failed to add subcontractor unit due to exception", e ); // 抛出异常触发事务回滚 - throw new RuntimeException("Failed to add subcontractor unit due to exception", e); + TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); } + return 0; } + + private void addSubPerson(SubcontractorsEntity bean){ + System.out.println("addSubPerson=========="+bean); + SubPerson subPerson = new SubPerson(); + subPerson.setName(bean.getSubPrincipal()); + subPerson.setPhone(bean.getSubPrincipalPhone()); + subPerson.setIdCard(bean.getSubIdCard()); + subPerson.setSubUuid(bean.getSubUuid()); + subPerson.setUuid(StringUtils.getUuid()); + subPerson.setConsUuid(bean.getConsUuid()); + subPerson.setSupUuid(bean.getSupUuid()); + subPerson.setProId(bean.getProId()); + //插入人员表 + mapper.addSubPersonToPcp(subPerson); + //插入关联表 + mapper.addSubPersonToLk(subPerson); + } + + /** * 分包商人员入场申请列表 * @param bean 分包商实体 @@ -159,6 +182,8 @@ public class SubServiceImpl implements SubService { */ @Override public int delSub(int id) { +// mapper.delSubPersonToPcp(id); +// mapper.delSubPersonToLk(id); return mapper.delSub(id); } /** diff --git a/bonus-modules/bonus-project/src/main/resources/mapper/system/ProjectMapper.xml b/bonus-modules/bonus-project/src/main/resources/mapper/system/ProjectMapper.xml index 614980d..7ee3a85 100644 --- a/bonus-modules/bonus-project/src/main/resources/mapper/system/ProjectMapper.xml +++ b/bonus-modules/bonus-project/src/main/resources/mapper/system/ProjectMapper.xml @@ -71,6 +71,22 @@ (#{item.userId},#{item.roleId}) + + insert into pt_sup_person(sup_name, phone, post, is_active) + values (#{name}, #{phone}, '1','1') + + + insert into lk_sup_person(uuid,pro_id, sup_persion_id,sup_uuid,status,is_exist_file) + values (#{uuid}, #{proId},#{id},#{supUuid},'0','0') + + + insert into pt_cons_person(cons_name, phone, post, is_active) + values (#{name}, #{phone},'1', '1') + + + insert into lk_cont_person(uuid,pro_id, cons_persion_id,cont_uuid,is_exist_file) + values (#{uuid}, #{proId},#{id},#{consUuid},'0') + update pt_project_info set pro_status = '2' @@ -129,6 +145,26 @@ from lk_pro_sup where pro_id = #{proId} + + delete + from pt_sup_person + where sup_user_id = (select sup_persion_id from lk_sup_person where pro_id = #{proId}) + + + delete + from lk_sup_person + where pro_id = #{proId} + + + delete + from pt_cons_person + where cons_user_id in (select cons_persion_id from lk_cont_person where pro_id = #{proId}) + + + delete + from lk_cont_person + where pro_id = #{proId} + + + diff --git a/bonus-modules/bonus-project/src/main/resources/mapper/system/SubMapper.xml b/bonus-modules/bonus-project/src/main/resources/mapper/system/SubMapper.xml index 0ad9342..bfa5537 100644 --- a/bonus-modules/bonus-project/src/main/resources/mapper/system/SubMapper.xml +++ b/bonus-modules/bonus-project/src/main/resources/mapper/system/SubMapper.xml @@ -25,11 +25,31 @@ insert into sys_user_role(user_id, role_id) values (#{id}, '8') + + insert into pt_cons_person(cons_name,phone,id_card,is_active) + values(#{name},#{phone},#{idCard},'1') + + + insert into lk_cont_person(cons_persion_id,cont_uuid,sub_uuid,pro_id,is_exist_file,uuid) + values(#{id},#{consUuid},#{subUuid},#{proId},'0',#{uuid}) + update pt_sub_info set is_active = '0' where sub_id = #{id} + + delete + from pt_cons_person + where cons_user_id = (select cons_persion_id + from lk_cont_person + where uuid = (select uuid from pt_sub_info where sub_id = #{id})) + + + delete + from lk_cont_person + where uuid = (select uuid from pt_sub_info where sub_id = #{id}) + + \ No newline at end of file From 48a9acbed0d62b1c6e8546f6df8f0a1903452a1e Mon Sep 17 00:00:00 2001 From: "liang.chao" <1360241448@qq.com> Date: Sat, 8 Feb 2025 09:01:41 +0800 Subject: [PATCH 06/13] =?UTF-8?q?=E5=AD=A6=E5=91=98=E6=A1=A3=E6=A1=88?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E6=8A=A5=E9=94=99=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/resources/mapper/exam/StudentManagementMapper.xml | 4 ++-- .../bonus/flowable/listener/MultiInstanceCompleteTask.java | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/bonus-modules/bonus-exam/src/main/resources/mapper/exam/StudentManagementMapper.xml b/bonus-modules/bonus-exam/src/main/resources/mapper/exam/StudentManagementMapper.xml index 6552a2a..1c1f0e9 100644 --- a/bonus-modules/bonus-exam/src/main/resources/mapper/exam/StudentManagementMapper.xml +++ b/bonus-modules/bonus-exam/src/main/resources/mapper/exam/StudentManagementMapper.xml @@ -253,10 +253,10 @@ and etu.pro_id = #{proId} - and etu.sign_time is not null and etu.sign_time != '' and etu.sign_time != 'null' + and etu.sign_time is not null - and (etu.sign_time is null or etu.sign_time = '' or etu.sign_time = 'null') + AND etu.sign_time IS NULL + + diff --git a/bonus-modules/bonus-system/src/main/java/com/bonus/system/controller/SysSelectController.java b/bonus-modules/bonus-system/src/main/java/com/bonus/system/controller/SysSelectController.java index 9deb198..047c427 100644 --- a/bonus-modules/bonus-system/src/main/java/com/bonus/system/controller/SysSelectController.java +++ b/bonus-modules/bonus-system/src/main/java/com/bonus/system/controller/SysSelectController.java @@ -128,6 +128,18 @@ public class SysSelectController extends BaseController { } return error("系统异常"); } + @PostMapping("selectSupervisionUnitUser") + @SysLog(title = "下拉选", businessType = OperaType.QUERY,logType = 0,module = "下拉选->查询监理单位") + public AjaxResult selectSupervisionUnitUser(@RequestBody SysSelect sysSelect) { + try{ + List list = sysSelectService.selectSupervisionUnitUser(sysSelect); + return success(list); + }catch (Exception e){ + log.error(e.toString(),e); + } + return error("系统异常"); + } + /** * 文件查询 * @param sysFile 入参 diff --git a/bonus-modules/bonus-system/src/main/java/com/bonus/system/mapper/SysSelectMapper.java b/bonus-modules/bonus-system/src/main/java/com/bonus/system/mapper/SysSelectMapper.java index 227e7da..de5fb39 100644 --- a/bonus-modules/bonus-system/src/main/java/com/bonus/system/mapper/SysSelectMapper.java +++ b/bonus-modules/bonus-system/src/main/java/com/bonus/system/mapper/SysSelectMapper.java @@ -43,6 +43,8 @@ public interface SysSelectMapper { * @return 监理单位集合 */ List selectSupervisionUnit(SysSelect sysSelect); + + List selectSupervisionUnitUser(SysSelect sysSelect); /** * 文件查询 * @param sysFile 入参 diff --git a/bonus-modules/bonus-system/src/main/java/com/bonus/system/service/ISysSelectService.java b/bonus-modules/bonus-system/src/main/java/com/bonus/system/service/ISysSelectService.java index 002bfc6..9e4a14b 100644 --- a/bonus-modules/bonus-system/src/main/java/com/bonus/system/service/ISysSelectService.java +++ b/bonus-modules/bonus-system/src/main/java/com/bonus/system/service/ISysSelectService.java @@ -45,6 +45,12 @@ public interface ISysSelectService { * @return 监理单位集合 */ List selectSupervisionUnit(SysSelect sysSelect); + /** + * 监理单位 人员 下拉选 + * @param sysSelect 入参 + * @return 监理单位集合 + */ + List selectSupervisionUnitUser(SysSelect sysSelect); /** * 文件查询 * @param sysFile 入参 diff --git a/bonus-modules/bonus-system/src/main/java/com/bonus/system/service/impl/SysSelectServiceImpl.java b/bonus-modules/bonus-system/src/main/java/com/bonus/system/service/impl/SysSelectServiceImpl.java index 2477d44..b59b879 100644 --- a/bonus-modules/bonus-system/src/main/java/com/bonus/system/service/impl/SysSelectServiceImpl.java +++ b/bonus-modules/bonus-system/src/main/java/com/bonus/system/service/impl/SysSelectServiceImpl.java @@ -72,6 +72,16 @@ public class SysSelectServiceImpl implements ISysSelectService { public List selectSupervisionUnit(SysSelect sysSelect) { return sysSelectMapper.selectSupervisionUnit(sysSelect); } + + /** + * 监理单位人员下拉选 + * @param sysSelect 入参 + * @return + */ + @Override + public List selectSupervisionUnitUser(SysSelect sysSelect) { + return sysSelectMapper.selectSupervisionUnitUser(sysSelect); + } /** * 文件查询 * @param sysFile 入参 diff --git a/bonus-modules/bonus-system/src/main/resources/mapper/system/SysSelectMapper.xml b/bonus-modules/bonus-system/src/main/resources/mapper/system/SysSelectMapper.xml index 53049a1..38f9769 100644 --- a/bonus-modules/bonus-system/src/main/resources/mapper/system/SysSelectMapper.xml +++ b/bonus-modules/bonus-system/src/main/resources/mapper/system/SysSelectMapper.xml @@ -52,11 +52,17 @@ and material_type = '1' and status = '1' + + select (@rowNum := @rowNum + 1) as exportId, - psi.sup_id as supId, + psi.id as supId, psi.uuid as supUuid, psi.sup_name as unitName, psi.sup_address as unitAddress, psi.legal_name as corporateName, psi.legal_phone as corporatePhone, psi.sup_code as socialUnifiedCreditCode, - psi.comm_user_id as commUserId, - psi.comm_user_name as directorsName, - psi.comm_user_phone as directorsPhone, - ifnull(lps.sup_uuid,0) as status - from (select @rowNum := 0) r,pt_sup_info psi + IFNULL(us.num ,0) userNum, + IFNULL(pro.num ,0) status + from (select @rowNum := 0) r, + pt_sup_info_data psi left join ( - select DISTINCT sup_uuid from lk_pro_sup - ) lps on psi.uuid = lps.sup_uuid + select count(1) num , sup_unit_id + from pt_project_info + where sup_unit_id is not null and sup_unit_id!='' + GROUP BY sup_unit_id + )pro on pro.sup_unit_id=psi.id + left join( + select count(1) num ,unit_id + FROM pt_sup_info + GROUP BY unit_id + )us on us.unit_id=psi.id where psi.is_active = 1 and psi.sup_name like concat('%',#{unitName},'%') + select role_id from sys_role where role_key = 'sup_person' and del_flag = '0' + + + + + \ No newline at end of file From c09e3e312b80898d539959db1a214a9f403c3abd Mon Sep 17 00:00:00 2001 From: "liang.chao" <1360241448@qq.com> Date: Wed, 12 Feb 2025 10:42:19 +0800 Subject: [PATCH 12/13] =?UTF-8?q?=E5=AD=A6=E5=91=98=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=BB=9F=E8=AE=A1=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/exam/vo/TaskStatisticsVo.java | 28 ++++ .../StudentManagementController.java | 45 ++++-- .../exam/mapper/StudentManagementMapper.java | 14 ++ .../service/StudentManagementService.java | 6 + .../impl/StudentManagementServiceImpl.java | 30 +++- .../mapper/exam/StudentManagementMapper.xml | 138 ++++++++++++++++++ .../project/controller/SubController.java | 5 + .../com/bonus/project/service/SubService.java | 2 + .../project/service/impl/SubServiceImpl.java | 41 ++++-- 9 files changed, 286 insertions(+), 23 deletions(-) create mode 100644 bonus-common/bonus-common-entity/src/main/java/com/bonus/common/exam/vo/TaskStatisticsVo.java diff --git a/bonus-common/bonus-common-entity/src/main/java/com/bonus/common/exam/vo/TaskStatisticsVo.java b/bonus-common/bonus-common-entity/src/main/java/com/bonus/common/exam/vo/TaskStatisticsVo.java new file mode 100644 index 0000000..c05fc6a --- /dev/null +++ b/bonus-common/bonus-common-entity/src/main/java/com/bonus/common/exam/vo/TaskStatisticsVo.java @@ -0,0 +1,28 @@ +package com.bonus.common.exam.vo; + +import lombok.Data; + +import java.util.HashMap; +import java.util.List; + +/** + * @Author:liang.chao + * @Date:2025/2/10 - 14:34 + */ +@Data +public class TaskStatisticsVo { + // 学习任务数量 + private Integer studyTaskCount; + // 培训任务数量 + private Integer trainingTaskCount; + // 考试任务数量 + private Integer examTaskCount; + // 年份 + private Integer year; + // 月份 + private String month; + // 月数量 + private Integer recordCount; + + private List list; +} diff --git a/bonus-modules/bonus-exam/src/main/java/com/bonus/exam/controller/StudentManagementController.java b/bonus-modules/bonus-exam/src/main/java/com/bonus/exam/controller/StudentManagementController.java index 03d0616..e02b826 100644 --- a/bonus-modules/bonus-exam/src/main/java/com/bonus/exam/controller/StudentManagementController.java +++ b/bonus-modules/bonus-exam/src/main/java/com/bonus/exam/controller/StudentManagementController.java @@ -9,6 +9,7 @@ import com.bonus.common.exam.dto.StudentDto; import com.bonus.common.exam.vo.*; import com.bonus.common.log.annotation.SysLog; import com.bonus.common.log.enums.OperaType; +import com.bonus.exam.mapper.StudentManagementMapper; import com.bonus.exam.service.StudentManagementService; import lombok.extern.slf4j.Slf4j; import org.springframework.http.HttpStatus; @@ -19,6 +20,7 @@ import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.util.ArrayList; import java.util.List; +import java.util.Map; import java.util.stream.Collectors; /** @@ -30,11 +32,10 @@ import java.util.stream.Collectors; @RestController @RequestMapping("/studentManagement") @Slf4j -public class StudentManagementController extends BaseController { +public class StudentManagementController extends BaseController { @Resource(name = "StudentManagementService") private StudentManagementService service; - /** * 内部学员列表 * @param dto 实体类 @@ -50,22 +51,23 @@ public class StudentManagementController extends BaseController { } catch (Exception e) { logger.error(e.toString(), e); } - return getDataTableError(new ArrayList<>()); + return getDataTableError(new ArrayList<>()); } @PostMapping("/export") public void export(HttpServletResponse response, @RequestBody StudentDto dto) { - try{ + try { List list = service.selectInternalStudentList(dto); ExcelUtil util = new ExcelUtil(StudentVo.class); util.exportExcel(response, list, "培训"); - }catch (Exception e){ - logger.error(e.toString(),e); + } catch (Exception e) { + logger.error(e.toString(), e); } } /** * 外委学员列表 + * * @param dto 实体类 * @return 数据集合 */ @@ -79,13 +81,13 @@ public class StudentManagementController extends BaseController { } catch (Exception e) { logger.error(e.toString(), e); } - return getDataTableError(new ArrayList<>()); + return getDataTableError(new ArrayList<>()); } @PostMapping("/assignedExport") public void assignedExport(HttpServletResponse response, @RequestBody StudentDto dto) { - try{ + try { List list = service.selectAssignedStudentsList(dto); List lists = new ArrayList<>(); for (StudentVo vo : list) { @@ -102,13 +104,14 @@ public class StudentManagementController extends BaseController { } ExcelUtil util = new ExcelUtil(ForeignAffairVo.class); util.exportExcel(response, lists, "培训"); - }catch (Exception e){ - logger.error(e.toString(),e); + } catch (Exception e) { + logger.error(e.toString(), e); } } /** * 学员档案 + * * @param dto 实体类 * @return 数据集合 */ @@ -122,7 +125,7 @@ public class StudentManagementController extends BaseController { } catch (Exception e) { logger.error(e.toString(), e); } - return getDataTableError(new ArrayList<>()); + return getDataTableError(new ArrayList<>()); } @PostMapping("/studentExport") @@ -209,6 +212,7 @@ public class StudentManagementController extends BaseController { /** * 学员档案--抬头 + * * @param dto 实体类 * @return 数据集合 */ @@ -234,7 +238,7 @@ public class StudentManagementController extends BaseController { } catch (Exception e) { logger.error(e.toString(), e); } - return getDataTableError(new ArrayList<>()); + return getDataTableError(new ArrayList<>()); } @PostMapping("/exportReleaseStatics") @@ -254,4 +258,21 @@ public class StudentManagementController extends BaseController { ExcelUtil util = new ExcelUtil<>(ReleaseVo.class); util.exportExcel(response, list, "考试"); } + + /** + * 任务统计 + * + * @throws IOException + */ + @GetMapping("/getTaskStatistics") + public AjaxResult taskStatistics(TaskStatisticsVo taskStatisticsVo) { + TaskStatisticsVo taskStatistics = service.getTaskStatistics(taskStatisticsVo); + return AjaxResult.success(taskStatistics); + } + + @GetMapping("/getTaskStatisticsByMonth") + public AjaxResult taskStatisticsByMonth(TaskStatisticsVo taskStatisticsVo) { + Map map = service.getTaskStatisticsByMonth(taskStatisticsVo); + return AjaxResult.success(map); + } } diff --git a/bonus-modules/bonus-exam/src/main/java/com/bonus/exam/mapper/StudentManagementMapper.java b/bonus-modules/bonus-exam/src/main/java/com/bonus/exam/mapper/StudentManagementMapper.java index 617dd8a..f2b1491 100644 --- a/bonus-modules/bonus-exam/src/main/java/com/bonus/exam/mapper/StudentManagementMapper.java +++ b/bonus-modules/bonus-exam/src/main/java/com/bonus/exam/mapper/StudentManagementMapper.java @@ -3,10 +3,12 @@ package com.bonus.exam.mapper; import com.bonus.common.exam.dto.StudentDto; import com.bonus.common.exam.vo.ReleaseVo; import com.bonus.common.exam.vo.StudentVo; +import com.bonus.common.exam.vo.TaskStatisticsVo; import org.apache.ibatis.annotations.Param; import org.springframework.stereotype.Repository; import java.util.List; +import java.util.Map; /** * @description:学员管理 @@ -119,4 +121,16 @@ public interface StudentManagementMapper { * @return 数据集合 */ List getReleaseStatics(ReleaseVo dto); + + TaskStatisticsVo getStudyTaskCount(TaskStatisticsVo taskStatisticsVo); + + Integer getTrainingTaskCount(TaskStatisticsVo taskStatisticsVo); + + Integer getExamTaskCount(TaskStatisticsVo taskStatisticsVo); + + List getStudyTaskCountByMonth(TaskStatisticsVo taskStatisticsVo); + + List getTrainingTaskCountByMonth(TaskStatisticsVo taskStatisticsVo); + + List getExamTaskCountByMonth(TaskStatisticsVo taskStatisticsVo); } diff --git a/bonus-modules/bonus-exam/src/main/java/com/bonus/exam/service/StudentManagementService.java b/bonus-modules/bonus-exam/src/main/java/com/bonus/exam/service/StudentManagementService.java index 555e1db..1927932 100644 --- a/bonus-modules/bonus-exam/src/main/java/com/bonus/exam/service/StudentManagementService.java +++ b/bonus-modules/bonus-exam/src/main/java/com/bonus/exam/service/StudentManagementService.java @@ -4,8 +4,10 @@ import com.bonus.common.core.web.domain.AjaxResult; import com.bonus.common.exam.dto.StudentDto; import com.bonus.common.exam.vo.ReleaseVo; import com.bonus.common.exam.vo.StudentVo; +import com.bonus.common.exam.vo.TaskStatisticsVo; import java.util.List; +import java.util.Map; /** * @description:学员管理 @@ -44,4 +46,8 @@ public interface StudentManagementService { * @return 数据集合 */ List getReleaseStatics(ReleaseVo dto); + + TaskStatisticsVo getTaskStatistics(TaskStatisticsVo taskStatisticsVo); + + Map getTaskStatisticsByMonth(TaskStatisticsVo taskStatisticsVo); } diff --git a/bonus-modules/bonus-exam/src/main/java/com/bonus/exam/service/impl/StudentManagementServiceImpl.java b/bonus-modules/bonus-exam/src/main/java/com/bonus/exam/service/impl/StudentManagementServiceImpl.java index 03d87b5..38efb9c 100644 --- a/bonus-modules/bonus-exam/src/main/java/com/bonus/exam/service/impl/StudentManagementServiceImpl.java +++ b/bonus-modules/bonus-exam/src/main/java/com/bonus/exam/service/impl/StudentManagementServiceImpl.java @@ -6,6 +6,7 @@ import com.bonus.common.core.web.domain.AjaxResult; import com.bonus.common.exam.dto.StudentDto; import com.bonus.common.exam.vo.ReleaseVo; import com.bonus.common.exam.vo.StudentVo; +import com.bonus.common.exam.vo.TaskStatisticsVo; import com.bonus.exam.mapper.StudentManagementMapper; import com.bonus.exam.service.StudentManagementService; import lombok.extern.slf4j.Slf4j; @@ -13,7 +14,9 @@ import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; +import java.util.Map; /** * @description:学员管理逻辑处理 @@ -129,7 +132,7 @@ public class StudentManagementServiceImpl implements StudentManagementService { * @param vo 实体类 */ private void selectScore(StudentVo vo) { - StudentVo vo1 = mapper.getExamScore(vo.getId(), vo.getUserId() ,vo.getType()); + StudentVo vo1 = mapper.getExamScore(vo.getId(), vo.getUserId(), vo.getType()); if (vo1 == null) { vo.setScore("0"); vo.setIsPass("否"); @@ -142,7 +145,7 @@ public class StudentManagementServiceImpl implements StudentManagementService { if (StringUtils.isBlank(vo1.getScore()) || "null".equals(vo1.getPassScore())) { vo1.setPassScore("0"); vo.setIsPass("否"); - }else{ + } else { vo.setIsPass(Double.parseDouble(vo1.getScore()) > Double.parseDouble(vo1.getPassScore()) ? "是" : "否"); } @@ -175,6 +178,7 @@ public class StudentManagementServiceImpl implements StudentManagementService { }); return list; } + /** * 统计分析 * @@ -185,4 +189,26 @@ public class StudentManagementServiceImpl implements StudentManagementService { public List getReleaseStatics(ReleaseVo dto) { return mapper.getReleaseStatics(dto); } + + @Override + public TaskStatisticsVo getTaskStatistics(TaskStatisticsVo taskStatisticsVo) { + TaskStatisticsVo studyTaskCount = mapper.getStudyTaskCount(taskStatisticsVo); + Integer trainingTaskCount = mapper.getTrainingTaskCount(taskStatisticsVo); + Integer examTaskCount = mapper.getExamTaskCount(taskStatisticsVo); + studyTaskCount.setTrainingTaskCount(trainingTaskCount); + studyTaskCount.setExamTaskCount(examTaskCount); + return studyTaskCount; + } + + @Override + public Map getTaskStatisticsByMonth(TaskStatisticsVo taskStatisticsVo) { + List studyTaskCountByMonth = mapper.getStudyTaskCountByMonth(taskStatisticsVo); + List trainingTaskCountByMonth = mapper.getTrainingTaskCountByMonth(taskStatisticsVo); + List examTaskCountByMonth = mapper.getExamTaskCountByMonth(taskStatisticsVo); + HashMap map = new HashMap<>(); + map.put("studyTaskCountByMonth", studyTaskCountByMonth); + map.put("trainingTaskCountByMonth", trainingTaskCountByMonth); + map.put("examTaskCountByMonth", examTaskCountByMonth); + return map; + } } diff --git a/bonus-modules/bonus-exam/src/main/resources/mapper/exam/StudentManagementMapper.xml b/bonus-modules/bonus-exam/src/main/resources/mapper/exam/StudentManagementMapper.xml index 1c1f0e9..d26d673 100644 --- a/bonus-modules/bonus-exam/src/main/resources/mapper/exam/StudentManagementMapper.xml +++ b/bonus-modules/bonus-exam/src/main/resources/mapper/exam/StudentManagementMapper.xml @@ -385,4 +385,142 @@ group by create_id)r GROUP BY r.idk + + + + + + + + diff --git a/bonus-modules/bonus-project/src/main/java/com/bonus/project/controller/SubController.java b/bonus-modules/bonus-project/src/main/java/com/bonus/project/controller/SubController.java index 96e50cd..f261193 100644 --- a/bonus-modules/bonus-project/src/main/java/com/bonus/project/controller/SubController.java +++ b/bonus-modules/bonus-project/src/main/java/com/bonus/project/controller/SubController.java @@ -111,6 +111,11 @@ public class SubController extends BaseController { } return AjaxResult.error("审核失败"); } + @PostMapping("/submitPersonApprovalBach") + @SysLog(title = "分包商管理", businessType = OperaType.QUERY,logType = 0,module = "分包商管理->人员入场批量审核") + public AjaxResult submitPersonApprovalBach(@RequestBody List bean) { + return service.submitPersonApprovalBach(bean); + } /** * 入场通知 diff --git a/bonus-modules/bonus-project/src/main/java/com/bonus/project/service/SubService.java b/bonus-modules/bonus-project/src/main/java/com/bonus/project/service/SubService.java index 7851d9c..56af318 100644 --- a/bonus-modules/bonus-project/src/main/java/com/bonus/project/service/SubService.java +++ b/bonus-modules/bonus-project/src/main/java/com/bonus/project/service/SubService.java @@ -52,4 +52,6 @@ public interface SubService { * @return 是否发送成功 */ int sendSubNotice(SubPerson subPerson); + + AjaxResult submitPersonApprovalBach(List bean); } diff --git a/bonus-modules/bonus-project/src/main/java/com/bonus/project/service/impl/SubServiceImpl.java b/bonus-modules/bonus-project/src/main/java/com/bonus/project/service/impl/SubServiceImpl.java index 5d8a5f4..8ef75da 100644 --- a/bonus-modules/bonus-project/src/main/java/com/bonus/project/service/impl/SubServiceImpl.java +++ b/bonus-modules/bonus-project/src/main/java/com/bonus/project/service/impl/SubServiceImpl.java @@ -46,8 +46,10 @@ public class SubServiceImpl implements SubService { private FlowTaskService flowTaskService; @Resource private RemoteUserService remoteUserService; + /** * 检查分包商是否存在 + * * @param bean 监理单位实体 * @return 是否存在 */ @@ -55,8 +57,10 @@ public class SubServiceImpl implements SubService { public int checkIsExistSubName(SubcontractorsEntity bean) { return mapper.checkIsExistSubName(bean); } + /** - * 新增分包商 + * 新增分包商 + * * @param bean 分包商实体 * @return 是否新增成功 */ @@ -89,11 +93,11 @@ public class SubServiceImpl implements SubService { // 抛出异常触发事务回滚 throw new RuntimeException("Failed to addRoleUserLink"); } - }else{ - if (bean.getSubIdCard().equals(user.getIdCard())){ + } else { + if (bean.getSubIdCard().equals(user.getIdCard())) { Long userId = user.getUserId(); bean.setId(Math.toIntExact(userId)); - }else{ + } else { return StaticVariableUtils.NEGATIVE_THREE_INT; } @@ -117,15 +121,15 @@ public class SubServiceImpl implements SubService { // 返回操作结果,可能是插入的记录数或者其他标识 return result; } catch (Exception e) { - log.error("Failed to add subcontractor unit due to exception", e ); + log.error("Failed to add subcontractor unit due to exception", e); // 抛出异常触发事务回滚 TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); } return 0; } - private void addSubPerson(SubcontractorsEntity bean){ - System.out.println("addSubPerson=========="+bean); + private void addSubPerson(SubcontractorsEntity bean) { + System.out.println("addSubPerson==========" + bean); SubPerson subPerson = new SubPerson(); subPerson.setName(bean.getSubPrincipal()); subPerson.setPhone(bean.getSubPrincipalPhone()); @@ -144,6 +148,7 @@ public class SubServiceImpl implements SubService { /** * 分包商人员入场申请列表 + * * @param bean 分包商实体 * @return 分包商入场申请列表 */ @@ -167,6 +172,7 @@ public class SubServiceImpl implements SubService { /** * 人员审核提交 + * * @param bean 实体 * @return 审核结果 */ @@ -186,8 +192,10 @@ public class SubServiceImpl implements SubService { // mapper.delSubPersonToLk(id); return mapper.delSub(id); } + /** * 入场通知 + * * @param subPerson 实体 * @return 是否发送成功 */ @@ -196,14 +204,29 @@ public class SubServiceImpl implements SubService { @Value("${user.url}") private String url; + @Override public int sendSubNotice(SubPerson subPerson) { - String content = subPerson.getProName()+" 即将开工," + - "请及时上传相关入场文件!浏览器网址:"+url+ "初始账号:"+subPerson.getPhone()+",初始密码:"+subcontractorPassword; + String content = subPerson.getProName() + " 即将开工," + + "请及时上传相关入场文件!浏览器网址:" + url + "初始账号:" + subPerson.getPhone() + ",初始密码:" + subcontractorPassword; MsgBean bean = new MsgBean(); bean.setPhone(subPerson.getPhone()); bean.setMsg(content); remoteUserService.setPhoneMsg(bean); return 1; } + + @Override + public AjaxResult submitPersonApprovalBach(List beans) { + try { + for (RequestEntity bean : beans) { + bean.setUserId(String.valueOf(SecurityUtils.getLoginUser().getUserid())); + flowTaskService.approvalFlow(bean); + } + return AjaxResult.success("审核成功"); + } catch (Exception e) { + log.error(e.toString(), e); + return AjaxResult.error("审核失败"); + } + } } From 72b53ce4760f0a512ee40c8eefa5fb528c6064c4 Mon Sep 17 00:00:00 2001 From: "liang.chao" <1360241448@qq.com> Date: Wed, 12 Feb 2025 14:10:04 +0800 Subject: [PATCH 13/13] =?UTF-8?q?=E5=AD=A6=E4=B9=A0=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E4=B8=AD=EF=BC=8C=E6=97=B6=E9=95=BF=E6=9C=AA=E7=BB=9F=E8=AE=A1?= =?UTF-8?q?bug=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/LearningTaskServiceImpl.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/bonus-modules/bonus-exam/src/main/java/com/bonus/exam/service/impl/LearningTaskServiceImpl.java b/bonus-modules/bonus-exam/src/main/java/com/bonus/exam/service/impl/LearningTaskServiceImpl.java index 056b8ef..77e2972 100644 --- a/bonus-modules/bonus-exam/src/main/java/com/bonus/exam/service/impl/LearningTaskServiceImpl.java +++ b/bonus-modules/bonus-exam/src/main/java/com/bonus/exam/service/impl/LearningTaskServiceImpl.java @@ -108,6 +108,22 @@ public class LearningTaskServiceImpl implements LearningTaskService { return bigDecimal.floatValue(); } + public static Float getStudyTimeById(List> list) { + if (CollectionUtils.isEmpty(list)) { + return 0F; + } + BigDecimal bigDecimal = new BigDecimal("0"); + for (Map map : list) { + Object studyTimeObj = map.get("time"); + if (studyTimeObj != null) { + BigDecimal studyTime = BigDecimal.valueOf(Float.parseFloat(String.valueOf(studyTimeObj))); + // 继续处理 studyTime + bigDecimal = bigDecimal.add(studyTime); + } + } + return bigDecimal.floatValue(); + } + @Override @Transactional(rollbackFor = Exception.class) public AjaxResult addStudyTask(MultipartFile file, String params) { @@ -494,7 +510,9 @@ public class LearningTaskServiceImpl implements LearningTaskService { Float time = getStudyTaskById(studyTaskCoursewareTimeList); // 培训人员学习时长 List> studyTimes = mapper.getTaskCoursewareTime(dto.getStudyTaskId()); + Float studyTimeById = getStudyTimeById(studyTimes); for (StudyTaskPersonVo vo : list) { + vo.setStudyTime(studyTimeById); if (CollectionUtils.isNotEmpty(hasExam)) { int num = mapper.getExamRecord(hasExam.get(0), 1, String.valueOf(vo.getUserId())); if (num > 0) {