Merge remote-tracking branch 'origin/master'

This commit is contained in:
liux 2025-02-12 15:17:49 +08:00
commit 4ec7bd6e98
49 changed files with 1120 additions and 173 deletions

View File

@ -0,0 +1,28 @@
package com.bonus.common.exam.vo;
import lombok.Data;
import java.util.HashMap;
import java.util.List;
/**
* @Authorliang.chao
* @Date2025/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<TaskStatisticsVo> list;
}

View File

@ -136,7 +136,7 @@ public class LogAspect
sysLogsVo.setOperaUserName(username);
}
Long userId = SecurityUtils.getUserId();
if (userId!=null && userId!=0l) {
if (userId!=null && userId!=0L) {
sysLogsVo.setUserId(userId.toString());
}
sysLogsVo.setOperaUri(StringUtils.substring(ServletUtils.getRequest().getRequestURI(), 0, 255));

View File

@ -32,6 +32,8 @@ public class GlobalExceptionHandler
public final static String BODY_ERROR="Required request body is missing:";
public final static String DATA_ERROR="Data truncation: Data too long for";
private final static String TRANS_ERR="Transaction rolled back because it has been marked as rollback-only";
/**
* 权限码异常
*/
@ -112,6 +114,9 @@ public class GlobalExceptionHandler
if (msg.contains(DATA_ERROR)){
return AjaxResult.error("数据长度过长");
}
if(msg.contains(TRANS_ERR)){
return AjaxResult.error("操作失败,请检查数据是否正确!");
}
}
String requestUri = request.getRequestURI();
log.error("请求地址'{}',发生未知异常.", requestUri, e);

View File

@ -38,6 +38,9 @@ public class ValidateCodeFilter extends AbstractGatewayFilterFactory<Object>
@Value("${system.jie-enable}")
public boolean jaData;
@Value("${system.jia-enable}")
public boolean jiData;
@Autowired
private ValidateCodeService validateCodeService;
@ -63,7 +66,10 @@ public class ValidateCodeFilter extends AbstractGatewayFilterFactory<Object>
try
{
String rspStr = resolveBodyFromRequest(request);
rspStr= AesCbcUtils.decrypt(rspStr);
if(jiData){
rspStr= AesCbcUtils.decrypt(rspStr);
}
if(StringUtils.isEmpty(rspStr)){
throw new CaptchaException("请求参数异常");
}

View File

@ -83,6 +83,10 @@ public class SupervisoryUnit extends BaseBean {
* 身份证
*/
private String directorsIdCard;
/**
* 身份证
*/
private String commUserCode;
}

View File

@ -155,14 +155,14 @@
<insert id="addSupervisoryUnit">
insert into pt_sup_info(sup_name,
sup_address, legal_name, legal_phone, sup_code, comm_user_id, comm_user_name,
comm_user_phone,
comm_user_phone,comm_user_code,
create_user,
create_id,
uuid,
create_time)
values (#{unitName}, #{unitAddress}, #{corporateName}, #{corporatePhone}, #{socialUnifiedCreditCode}, #{id},
#{directorsName},
#{directorsPhone}, #{createPerson}, #{createPersonId}, #{uuid}, #{createTime})
#{directorsPhone},#{directorsIdCard}, #{createPerson}, #{createPersonId}, #{uuid}, #{createTime})
</insert>
<insert id="insertEngineer">
INSERT INTO pt_pro_address

View File

@ -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<StudentVo> list = service.selectInternalStudentList(dto);
ExcelUtil<StudentVo> util = new ExcelUtil<StudentVo>(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<StudentVo> list = service.selectAssignedStudentsList(dto);
List<ForeignAffairVo> lists = new ArrayList<>();
for (StudentVo vo : list) {
@ -102,13 +104,14 @@ public class StudentManagementController extends BaseController {
}
ExcelUtil<ForeignAffairVo> util = new ExcelUtil<ForeignAffairVo>(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<ReleaseVo> 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);
}
}

View File

@ -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<ReleaseVo> getReleaseStatics(ReleaseVo dto);
TaskStatisticsVo getStudyTaskCount(TaskStatisticsVo taskStatisticsVo);
Integer getTrainingTaskCount(TaskStatisticsVo taskStatisticsVo);
Integer getExamTaskCount(TaskStatisticsVo taskStatisticsVo);
List<TaskStatisticsVo> getStudyTaskCountByMonth(TaskStatisticsVo taskStatisticsVo);
List<TaskStatisticsVo> getTrainingTaskCountByMonth(TaskStatisticsVo taskStatisticsVo);
List<TaskStatisticsVo> getExamTaskCountByMonth(TaskStatisticsVo taskStatisticsVo);
}

View File

@ -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<ReleaseVo> getReleaseStatics(ReleaseVo dto);
TaskStatisticsVo getTaskStatistics(TaskStatisticsVo taskStatisticsVo);
Map getTaskStatisticsByMonth(TaskStatisticsVo taskStatisticsVo);
}

View File

@ -108,6 +108,22 @@ public class LearningTaskServiceImpl implements LearningTaskService {
return bigDecimal.floatValue();
}
public static Float getStudyTimeById(List<Map<String, Object>> list) {
if (CollectionUtils.isEmpty(list)) {
return 0F;
}
BigDecimal bigDecimal = new BigDecimal("0");
for (Map<String, Object> 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<Map<String, Object>> 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) {

View File

@ -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<ReleaseVo> 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<TaskStatisticsVo> studyTaskCountByMonth = mapper.getStudyTaskCountByMonth(taskStatisticsVo);
List<TaskStatisticsVo> trainingTaskCountByMonth = mapper.getTrainingTaskCountByMonth(taskStatisticsVo);
List<TaskStatisticsVo> examTaskCountByMonth = mapper.getExamTaskCountByMonth(taskStatisticsVo);
HashMap<String, Object> map = new HashMap<>();
map.put("studyTaskCountByMonth", studyTaskCountByMonth);
map.put("trainingTaskCountByMonth", trainingTaskCountByMonth);
map.put("examTaskCountByMonth", examTaskCountByMonth);
return map;
}
}

View File

@ -253,10 +253,10 @@
and etu.pro_id = #{proId}
</if>
<if test="type == '1' or type == 1">
and etu.sign_time is not null and etu.sign_time != '' and etu.sign_time != 'null'
and etu.sign_time is not null
</if>
<if test="type == '2' or type == 2">
and (etu.sign_time is null or etu.sign_time = '' or etu.sign_time = 'null')
AND etu.sign_time IS NULL
</if>
</select>
<select id="getExamCount" resultType="java.lang.Integer">
@ -385,4 +385,142 @@
group by create_id)r
GROUP BY r.idk
</select>
<select id="getStudyTaskCount" resultType="com.bonus.common.exam.vo.TaskStatisticsVo">
SELECT
count(*) as studyTaskCount,
YEAR(est.create_time) AS year
FROM
edu_study_task est
where est.is_acrive = '1'
<if test="year != null">
and YEAR(est.create_time) = #{year}
</if>
</select>
<select id="getTrainingTaskCount" resultType="java.lang.Integer">
SELECT
count(*) as trainingTaskCount
FROM
edu_train_task ett
where ett.is_active = '1'
<if test="year != null">
and YEAR(ett.create_time) = #{year}
</if>
</select>
<select id="getExamTaskCount" resultType="java.lang.Integer">
SELECT
count(*) as examTaskCount
FROM
edu_exam_task ext
where ext.is_active = '1'
<if test="year != null">
and YEAR(ext.create_trime) = #{year}
</if>
</select>
<select id="getTrainingTaskCountByMonth" resultType="com.bonus.common.exam.vo.TaskStatisticsVo">
SELECT
m.month,
IFNULL(d.recordCount, 0) AS recordCount
FROM (
SELECT '01' AS month UNION ALL
SELECT '02' UNION ALL
SELECT '03' UNION ALL
SELECT '04' UNION ALL
SELECT '05' UNION ALL
SELECT '06' UNION ALL
SELECT '07' UNION ALL
SELECT '08' UNION ALL
SELECT '09' UNION ALL
SELECT '10' UNION ALL
SELECT '11' UNION ALL
SELECT '12'
) m
LEFT JOIN (
SELECT
DATE_FORMAT(create_time, '%m') AS month,
COUNT(*) AS recordCount
FROM
edu_train_task
WHERE
is_active = '1'
<if test="year != null">
AND YEAR(create_time) = #{year}
</if>
GROUP BY
DATE_FORMAT(create_time, '%Y-%m')
) d ON m.month = d.month
ORDER BY
m.month
</select>
<select id="getExamTaskCountByMonth" resultType="com.bonus.common.exam.vo.TaskStatisticsVo">
SELECT
m.month,
IFNULL(d.recordCount, 0) AS recordCount
FROM (
SELECT '01' AS month UNION ALL
SELECT '02' UNION ALL
SELECT '03' UNION ALL
SELECT '04' UNION ALL
SELECT '05' UNION ALL
SELECT '06' UNION ALL
SELECT '07' UNION ALL
SELECT '08' UNION ALL
SELECT '09' UNION ALL
SELECT '10' UNION ALL
SELECT '11' UNION ALL
SELECT '12'
) m
LEFT JOIN (
SELECT
DATE_FORMAT(create_trime, '%m') AS month,
COUNT(*) AS recordCount
FROM
edu_exam_task
WHERE
is_active = '1'
<if test="year != null">
AND YEAR(create_trime) = #{year}
</if>
GROUP BY
DATE_FORMAT(create_trime, '%Y-%m')
) d ON m.month = d.month
ORDER BY
m.month
</select>
<select id="getStudyTaskCountByMonth" resultType="com.bonus.common.exam.vo.TaskStatisticsVo">
SELECT
m.month,
IFNULL(recordCount, 0) AS recordCount
FROM (
SELECT '01' AS month UNION ALL
SELECT '02' UNION ALL
SELECT '03' UNION ALL
SELECT '04' UNION ALL
SELECT '05' UNION ALL
SELECT '06' UNION ALL
SELECT '07' UNION ALL
SELECT '08' UNION ALL
SELECT '09' UNION ALL
SELECT '10' UNION ALL
SELECT '11' UNION ALL
SELECT '12'
) m
LEFT JOIN (
SELECT
DATE_FORMAT(create_time, '%m') AS month,
COUNT(*) AS recordCount
FROM
edu_study_task
WHERE
is_acrive = '1'
<if test="year != null">
and YEAR(create_time) = #{year}
</if>
GROUP BY
DATE_FORMAT(create_time, '%m')
) d ON m.month = d.month
ORDER BY
m.month
</select>
</mapper>

View File

@ -1,7 +1,6 @@
package com.bonus.flowable.listener;
import com.bonus.flowable.service.BusinessService;
import com.sun.javafx.collections.MappingChange;
import org.flowable.bpmn.model.ExtensionAttribute;
import org.flowable.bpmn.model.FlowElement;
import org.flowable.bpmn.model.UserTask;

View File

@ -377,9 +377,9 @@ public class SysJobServiceImpl implements ISysJobService {
} else if (date.compareTo(delayTime) > 0 && "2".equals(item.getIsCheck())) {
item.setCheckStatus("8");
} else if (date.compareTo(delayTime) <= 0 && !"2".equals(item.getIsCheck())) {
item.setCheckStatus("7");
} else if (date.compareTo(delayTime) > 0 && !"2".equals(item.getIsCheck())) {
item.setCheckStatus("3");
} else if (date.compareTo(delayTime) > 0 && !"2".equals(item.getIsCheck())) {
item.setCheckStatus("7");
}
} else {
//判断整改时间是否大于当前时间
@ -387,9 +387,9 @@ public class SysJobServiceImpl implements ISysJobService {
item.setCheckStatus("2");
} else if (date.compareTo(correctionTime) > 0 && "2".equals(item.getIsCheck())) {
item.setCheckStatus("6");
} else if (date.compareTo(correctionTime) <= 0 && !"2".equals(item.getIsCheck())) {
item.setCheckStatus("5");
} else if (date.compareTo(correctionTime) > 0 && !"2".equals(item.getIsCheck())) {
item.setCheckStatus("5");
} else if (date.compareTo(correctionTime) <= 0 && !"2".equals(item.getIsCheck())) {
item.setCheckStatus("1");
}
}

View File

@ -188,8 +188,8 @@ public class RyTask
}
}
public void updateHiddenDangerStatus() {
public void updateHiddenDangerStatus() {
sysJobService.updateHiddenDangerStatus();
}

View File

@ -117,9 +117,7 @@ public class AdmissionRequestController extends BaseController {
try {
String params = allRequestParams.get("params");
org.json.JSONObject jsonObject = new org.json.JSONObject(params);
if (!arService.checkUserTypeNameUnique(allRequestParams)){
return toAjax(arService.addMataddAdmissionRequesterial(facePhotoList, medicalExaminationList, elseImgList, specialTypeOfWorkList, otherFilesList, allRequestParams));
}else {
if (arService.checkUserTypeNameUnique(allRequestParams)){
arService.addUserName(allRequestParams);
}
return toAjax(arService.addMataddAdmissionRequesterial(facePhotoList, medicalExaminationList, elseImgList, specialTypeOfWorkList, otherFilesList, allRequestParams));

View File

@ -67,7 +67,8 @@ public class DeviceInformationController extends BaseController {
if(!ditService.checkDeviceNameUnique(bean)){
return error("设备名称不能重复!");
}
return toAjax(ditService.addDeviceInformation(bean));
AjaxResult ajaxResult=ditService.addDeviceInformation(bean);
return ajaxResult;
} catch (Exception e) {
log.error(e.toString(), e);
}
@ -87,7 +88,8 @@ public class DeviceInformationController extends BaseController {
if(!ditService.checkDeviceNameUnique(bean)){
return error("设备名称不能重复!");
}
return toAjax(ditService.updateDeviceInformation(bean));
AjaxResult ajaxResult=ditService.updateDeviceInformation(bean);
return ajaxResult;
} catch (Exception e) {
log.error(e.toString(), e);
}

View File

@ -187,22 +187,34 @@ public class ProjectController extends BaseController {
@SysLog(title = "工程管理", businessType = OperaType.INSERT,logType = 0,module = "工程管理->新建工程",details = "新增监理单位")
public AjaxResult addSupervisoryUnit(@Validated @RequestBody SupervisoryUnit bean) {
try{
int code = projectService.addSupervisoryUnit(bean);
if (code == StaticVariableUtils.ZERO_INT) {
return error("新增监理单位失败");
}else if (code == StaticVariableUtils.NEGATIVE_ONE_INT){
return error("新增监理单位失败,总监名称和总监联系方式不匹配,请仔细核对!");
}else if (code == StaticVariableUtils.NEGATIVE_TWO_INT){
return error("新增监理单位失败,总监联系方式已存在!");
}else if(code == StaticVariableUtils.NEGATIVE_THREE_INT){
return error("新增监理单位失败,总监身份证已存在!");
}
return toAjax(1);
return projectService.addSupervisoryUnit(bean);
// if (code == StaticVariableUtils.ZERO_INT) {
// return error("新增监理单位失败");
// }else if (code == StaticVariableUtils.NEGATIVE_ONE_INT){
// return error("新增监理单位失败,总监名称和总监联系方式不匹配,请仔细核对!");
// }else if (code == StaticVariableUtils.NEGATIVE_TWO_INT){
// return error("新增监理单位失败,总监联系方式已存在!");
// }else if(code == StaticVariableUtils.NEGATIVE_THREE_INT){
// return error("新增监理单位失败,总监身份证已存在!");
// }
// return toAjax(1);
}catch (Exception e){
logger.error(e.toString(),e);
}
return error("系统异常,请联系管理员");
}
/**
* 新增监理单位
* @param bean 监理单位实体
* @return 是否新增成功
*/
@PostMapping("/addSupervisoryUnitUser")
@SysLog(title = "工程管理", businessType = OperaType.INSERT,logType = 0,module = "工程管理->新建工程",details = "新增总监信息")
public AjaxResult addSupervisoryUnitUser(@Validated @RequestBody SupervisoryUnit bean) {
return projectService.addSupervisoryUnitUser(bean);
}
/**
* 新增承包商单位
* @param bean 监理单位实体

View File

@ -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<RequestEntity> bean) {
return service.submitPersonApprovalBach(bean);
}
/**
* 入场通知

View File

@ -54,6 +54,24 @@ public class SupervisionUnitController extends BaseController {
return getDataTableError(new ArrayList<>());
}
/**
* 总监
* @param bean
* @return
*/
@RequiresPermissions("system:SupervisionUnit:list")
@GetMapping("/listSupervisionUnitUser")
@SysLog(title = "监理单位管理", businessType = OperaType.QUERY, logType = 0, module = "外来单位管理->监理单位管理", details = "查询监理单位列表")
public TableDataInfo listSupervisionUnitUser(SupervisionUnit bean) {
try {
startPage();
List<SupervisionUnit> list = suService.listSupervisionUnitUser(bean);
return getDataTable(list);
} catch (Exception e) {
logger.error(e.toString(), e);
}
return getDataTableError(new ArrayList<>());
}
/**
* 修改监理单位管理
@ -65,13 +83,45 @@ public class SupervisionUnitController extends BaseController {
@SysLog(title = "监理单位管理", businessType = OperaType.UPDATE, logType = 0, module = "外来单位管理->监理单位管理")
public AjaxResult edit(@Validated @RequestBody SupervisionUnit bean) {
try {
return toAjax(suService.updateSupervisionUnit(bean));
return suService.updateSupervisionUnit(bean);
} catch (Exception e) {
log.error(e.toString(), e);
}
return error("系统异常");
}
/**
* 修改监理单位管理
*
* @param bean 监理单位实体
* @return 结果
*/
@PutMapping("/updateSupervisionUnitUser")
@SysLog(title = "监理单位管理", businessType = OperaType.UPDATE, logType = 0, module = "外来单位管理->监理单位总监")
public AjaxResult updateSupervisionUnitUser(@Validated @RequestBody SupervisionUnit bean) {
try {
return suService.updateSupervisionUnitUser(bean);
} catch (Exception e) {
log.error(e.toString(), e);
}
return error("系统异常");
}
/**
* 删除监理单位管理
*
* @param addressId 监理单位编号
* @return 结果
*/
@DeleteMapping(value = "/delSupervisionUnitUser/{addressId}")
@SysLog(title = "监理单位管理", businessType = OperaType.DELETE, logType = 0, module = "外来单位管理->监理单位管理")
public AjaxResult delSupervisionUnitUser(@PathVariable Long[] addressId) {
try {
return suService.delSupervisionUnitUser(addressId);
} catch (Exception e) {
log.error(e.toString(), e);
}
return error("系统异常");
}
/**
* 删除监理单位管理
*
@ -82,7 +132,7 @@ public class SupervisionUnitController extends BaseController {
@SysLog(title = "监理单位管理", businessType = OperaType.DELETE, logType = 0, module = "外来单位管理->监理单位管理")
public AjaxResult remove(@PathVariable Long[] addressId) {
try {
return toAjax(suService.deleteSupervisionUnitById(addressId));
return suService.deleteSupervisionUnitById(addressId);
} catch (Exception e) {
log.error(e.toString(), e);
}

View File

@ -21,6 +21,8 @@ public class DeviceInformation extends BaseEntity {
*/
private String deviceId;
private String typeCode;
/**
*设备名称
*/
@ -37,6 +39,10 @@ public class DeviceInformation extends BaseEntity {
* 设备类型
*/
private String deviceType;
/**
* 设备状态
*/
private int deviceStatus;
/**
* 设备类型名称

View File

@ -100,10 +100,20 @@ public class Project{
*/
private String supervisorUnitId;
/**
* 总监id
*/
private String supervisorUnitUserId;
/**
* 监理单位名称
*/
private String supervisorUnit;
/**
* 总监名称
*/
private String supervisorUnitUser;
/**
* 承包商Arr

View File

@ -31,6 +31,10 @@ public class SupervisionUnit extends BaseBean implements Serializable {
@Excel(name = "监理单位名称")
private String unitName;
private String userNum;
private String commUserCode;
/**
* 监理单位地址
*/
@ -116,6 +120,7 @@ public class SupervisionUnit extends BaseBean implements Serializable {
* 审核状态
*/
private String status;
private String intoStatus;
}

View File

@ -17,6 +17,14 @@ public class SupervisoryUnit extends BaseBean {
private static final long serialVersionUID = 1L;
private Integer id;
/**
* 监理单位id
*/
private String jlId;
/**
* 监理uuid
*/
private String jlUuid;
/**
* 监理单位名称
*/

View File

@ -65,4 +65,6 @@ public interface DeviceInformationMapper {
* @return 结果
*/
int updateDeviceCode(DeviceInformation bean);
int getDeviceIdByPuid(DeviceInformation bean);
}

View File

@ -290,4 +290,53 @@ public interface ProjectMapper {
* @return
*/
List<BaseBean> 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);
/**
* 添加监理单位数据
* @param bean
* @return
*/
int addSupervisoryUnitUser(SupervisoryUnit bean);
/**
* 查询监理单位信息
* @param bean
* @return
*/
SupervisoryUnit getSupervisoryUnitById(SupervisoryUnit bean);
/**
* 查询监理单位名称是否重复
* @param bean
* @return
*/
int getSupervisoryUnitUser(SupervisoryUnit bean);
}

View File

@ -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);
}

View File

@ -1,9 +1,7 @@
package com.bonus.project.mapper;
import com.bonus.project.domain.Equipment;
import com.bonus.project.domain.SupervisionUnit;
import com.bonus.project.domain.SupervisorPerson;
import com.bonus.project.domain.SupervisionOfAdmission;
import com.bonus.project.domain.*;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -38,6 +36,8 @@ public interface SupervisionUnitMapper {
*/
int deleteSupervisionUnitById(Long[] addressId);
int delSupervisionUnitUser(Long[] addressId);
/**
* 获取监理入场列表
*
@ -119,4 +119,53 @@ public interface SupervisionUnitMapper {
* @return 结果
*/
int updateSupIsExist(SupervisorPerson bean);
/**
* 校验名称是否存在
* @param bean
* @return
*/
int getUnitNameById(SupervisionUnit bean);
/**
* 查询供应商是否和工程关联
* @param id
* @return
*/
List<Project> getSupProNum(@Param("id") Long id);
/**
* 修改用户名称
* @param bean
* @return
*/
int updateUnitUser(SupervisionUnit bean);
/**
* 修改用户表数据
* @param bean
*/
void updateUserInfo(SupervisionUnit bean);
/**
* 修改工程表数据
* @param bean
*/
void updateProUserInfo(SupervisionUnit bean);
/**
*
* @param id
* @return
*/
List<Project> getSupProUserNum(@Param("id") Long id);
List<SupervisionUnit> listSupervisionUnitUser(SupervisionUnit bean);
/**
*
* @param id
* @return
*/
int getUserMapper(Long id);
}

View File

@ -1,5 +1,6 @@
package com.bonus.project.service;
import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.project.domain.DeviceInformation;
import com.bonus.project.domain.DeviceType;
@ -24,7 +25,7 @@ public interface DeviceInformationService {
* @param bean 设备信息实体
* @return 结果
*/
int addDeviceInformation(DeviceInformation bean);
AjaxResult addDeviceInformation(DeviceInformation bean);
/**
* 修改设备信息
@ -32,7 +33,7 @@ public interface DeviceInformationService {
* @param bean 设备信息实体
* @return 结果
*/
int updateDeviceInformation(DeviceInformation bean);
AjaxResult updateDeviceInformation(DeviceInformation bean);
/**
* 删除设备信息

View File

@ -38,7 +38,7 @@ public interface ProjectService {
* @param bean 监理单位实体
* @return 是否新增成功
*/
int addSupervisoryUnit(SupervisoryUnit bean);
AjaxResult addSupervisoryUnit(SupervisoryUnit bean);
/**
* 检查监理单位名称是否存在
* @param bean 监理单位实体
@ -89,4 +89,11 @@ public interface ProjectService {
* @return 是否修改成功
*/
int editProInfo(Project project);
/**
* 添加总监人员数据
* @param bean
* @return
*/
AjaxResult addSupervisoryUnitUser(SupervisoryUnit bean);
}

View File

@ -52,4 +52,6 @@ public interface SubService {
* @return 是否发送成功
*/
int sendSubNotice(SubPerson subPerson);
AjaxResult submitPersonApprovalBach(List<RequestEntity> bean);
}

View File

@ -1,5 +1,6 @@
package com.bonus.project.service;
import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.project.domain.SupervisionUnit;
import com.bonus.project.domain.SupervisionOfAdmission;
import org.springframework.web.multipart.MultipartFile;
@ -19,6 +20,13 @@ public interface SupervisionUnitService {
* @return 监理单位列表
*/
List<SupervisionUnit> listSupervisionUnit(SupervisionUnit bean);
/**
* 获取监理列表
*
* @param bean 监理单位实体
* @return 监理单位列表
*/
List<SupervisionUnit> listSupervisionUnitUser(SupervisionUnit bean);
/**
* 修改监理单位管理
@ -26,7 +34,7 @@ public interface SupervisionUnitService {
* @param bean 监理单位实体
* @return 结果
*/
int updateSupervisionUnit(SupervisionUnit bean);
AjaxResult updateSupervisionUnit(SupervisionUnit bean);
/**
* 删除监理单位管理
@ -34,7 +42,7 @@ public interface SupervisionUnitService {
* @param addressId 监理单位编号
* @return 结果
*/
int deleteSupervisionUnitById(Long[] addressId);
AjaxResult deleteSupervisionUnitById(Long[] addressId);
/**
* 获取监理入场列表
@ -63,4 +71,18 @@ public interface SupervisionUnitService {
* @return 是否新增成功
*/
int addSupervisoryApply(MultipartFile[] enterpriseQualificationFiles, MultipartFile[] securityAgreementFiles, MultipartFile[] supervisionPlanningFiles, MultipartFile[] implementationRulesFiles, Map<String, String> allRequestParams);
/**
* 修改监理单位人员
* @param bean
* @return
*/
AjaxResult updateSupervisionUnitUser(SupervisionUnit bean);
/**
* 删除监理人员
* @param addressId
* @return
*/
AjaxResult delSupervisionUnitUser(Long[] addressId);
}

View File

@ -2,10 +2,12 @@ package com.bonus.project.service.impl;
import com.bonus.common.core.constant.UserConstants;
import com.bonus.common.core.utils.StringUtils;
import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.common.security.utils.SecurityUtils;
import com.bonus.project.domain.DeviceInformation;
import com.bonus.project.mapper.DeviceInformationMapper;
import com.bonus.project.service.DeviceInformationService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -20,6 +22,7 @@ import java.util.UUID;
* &#064;date 2024-07-11
*/
@Service
@Slf4j
public class DeviceInformationServiceImpl implements DeviceInformationService {
@Autowired
@ -45,33 +48,34 @@ public class DeviceInformationServiceImpl implements DeviceInformationService {
*/
@Override
@Transactional(rollbackFor = Exception.class)
public int addDeviceInformation(DeviceInformation bean) {
public AjaxResult addDeviceInformation(DeviceInformation bean) {
int code = 0;
try {
// 使用UUID改进设备编号生成机制
String uniquePartOfDeviceCode = UUID.randomUUID().toString().replace("-", "").substring(0, 3);
bean.setDeviceCode(bean.getDeviceTypeName() + "-" + uniquePartOfDeviceCode);
// 设置创建者和创建ID
bean.setCreateUser(SecurityUtils.getUsername());
Long userId = SecurityUtils.getUserId();
bean.setCreateId(userId.toString());
code = ditMapper.addDeviceType(bean);
if (code == 0){
throw new RuntimeException("新增设备信息失败");
int nums=ditMapper.getDeviceIdByPuid(bean);
if(nums>0){
return AjaxResult.error("设备puId与摄像头已存在");
}
String id = String.format("%03d", Integer.parseInt(bean.getDeviceId()));
bean.setDeviceCode(bean.getDeviceTypeName() + "-" + id);
code = ditMapper.updateDeviceCode(bean);
if (code == 0){
throw new RuntimeException("修改设备编码失败");
code = ditMapper.addDeviceType(bean);
if (code >0){
String id = String.format("%03d", Integer.parseInt(bean.getDeviceId()));
bean.setDeviceCode(bean.getDeviceTypeName() + "-" + id);
code = ditMapper.updateDeviceCode(bean);
if (code == 0){
return AjaxResult.error("修改设备编码失败");
}
return AjaxResult.success("新增成功");
}
} catch (Exception e) {
throw new RuntimeException("新增设备信息失败");
log.error(e.toString(),e);
}
return code;
return AjaxResult.error("新增设备失败");
}
/**
@ -81,8 +85,20 @@ public class DeviceInformationServiceImpl implements DeviceInformationService {
* @return 结果
*/
@Override
public int updateDeviceInformation(DeviceInformation bean) {
return ditMapper.updateDeviceInformation(bean);
public AjaxResult updateDeviceInformation(DeviceInformation bean) {
try{
int nums=ditMapper.getDeviceIdByPuid(bean);
if(nums>0){
return AjaxResult.error("设备puId与摄像头已存在");
}
int num= ditMapper.updateDeviceInformation(bean);
if(num>0){
return AjaxResult.success("修改成功");
}
}catch (Exception e){
log.error(e.toString(),e);
}
return AjaxResult.error("修改失败");
}
/**

View File

@ -211,11 +211,14 @@ public class ImportServiceImpl implements ImportService {
}else{
ajaxResult.put("result",builder);
}
if(inLibraryList.isEmpty()){
ajaxResult.put("result","此zip内文件在系统内无对应人员导入失败");
}
} catch (Exception e) {
log.error(e.toString(),e);
ajaxResult.isError();
// throw new Exception("文件上传失败"+e);
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
return AjaxResult.error("导入模板不正确");
}
return ajaxResult;
@ -414,10 +417,18 @@ 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<FileHeader> list = zipFile.getFileHeaders();
//判断文件名是否乱码
if (isMessyCode(list.get(0).getFileName())) {
encoding = "UTF-8";
//对文件名进行重新编码
zipFile = new ZipFile(path);
zipFile.setFileNameCharset(encoding);
list = zipFile.getFileHeaders();
}
Set<String> uniqueNames = new HashSet<>();
String beforeName = "";
StringBuilder folderName = new StringBuilder();
@ -440,7 +451,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 +460,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 +467,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 +477,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 +484,8 @@ public class ImportServiceImpl implements ImportService {
} catch (ArrayIndexOutOfBoundsException e) {
log.error("文件导入识别到不存在文件夹的文件");
}
}else if (i == (list.size() - 1)){
map.put(beforeName, folderName.toString());
}
i++;
}

View File

@ -7,6 +7,8 @@ import com.bonus.project.mapper.ProMaterialManagementMapper;
import com.bonus.project.service.ProMaterialManagementService;
import com.bonus.system.api.RemoteFileService;
import com.bonus.system.api.domain.SysFile;
import lombok.extern.slf4j.Slf4j;
import org.hibernate.validator.internal.util.StringHelper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
@ -22,6 +24,7 @@ import java.util.List;
* Description:工程资料管理 逻辑处理层
*/
@Service
@Slf4j
public class ProMaterialManagementServiceImpl implements ProMaterialManagementService {
@Resource
private ProMaterialManagementMapper mapper;
@ -62,7 +65,6 @@ public class ProMaterialManagementServiceImpl implements ProMaterialManagementSe
@Transactional(rollbackFor = Exception.class)
public int engineeringMaterialUpload(MultipartFile[] fileList, String proId, String uploadType) {
int code = 0;
for (MultipartFile file : fileList) {
try {
// 获取文件名
@ -72,12 +74,14 @@ public int engineeringMaterialUpload(MultipartFile[] fileList, String proId, Str
// 获取文件路径
R<SysFile> fileResult = remoteFileService.upload(file);
if (fileResult == null || fileResult.getData() == null) {
throw new RuntimeException("Failed to upload file");
throw new RuntimeException("文件上传异常");
}
String materialPath = fileResult.getData().getUrl();
// 保存文件信息
ProMaterialManagement bean = new ProMaterialManagement();
if(StringHelper.isNullOrEmptyString(proId) || "undefined".equals(proId)){
throw new RuntimeException("未选择工程");
}
bean.setProId(Long.valueOf(proId));
bean.setMaterialName(materialName);
bean.setMaterialSize(Long.toString(materialSize));
@ -85,10 +89,10 @@ public int engineeringMaterialUpload(MultipartFile[] fileList, String proId, Str
bean.setMaterialType(uploadType);
bean.setCreateName(SecurityUtils.getUsername());
bean.setCreateUser(SecurityUtils.getUserId());
code += mapper.insertProMaterial(bean);
} catch (Exception e) {
throw new RuntimeException("Failed to add upload file due to exception", e);
log.error(e.toString(),e);
throw new RuntimeException("文件上传入库失败", e);
}
}

View File

@ -15,7 +15,9 @@ import com.bonus.project.mapper.AdmissionRequestMapper;
import com.bonus.project.mapper.ProjectMapper;
import com.bonus.project.service.ProjectService;
import com.bonus.system.api.RemoteUserService;
import com.sun.corba.se.spi.presentation.rmi.IDLNameTranslator;
import lombok.extern.slf4j.Slf4j;
import org.hibernate.validator.internal.util.StringHelper;
import org.jetbrains.annotations.NotNull;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
@ -151,6 +153,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);
@ -166,8 +173,25 @@ public class ProjectServiceImpl implements ProjectService {
*/
@Override
@Transactional(rollbackFor = Exception.class)
public int addSupervisoryUnit(SupervisoryUnit bean) {
public AjaxResult addSupervisoryUnit(SupervisoryUnit bean) {
//设置回滚点
Object savePoint = TransactionAspectSupport.currentTransactionStatus().createSavepoint();
try {
if(StringHelper.isNullOrEmptyString(bean.getJlId())){
return AjaxResult.error("请先选择监理单位");
}else {
//对监理人员信息进行赋值
SupervisoryUnit unit= projectMapper.getSupervisoryUnitById(bean);
if(unit==null){
return AjaxResult.error("监理单位不存在");
}
bean.setJlUuid(unit.getJlUuid());
bean.setUnitAddress(unit.getUnitAddress());
bean.setUnitName(unit.getUnitName());
bean.setCorporateName(unit.getCorporateName());
bean.setCorporatePhone(unit.getCorporatePhone());
bean.setSocialUnifiedCreditCode(unit.getSocialUnifiedCreditCode());
}
// 新增监理信息到人员表
bean.setPassword(SecurityUtils.encryptPassword(StaticVariableUtils.SUPERVISION_PASSWORD));
bean.setCreateTime(DateUtils.getTime());
@ -181,7 +205,7 @@ public class ProjectServiceImpl implements ProjectService {
//查询身份证是否重复
result = projectMapper.checkIsExistIdCard(bean.getDirectorsIdCard());
if (result > 0) {
return -3;
return AjaxResult.error("总监身份证号码已存在!");
}
// 添加监理信息到人员表
AdmissionRequest admissionRequest = new AdmissionRequest();
@ -190,8 +214,9 @@ public class ProjectServiceImpl implements ProjectService {
bean.setDeptId(deptId);
result = projectMapper.addDirectors(bean);
if (result <= 0) {
TransactionAspectSupport.currentTransactionStatus().rollbackToSavepoint(savePoint);
// 抛出异常触发事务回滚
throw new RuntimeException("Failed to add directors");
return AjaxResult.error("添加总监人员失败!");
}
//向SysUser bean中添加监理人员id
SysUser sysUser = new SysUser();
@ -205,27 +230,53 @@ public class ProjectServiceImpl implements ProjectService {
insertUserPost(sysUser);
// 新增用户角色信息
insertUserRole(Long.valueOf(bean.getId()), roleIds);
} else {
return -2;
return AjaxResult.error("总监手机号已存在!");
}
// 添加监理信息到监理单位表
result = projectMapper.addSupervisoryUnit(bean);
if (result <= 0) {
if (result > 0) {
// 抛出异常触发事务回滚
throw new RuntimeException("Failed to add supervisory unit");
TransactionAspectSupport.currentTransactionStatus().rollbackToSavepoint(savePoint);
return AjaxResult.success("添加成功");
}
// 返回操作结果可能是插入的记录数或者其他标识
return result;
} catch (Exception e) {
// 抛出异常触发事务回滚
throw new RuntimeException("Failed to add supervisory unit due to exception", e);
// 手动进行回滚
TransactionAspectSupport.currentTransactionStatus().rollbackToSavepoint(savePoint);
log.error(e.toString(),e);
}
return AjaxResult.error("添加总监人员失败,请联系管理员!");
}
@Override
public AjaxResult addSupervisoryUnitUser(SupervisoryUnit bean) {
try{
int nums=projectMapper.getSupervisoryUnitUser(bean);
if(nums>0){
return AjaxResult.error("监理单位名称已存在");
}
// 新增监理信息到人员表
bean.setCreateTime(DateUtils.getTime());
bean.setCreatePerson(SecurityUtils.getUsername());
bean.setCreatePersonId(String.valueOf(SecurityUtils.getUserId()));
bean.setUuid(StringUtils.getUuid());
int successNum=projectMapper.addSupervisoryUnitUser(bean);
if(successNum<1){
return AjaxResult.error("监理单位添加失败,请联系管理员");
}
return AjaxResult.success("添加成功",bean);
}catch (Exception e){
log.error(e.toString(),e);
}
return AjaxResult.error("监理单位添加失败,请联系管理员");
}
/**
* 新增承包商单位
*
* @param bean 监理单位实体
* @return 是否新增成功
*/
@ -348,7 +399,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 +472,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,11 +515,14 @@ 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;
}
/**
* 插入关联信息
*
@ -474,11 +534,13 @@ public class ProjectServiceImpl implements ProjectService {
//插入监理-工程关联信息
if (StaticVariableUtils.TWO.equals(project.getProType())) {
project.setRelateUuid(StringUtils.getUuid());
project.setSupUuid(projectMapper.getSupUuid(project.getSupervisorUnitId()));
project.setSupUuid(projectMapper.getSupUuid(project.getSupervisorUnitUserId()));
result = projectMapper.addSupervisoryProject(project);
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 +560,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 +574,37 @@ public class ProjectServiceImpl implements ProjectService {
}
return result;
}
/**
* 新增监理人员
*
* @param project 工程实体
*/
private void addSupPerson(Project project) {
// TODO 获取监理信息 --- 新增监理信息到监理人员表
SubPerson subPerson = projectMapper.getSupPerson(project.getSupervisorUnitUserId());
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);
}
/**
* 新增用户岗位信息

View File

@ -22,6 +22,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.ArrayList;
@ -48,8 +49,10 @@ public class SubServiceImpl implements SubService {
private FlowTaskService flowTaskService;
@Resource
private RemoteUserService remoteUserService;
/**
* 检查分包商是否存在
*
* @param bean 监理单位实体
* @return 是否存在
*/
@ -57,8 +60,10 @@ public class SubServiceImpl implements SubService {
public int checkIsExistSubName(SubcontractorsEntity bean) {
return mapper.checkIsExistSubName(bean);
}
/**
* 新增分包商
* 新增分包商
*
* @param bean 分包商实体
* @return 是否新增成功
*/
@ -91,11 +96,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;
}
@ -114,16 +119,39 @@ 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 );
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 分包商实体
* @return 分包商入场申请列表
*/
@ -167,6 +195,7 @@ public class SubServiceImpl implements SubService {
/**
* 人员审核提交
*
* @param bean 实体
* @return 审核结果
*/
@ -182,10 +211,14 @@ public class SubServiceImpl implements SubService {
*/
@Override
public int delSub(int id) {
// mapper.delSubPersonToPcp(id);
// mapper.delSubPersonToLk(id);
return mapper.delSub(id);
}
/**
* 入场通知
*
* @param subPerson 实体
* @return 是否发送成功
*/
@ -194,14 +227,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<RequestEntity> 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("审核失败");
}
}
}

View File

@ -5,12 +5,10 @@ import com.bonus.common.core.domain.RequestEntity;
import com.bonus.common.core.utils.DateUtils;
import com.bonus.common.core.utils.StaticVariableUtils;
import com.bonus.common.core.utils.StringUtils;
import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.common.security.utils.SecurityUtils;
import com.bonus.project.controller.GenericProcessor;
import com.bonus.project.domain.Equipment;
import com.bonus.project.domain.SupervisionUnit;
import com.bonus.project.domain.SupervisorPerson;
import com.bonus.project.domain.SupervisionOfAdmission;
import com.bonus.project.domain.*;
import com.bonus.project.mapper.CommonMapper;
import com.bonus.project.mapper.SupervisionUnitMapper;
import com.bonus.project.service.FlowTaskService;
@ -58,7 +56,16 @@ public class SupervisionUnitServiceImpl implements SupervisionUnitService {
public List<SupervisionUnit> listSupervisionUnit(SupervisionUnit bean) {
return suMapper.listSupervisionUnit(bean);
}
/**
* 获取监理单位列表
*
* @param bean 监理单位实体
* @return 监理单位列表
*/
@Override
public List<SupervisionUnit> listSupervisionUnitUser(SupervisionUnit bean) {
return suMapper.listSupervisionUnitUser(bean);
}
/**
* 修改监理单位管理
*
@ -66,8 +73,16 @@ public class SupervisionUnitServiceImpl implements SupervisionUnitService {
* @return 结果
*/
@Override
public int updateSupervisionUnit(SupervisionUnit bean) {
return suMapper.updateSupervisionUnit(bean);
public AjaxResult updateSupervisionUnit(SupervisionUnit bean) {
int isActive= suMapper.getUnitNameById(bean);
if(isActive>0){
return AjaxResult.error("监理单位名称已存在");
}
int num= suMapper.updateSupervisionUnit(bean);
if(num>0){
return AjaxResult.success("修改成功");
}
return AjaxResult.error("修改失败");
}
/**
@ -77,10 +92,28 @@ public class SupervisionUnitServiceImpl implements SupervisionUnitService {
* @return 结果
*/
@Override
public int deleteSupervisionUnitById(Long[] addressId) {
return suMapper.deleteSupervisionUnitById(addressId);
public AjaxResult deleteSupervisionUnitById(Long[] addressId) {
for (Long id : addressId) {
List<Project> list = suMapper.getSupProNum(id);
if (StringUtils.isNotEmpty(list)) {
return AjaxResult.success(list.get(0).getSupervisorUnit() + "存在工程信息,不允许删除");
}
int userNum=suMapper.getUserMapper(id);
if(userNum>0){
return AjaxResult.success(list.get(0).getSupervisorUnit() + "该监理下存在总监,不允许删除");
}
}
int num= suMapper.deleteSupervisionUnitById(addressId);
if(num>0){
return AjaxResult.success("删除成功");
}
return AjaxResult.error("删除失败");
}
/**
* 获取监理入场列表
*
@ -336,6 +369,50 @@ public class SupervisionUnitServiceImpl implements SupervisionUnitService {
return code;
}
/**
* 修改监理单位人员
* @param bean
* @return
*/
@Override
public AjaxResult updateSupervisionUnitUser(SupervisionUnit bean) {
try{
int num=suMapper.updateUnitUser(bean);
if(num>0){
suMapper.updateUserInfo(bean);
suMapper.updateProUserInfo(bean);
return AjaxResult.success("修改成功");
}
}catch (Exception e){
log.error(e.toString(),e);
}
return AjaxResult.error("修改失败");
}
/**
* 删除监理人员数据
* @param addressId
* @return
*/
@Override
public AjaxResult delSupervisionUnitUser(Long[] addressId) {
if(addressId.length>0){
for (Long id:addressId){
List<Project> list = suMapper.getSupProUserNum(id);
if(StringUtils.isNotEmpty(list)){
return AjaxResult.success(list.get(0).getSupervisorUnit()+"存在工程信息,不允许删除");
}
}
}
int num= suMapper.delSupervisionUnitUser(addressId);
if(num>0){
return AjaxResult.success("删除成功");
}
return AjaxResult.error("删除失败");
}
private int qualificationMaterialsFile(@NotNull String filePath, int proId,
long fileSize, String fromType,
String informationType, String uuid) {

View File

@ -432,6 +432,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
FROM sys_user
WHERE phonenumber = #{phone}
AND del_flag = '0'
limit 1
</select>
<select id="checkUserType" resultType="com.bonus.project.domain.AdmissionRequest">
SELECT user_id AS id
@ -439,6 +440,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
WHERE phonenumber = #{phone}
AND user_type = #{userType}
AND del_flag = '0'
limit 1
</select>
<select id="getDeptId" resultType="java.lang.String">
select

View File

@ -5,9 +5,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<mapper namespace="com.bonus.project.mapper.DeviceInformationMapper">
<insert id="addDeviceType" useGeneratedKeys="true" keyProperty="deviceId">
INSERT INTO pf_device_info (device_code, device_name, device_type, device_model, device_user, device_phone,
create_id, create_user, create_time, is_active,puid,ball_index)
create_id, create_user, create_time, is_active,puid,ball_index,type_code,device_status)
VALUES (#{deviceCode}, #{deviceName}, #{deviceType}, #{deviceModel}, #{deviceUser}, #{devicePhone},
#{createId}, #{createUser}, now(), '1',#{puid},#{ballIndex})
#{createId}, #{createUser}, now(), '1',#{puid},#{ballIndex},#{typeCode},#{deviceStatus})
</insert>
<update id="updateDeviceInformation">
UPDATE pf_device_info SET
@ -16,7 +16,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
device_phone = #{devicePhone},
puid = #{puid},
ball_index = #{ballIndex},
update_time = now()
update_time = now(),
type_code=#{typeCode},
device_status=#{deviceStatus}
WHERE device_id = #{deviceId}
</update>
<update id="updateDeviceCode">
@ -41,7 +43,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
pdi.device_phone AS devicePhone,
pdi.create_user AS createUser,
pdi.create_time AS createTime,
pdi.puid,
pdi.puid, pdi.device_status deviceStatus,
pdi.type_code typeCode,
pdi.ball_index as ballIndex,
if(ppi.pro_name IS NULL, '无', ppi.pro_name) AS proName
FROM
@ -87,4 +90,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{deviceId}
</foreach>
</select>
<select id="getDeviceIdByPuid" resultType="java.lang.Integer">
select count(1)
from pf_device_info
where is_active=1 and puid=#{puid} and ball_index=#{ballIndex}
<if test="deviceId!=null and deviceId!=''">
and device_id!=#{deviceId}
</if>
</select>
</mapper>

View File

@ -10,17 +10,21 @@
'01', '1', '0', #{createPerson}, #{createTime}, '1,2,3', #{deptId},#{uuid},#{directorsIdCard})
</insert>
<insert id="addSupervisoryUnit">
insert into pt_sup_info(sup_name,
sup_address, legal_name, legal_phone, sup_code, comm_user_id, comm_user_name,
comm_user_phone,
create_user,
create_id,
uuid,
create_time)
values (#{unitName}, #{unitAddress}, #{corporateName}, #{corporatePhone}, #{socialUnifiedCreditCode}, #{id},
#{directorsName},
#{directorsPhone}, #{createPerson}, #{createPersonId}, #{uuid}, #{createTime})
insert into pt_sup_info
(sup_name, unit_id,unit_uuid, sup_address, legal_name, legal_phone, sup_code, comm_user_id, comm_user_name,
comm_user_phone, comm_user_code,create_user, create_id, uuid, create_time)
values (#{unitName}, #{jlId},#{jlUuid},#{unitAddress}, #{corporateName}, #{corporatePhone}, #{socialUnifiedCreditCode}, #{id},
#{directorsName}, #{directorsPhone}, #{directorsIdCard},#{createPerson}, #{createPersonId}, #{uuid}, #{createTime})
</insert>
<insert id="addSupervisoryUnitUser" useGeneratedKeys="true" keyProperty="id">
insert into pt_sup_info_data(
uuid, sup_name, sup_address, legal_name, legal_phone, sup_code, create_time,
update_time, create_id, create_user, is_active
)values (#{uuid},#{unitName},#{unitAddress},#{corporateName},#{corporatePhone},#{socialUnifiedCreditCode},
now(),now(),#{createPersonId},#{createPerson},1)
</insert>
<insert id="addConsUnit">
insert into pt_cont_info(cont_name, cont_address, legal_name, legal_phone, sup_code, con_usert_id,
comm_usert_name, comm_usert_phone, create_user, create_id, uuid)
@ -36,12 +40,13 @@
</insert>
<insert id="addProInfo" useGeneratedKeys="true" keyProperty="proId">
insert into pt_project_info(pro_name,pro_user_id, pro_user_name, pro_user_phone, pro_type, is_outsource,
plan_start_time,
plan_end_time, sup_unit_id, sup_unit_name, pro_status, create_user, create_id, uuid)
plan_start_time, plan_end_time, sup_unit_id, sup_unit_name,
sup_user_id,sup_user_name,
pro_status, create_user, create_id, uuid)
values (#{proName}, #{proLeaderId},#{proLeader}, #{proLeaderPhone}, #{proType}, #{isOutsourcing}, #{startDate},
#{endDate},
#{supervisorUnitId},
#{supervisorUnit}, '1', #{createPerson}, #{createPersonId}, #{uuid})
#{endDate}, #{supervisorUnitId}, #{supervisorUnit},
#{supervisorUnitUserId},#{supervisorUnitUser},
'1', #{createPerson}, #{createPersonId}, #{uuid})
</insert>
<insert id="addSupervisoryProject">
insert into lk_pro_sup(pro_id, sup_uuid, uuid)
@ -71,6 +76,23 @@
(#{item.userId},#{item.roleId})
</foreach>
</insert>
<insert id="addSupPersonToPsi" useGeneratedKeys="true" keyProperty="id">
insert into pt_sup_person(sup_name, phone, post, is_active)
values (#{name}, #{phone}, '1','1')
</insert>
<insert id="addSupPersonToLk">
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>
<insert id="addConsPersonToPcp" useGeneratedKeys="true" keyProperty="id">
insert into pt_cons_person(cons_name, phone, post, is_active)
values (#{name}, #{phone},'0', '1')
</insert>
<insert id="addConsPersonToLk">
insert into lk_cont_person(uuid,pro_id, cons_persion_id,cont_uuid,is_exist_file)
values (#{uuid}, #{proId},#{id},#{consUuid},'0')
</insert>
<update id="preparation">
update pt_project_info
set pro_status = '2'
@ -89,7 +111,9 @@
sup_unit_id = #{supervisorUnitId},
sup_unit_name = #{supervisorUnit},
create_user = #{createPerson},
create_id = #{createPersonId}
create_id = #{createPersonId},
sup_user_id = #{supervisorUnitUserId},
sup_user_name = #{supervisorUnitUser}
where pro_id = #{proId}
</update>
<update id="updateUserStatus">
@ -129,6 +153,26 @@
from lk_pro_sup
where pro_id = #{proId}
</delete>
<delete id="delSupPersonToPsi">
delete
from pt_sup_person
where sup_user_id = (select sup_persion_id from lk_sup_person where pro_id = #{proId})
</delete>
<delete id="delSupPersonToLk">
delete
from lk_sup_person
where pro_id = #{proId}
</delete>
<delete id="delConsPersonToPcp">
delete
from pt_cons_person
where cons_user_id in (select cons_persion_id from lk_cont_person where pro_id = #{proId})
</delete>
<delete id="delConsPersonToLk">
delete
from lk_cont_person
where pro_id = #{proId}
</delete>
<select id="selectPostList" resultType="com.bonus.project.domain.Project">
select
@ -183,9 +227,7 @@
select user_id as userId,
user_name as userName
from sys_user
where phonenumber = #{directorsPhone}
and del_flag = '0'
and status = '0'
where phonenumber = #{directorsPhone} and del_flag = '0'
limit 1
</select>
<select id="checkIsExistConsName" resultType="java.lang.Integer">
@ -229,6 +271,8 @@
ppi.plan_end_time as endDate,
IFNULL(ppi.sup_unit_id, '') as supervisorUnitId,
ppi.sup_unit_name as supervisorUnit,
IFNULL(ppi.sup_user_id, '') as supervisorUnitUserId,
ppi.sup_user_name as supervisorUnitUser,
ppi.pro_status as proStatus,
ppi.create_user as createPerson,
ppi.create_time as createTime
@ -356,4 +400,36 @@
lpc.pro_id = #{proId}
AND su.user_type = '02'
</select>
<select id="getSupPerson" resultType="com.bonus.project.domain.SubPerson">
select
sup_id as supId,
uuid as supUuid,
comm_user_name as name,
comm_user_phone as phone
from pt_sup_info
where sup_id = #{supervisorUnitId}
</select>
<select id="getConsPerson" resultType="com.bonus.project.domain.SubPerson">
select
cont_id as consId,
uuid as consUuid,
comm_usert_name as name,
comm_usert_phone as phone
from pt_cont_info
where cont_id = #{consId}
</select>
<select id="getSupervisoryUnitById" resultType="com.bonus.project.domain.SupervisoryUnit">
select id jlId, uuid jlUuid, sup_name unitName, sup_address unitAddress, legal_name corporateName, legal_phone corporatePhone,
sup_code socialUnifiedCreditCode
from pt_sup_info_data
where id=#{jlId}
</select>
<select id="getSupervisoryUnitUser" resultType="java.lang.Integer">
select count(1)
from pt_sup_info_data
where sup_name=#{unitName}
AND is_active=1
</select>
</mapper>

View File

@ -25,11 +25,31 @@
insert into sys_user_role(user_id, role_id)
values (#{id}, '8')
</insert>
<insert id="addSubPersonToPcp" useGeneratedKeys="true" keyProperty="id">
insert into pt_cons_person(cons_name,phone,id_card,is_active)
values(#{name},#{phone},#{idCard},'1')
</insert>
<insert id="addSubPersonToLk">
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})
</insert>
<delete id="delSub">
update pt_sub_info
set is_active = '0'
where sub_id = #{id}
</delete>
<delete id="delSubPersonToPcp">
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>
<delete id="delSubPersonToLk">
delete
from lk_cont_person
where uuid = (select uuid from pt_sub_info where sub_id = #{id})
</delete>
<select id="checkIsExistSubName" resultType="java.lang.Integer">

View File

@ -27,13 +27,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
values(#{id}, #{roleId})
</insert>
<update id="updateSupervisionUnit">
update pt_sup_info
update pt_sup_info_data
set sup_name = #{unitName},
sup_address = #{unitAddress},
legal_name = #{corporateName},
legal_phone = #{corporatePhone},
sup_code = #{socialUnifiedCreditCode}
where sup_id = #{supId}
where id = #{supId}
</update>
<update id="updateLinkRelation">
update lk_pro_sup
@ -72,7 +72,29 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
set is_exist_file = '1'
where uuid = #{uuid}
</update>
<update id="updateUnitUser">
update pt_sup_info
set comm_user_name=#{directorsName}
where sup_id=#{supId}
</update>
<update id="updateUserInfo">
update sys_user
set nick_name=#{directorsName}
where user_id=#{commUserId}
</update>
<update id="updateProUserInfo">
update pt_project_info
set sup_user_name=#{directorsName}
where sup_user_id=#{supId}
</update>
<delete id="deleteSupervisionUnitById">
update pt_sup_info_data set is_active = '0' where id in
<foreach item="addressId" collection="array" open="(" separator="," close=")">
#{addressId}
</foreach>
</delete>
<delete id="delSupervisionUnitUser">
update pt_sup_info set is_active = '0' where sup_id in
<foreach item="addressId" collection="array" open="(" separator="," close=")">
#{addressId}
@ -81,26 +103,47 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="listSupervisionUnit" resultType="com.bonus.project.domain.SupervisionUnit">
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
<if test="unitName != null and unitName != ''">
and psi.sup_name like concat('%',#{unitName},'%')
</if>
</select>
<select id="listSupervisionUnitUser" resultType="com.bonus.project.domain.SupervisionUnit">
select (@rowNum := @rowNum + 1) as exportId,
sup_id supId,
comm_user_id commUserId,
comm_user_name directorsName,
comm_user_phone directorsPhone,
comm_user_code commUserCode
from (select @rowNum := 0) r,
pt_sup_info
where is_active=1 and unit_id=#{unitId}
<if test="directorsName != null and directorsName != ''">
and comm_user_phone like concat('%',#{directorsName},'%')
</if>
</select>
<select id="listSupEntry" resultType="com.bonus.project.domain.SupervisionOfAdmission">
SELECT
psi.sup_id as supId,
@ -141,4 +184,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="getRoleId" resultType="java.lang.String">
select role_id from sys_role where role_key = 'sup_person' and del_flag = '0'
</select>
<select id="getUnitNameById" resultType="java.lang.Integer">
select count(1)
from pt_sup_info_data
where is_active=1 and id!=#{supId} and sup_name=#{supName}
</select>
<select id="getSupProNum" resultType="com.bonus.project.domain.Project">
select pro_id proId,sup_unit_name supervisorUnit
from pt_project_info
where is_active=1 and sup_unit_id=#{id}
</select>
<select id="getSupProUserNum" resultType="com.bonus.project.domain.Project">
select pro_id proId,sup_user_name supervisorUnit
from pt_project_info
where is_active=1 and sup_user_id=#{id}
</select>
<select id="getUserMapper" resultType="java.lang.Integer">
select count(1)
from pt_sup_info
where is_active=1 and unit_id=#{id}
</select>
</mapper>

View File

@ -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<SysSelect> list = sysSelectService.selectSupervisionUnitUser(sysSelect);
return success(list);
}catch (Exception e){
log.error(e.toString(),e);
}
return error("系统异常");
}
/**
* 文件查询
* @param sysFile 入参

View File

@ -43,6 +43,8 @@ public interface SysSelectMapper {
* @return 监理单位集合
*/
List<SysSelect> selectSupervisionUnit(SysSelect sysSelect);
List<SysSelect> selectSupervisionUnitUser(SysSelect sysSelect);
/**
* 文件查询
* @param sysFile 入参

View File

@ -45,6 +45,12 @@ public interface ISysSelectService {
* @return 监理单位集合
*/
List<SysSelect> selectSupervisionUnit(SysSelect sysSelect);
/**
* 监理单位 人员 下拉选
* @param sysSelect 入参
* @return 监理单位集合
*/
List<SysSelect> selectSupervisionUnitUser(SysSelect sysSelect);
/**
* 文件查询
* @param sysFile 入参

View File

@ -72,6 +72,16 @@ public class SysSelectServiceImpl implements ISysSelectService {
public List<SysSelect> selectSupervisionUnit(SysSelect sysSelect) {
return sysSelectMapper.selectSupervisionUnit(sysSelect);
}
/**
* 监理单位人员下拉选
* @param sysSelect 入参
* @return
*/
@Override
public List<SysSelect> selectSupervisionUnitUser(SysSelect sysSelect) {
return sysSelectMapper.selectSupervisionUnitUser(sysSelect);
}
/**
* 文件查询
* @param sysFile 入参

View File

@ -511,22 +511,18 @@ public class SysUserServiceImpl implements ISysUserService
@Override
public String importUser(List<SysUser> userList, Boolean isUpdateSupport, String operName)
{
if (StringUtils.isNull(userList) || userList.size() == 0)
{
if (StringUtils.isNull(userList) || userList.size() == 0) {
throw new ServiceException("导入用户数据不能为空!");
}
int successNum = 0;
int failureNum = 0;
StringBuilder successMsg = new StringBuilder();
StringBuilder failureMsg = new StringBuilder();
for (SysUser user : userList)
{
try
{
for (SysUser user : userList) {
try {
// 验证是否存在这个用户
SysUser u = userMapper.selectUserByUserName(user.getUserName());
if (StringUtils.isNull(u))
{
if (StringUtils.isNull(u)){
BeanValidators.validateWithException(validator, user);
deptService.checkDeptDataScope(user.getDeptId());
String password = configService.selectConfigByKey("sys.user.initPassword");
@ -535,9 +531,7 @@ public class SysUserServiceImpl implements ISysUserService
userMapper.insertUser(user);
successNum++;
successMsg.append("<br/>" + successNum + "、账号 " + user.getUserName() + " 导入成功");
}
else if (isUpdateSupport)
{
} else if (isUpdateSupport) {
BeanValidators.validateWithException(validator, user);
checkUserAllowed(u);
checkUserDataScope(u.getUserId());
@ -547,23 +541,18 @@ public class SysUserServiceImpl implements ISysUserService
userMapper.updateUser(user);
successNum++;
successMsg.append("<br/>" + successNum + "、账号 " + user.getUserName() + " 更新成功");
}
else
{
} else {
failureNum++;
failureMsg.append("<br/>" + failureNum + "、账号 " + user.getUserName() + " 已存在");
}
}
catch (Exception e)
{
} catch (Exception e) {
failureNum++;
String msg = "<br/>" + failureNum + "、账号 " + user.getUserName() + " 导入失败:";
failureMsg.append(msg + e.getMessage());
log.error(msg, e);
}
}
if (failureNum > 0)
{
if (failureNum > 0) {
failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:");
throw new ServiceException(failureMsg.toString());
}

View File

@ -52,11 +52,17 @@
and material_type = '1' and status = '1'
</select>
<select id="selectSupervisionUnit" resultType="com.bonus.system.domain.SysSelect">
select sup_name as label,
sup_id as value
select comm_user_name as label, sup_id as value
from pt_sup_info
where is_active = '1'
where is_active = '1' and unit_id=#{key}
</select>
<select id="selectSupervisionUnitUser" resultType="com.bonus.system.domain.SysSelect">
select sup_name as label,
id as value
from pt_sup_info_data
where is_active = '1'
</select>
<select id="selectFile" resultType="com.bonus.system.domain.SysFileInfo">
select information_id as id,
information_name as fileName,