bug修复

This commit is contained in:
Administrator 2023-07-03 09:09:26 +08:00
parent a053a1c928
commit a262f58edd
6 changed files with 364 additions and 282 deletions

View File

@ -3,7 +3,8 @@
<mapper namespace="com.zhgd.xmgl.modules.basicdata.mapper.OperationLogMapper">
<select id="selectOperationLogPage" resultType="com.zhgd.jeecg.common.mybatis.EntityMap">
SELECT a.*,b.real_name,date_format(a.oper_create_time, '%Y-%m-%d %H:%i:%S') oper_log_time
SELECT b.account,
a.*,b.real_name,date_format(a.oper_create_time, '%Y-%m-%d %H:%i:%S') oper_log_time
FROM operation_log a INNER JOIN system_user b ON a.oper_user_id=b.user_id
LEFT JOIN company cp ON b.sn=cp.company_sn
LEFT JOIN project pa ON b.sn=pa.project_sn

View File

@ -334,7 +334,7 @@ public class SystemUserServiceImpl extends ServiceImpl<SystemUserMapper, SystemU
.eq(SystemUser::getUserTel, MapUtils.getString(map, "phone"));
SystemUser systemUser = systemUserMapper.selectOne(queryWrapper);
if (systemUser == null || systemUser.getUserId() == null) {
throw new OpenAlertException(MessageUtil.get("phoneErr"));
throw new OpenAlertException("手机号未注册");
}
/*CompanyConfig companyConfig=null;
if(systemUser.getAccountType()==1){

View File

@ -2,9 +2,11 @@ package com.zhgd.xmgl.modules.worker.controller;
import com.zhgd.annotation.OperLog;
import com.zhgd.jeecg.common.api.vo.Result;
import com.zhgd.jeecg.common.execption.OpenAlertException;
import com.zhgd.jeecg.common.mybatis.EntityMap;
import com.zhgd.xmgl.modules.worker.entity.WorkerCertificate;
import com.zhgd.xmgl.modules.worker.service.IWorkerCertificateService;
import com.zhgd.xmgl.util.DateUtil;
import com.zhgd.xmgl.util.MessageUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
@ -12,6 +14,7 @@ import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
@ -41,28 +44,31 @@ public class WorkerCertificateController {
/**
* 分页列表查询
*
* @return
*/
@ApiOperation(value = "根据人员ID列表查询人员证书表信息", notes = "根据人员ID列表查询人员证书表信息", httpMethod="POST")
@ApiOperation(value = "根据人员ID列表查询人员证书表信息", notes = "根据人员ID列表查询人员证书表信息", httpMethod = "POST")
@ApiImplicitParams({
@ApiImplicitParam(name = "workerId", value = "人员ID", paramType = "query", required = true, dataType = "String"),
})
@PostMapping(value = "/list")
public Result<List<EntityMap>> selectWorkerCertificateList(@RequestBody Map<String,Object> map) {
public Result<List<EntityMap>> selectWorkerCertificateList(@RequestBody Map<String, Object> map) {
return Result.success(workerCertificateService.selectWorkerCertificateList(map));
}
/**
* 添加
*
* @param workerCertificate
* @return
*/
@OperLog(operModul = "劳务管理",operType = "添加人员证书表信息",operDesc = "添加人员证书表信息")
@ApiOperation(value = " 添加人员证书表信息", notes = "添加人员证书表信息" , httpMethod="POST")
@OperLog(operModul = "劳务管理", operType = "添加人员证书表信息", operDesc = "添加人员证书表信息")
@ApiOperation(value = " 添加人员证书表信息", notes = "添加人员证书表信息", httpMethod = "POST")
@PostMapping(value = "/add")
public Result<WorkerCertificate> add(@RequestBody WorkerCertificate workerCertificate) {
Result<WorkerCertificate> result = new Result<WorkerCertificate>();
try {
checkParam(workerCertificate);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
workerCertificate.setUploadDate(sdf.format(new Date()));
workerCertificateService.save(workerCertificate);
@ -77,21 +83,22 @@ public class WorkerCertificateController {
/**
* 编辑
*
* @param workerCertificate
* @return
*/
@OperLog(operModul = "劳务管理",operType = "编辑人员证书表信息",operDesc = "编辑人员证书表信息")
@ApiOperation(value = "编辑人员证书表信息", notes = "编辑人员证书表信息" , httpMethod="POST")
@OperLog(operModul = "劳务管理", operType = "编辑人员证书表信息", operDesc = "编辑人员证书表信息")
@ApiOperation(value = "编辑人员证书表信息", notes = "编辑人员证书表信息", httpMethod = "POST")
@PostMapping(value = "/edit")
public Result<WorkerCertificate> edit(@RequestBody WorkerCertificate workerCertificate) {
Result<WorkerCertificate> result = new Result<WorkerCertificate>();
WorkerCertificate workerCertificateEntity = workerCertificateService.getById(workerCertificate.getId());
if(workerCertificateEntity==null) {
if (workerCertificateEntity == null) {
result.error500(MessageUtil.get("notFindErr"));
}else {
} else {
checkParam(workerCertificate);
boolean ok = workerCertificateService.updateById(workerCertificate);
//TODO 返回false说明什么
if(ok) {
if (ok) {
result.successMsg(MessageUtil.get("editSucess"));
}
}
@ -99,22 +106,30 @@ public class WorkerCertificateController {
return result;
}
private void checkParam(WorkerCertificate workerCertificate) {
if (StringUtils.isNotBlank(workerCertificate.getEffectTime()) && StringUtils.isNotBlank(workerCertificate.getIssueTime())
&& DateUtil.parse(workerCertificate.getEffectTime()).compareTo(DateUtil.parse(workerCertificate.getIssueTime())) < 0) {
throw new OpenAlertException("证书签发日期不能大于截止有效日期");
}
}
/**
* 通过id删除
*
* @param
* @return
*/
@ApiOperation(value = "删除人员证书表信息", notes = "删除人员证书表信息" , httpMethod="POST")
@ApiOperation(value = "删除人员证书表信息", notes = "删除人员证书表信息", httpMethod = "POST")
@ApiImplicitParam(name = "id", value = "人员证书表ID", paramType = "query", required = true, dataType = "Integer")
@PostMapping(value = "/delete")
public Result<WorkerCertificate> delete(@RequestBody Map<String,Object> map) {
public Result<WorkerCertificate> delete(@RequestBody Map<String, Object> map) {
Result<WorkerCertificate> result = new Result<WorkerCertificate>();
WorkerCertificate workerCertificate = workerCertificateService.getById(MapUtils.getString(map,"id"));
if(workerCertificate==null) {
WorkerCertificate workerCertificate = workerCertificateService.getById(MapUtils.getString(map, "id"));
if (workerCertificate == null) {
result.error500(MessageUtil.get("notFindErr"));
}else {
boolean ok = workerCertificateService.removeById(MapUtils.getString(map,"id"));
if(ok) {
} else {
boolean ok = workerCertificateService.removeById(MapUtils.getString(map, "id"));
if (ok) {
result.successMsg(MessageUtil.get("deleteSucess"));
}
}
@ -123,21 +138,21 @@ public class WorkerCertificateController {
}
/**
* 通过id查询
*
* @param
* @return
*/
@ApiOperation(value = "通过id查询人员证书表信息", notes = "通过id查询人员证书表信息" , httpMethod="POST")
@ApiOperation(value = "通过id查询人员证书表信息", notes = "通过id查询人员证书表信息", httpMethod = "POST")
@ApiImplicitParam(name = "id", value = "人员证书表ID", paramType = "query", required = true, dataType = "Integer")
@PostMapping(value = "/queryById")
public Result<WorkerCertificate> queryById(@RequestBody Map<String,Object> map) {
public Result<WorkerCertificate> queryById(@RequestBody Map<String, Object> map) {
Result<WorkerCertificate> result = new Result<WorkerCertificate>();
WorkerCertificate workerCertificate = workerCertificateService.getById(MapUtils.getString(map,"id"));
if(workerCertificate==null) {
WorkerCertificate workerCertificate = workerCertificateService.getById(MapUtils.getString(map, "id"));
if (workerCertificate == null) {
result.error500(MessageUtil.get("notFindErr"));
}else {
} else {
result.setResult(workerCertificate);
result.setSuccess(true);
}

View File

@ -1,7 +1,9 @@
package com.zhgd.xmgl.modules.worker.controller;
import cn.hutool.core.date.DateUtil;
import com.zhgd.annotation.OperLog;
import com.zhgd.jeecg.common.api.vo.Result;
import com.zhgd.jeecg.common.execption.OpenAlertException;
import com.zhgd.xmgl.modules.worker.entity.WorkerInsurance;
import com.zhgd.xmgl.modules.worker.service.IWorkerInsuranceService;
import com.zhgd.xmgl.util.MessageUtil;
@ -11,6 +13,7 @@ import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -58,6 +61,7 @@ public class WorkerInsuranceController {
public Result<WorkerInsurance> add(@RequestBody WorkerInsurance workerInsurance) {
Result<WorkerInsurance> result = new Result<WorkerInsurance>();
try {
checkParam(workerInsurance);
workerInsuranceService.save(workerInsurance);
result.successMsg(MessageUtil.get("addSucess"));
} catch (Exception e) {
@ -68,23 +72,31 @@ public class WorkerInsuranceController {
return result;
}
private void checkParam(WorkerInsurance workerInsurance) {
if (StringUtils.isNotBlank(workerInsurance.getExpireTime()) && StringUtils.isNotBlank(workerInsurance.getInsuranceTime())
&& DateUtil.parse(workerInsurance.getExpireTime()).compareTo(DateUtil.parse(workerInsurance.getInsuranceTime())) < 0) {
throw new OpenAlertException("保险购买时间不能大于保险到期时间");
}
}
/**
* 编辑
*
* @param workerInsurance
* @return
*/
@OperLog(operModul = "劳务管理",operType = "编辑劳务人员保险",operDesc = "编辑劳务人员保险信息")
@ApiOperation(value = "编辑劳务人员保险信息", notes = "编辑劳务人员保险信息" , httpMethod="POST")
@OperLog(operModul = "劳务管理", operType = "编辑劳务人员保险", operDesc = "编辑劳务人员保险信息")
@ApiOperation(value = "编辑劳务人员保险信息", notes = "编辑劳务人员保险信息", httpMethod = "POST")
@PostMapping(value = "/edit")
public Result<WorkerInsurance> edit(@RequestBody WorkerInsurance workerInsurance) {
Result<WorkerInsurance> result = new Result<WorkerInsurance>();
WorkerInsurance workerInsuranceEntity = workerInsuranceService.getById(workerInsurance.getId());
if(workerInsuranceEntity==null) {
if (workerInsuranceEntity == null) {
result.error500(MessageUtil.get("notFindErr"));
}else {
} else {
checkParam(workerInsurance);
boolean ok = workerInsuranceService.updateById(workerInsurance);
//TODO 返回false说明什么
if(ok) {
if (ok) {
result.successMsg(MessageUtil.get("editSucess"));
}
}
@ -94,21 +106,22 @@ public class WorkerInsuranceController {
/**
* 通过id删除
*
* @param
* @return
*/
@OperLog(operModul = "劳务管理",operType = "删除劳务人员保险",operDesc = "删除劳务人员保险信息")
@ApiOperation(value = "删除劳务人员保险信息", notes = "删除劳务人员保险信息" , httpMethod="POST")
@OperLog(operModul = "劳务管理", operType = "删除劳务人员保险", operDesc = "删除劳务人员保险信息")
@ApiOperation(value = "删除劳务人员保险信息", notes = "删除劳务人员保险信息", httpMethod = "POST")
@ApiImplicitParam(name = "id", value = "劳务人员保险ID", paramType = "query", required = true, dataType = "Integer")
@PostMapping(value = "/delete")
public Result<WorkerInsurance> delete(@RequestBody Map<String,Object> map) {
public Result<WorkerInsurance> delete(@RequestBody Map<String, Object> map) {
Result<WorkerInsurance> result = new Result<WorkerInsurance>();
WorkerInsurance workerInsurance = workerInsuranceService.getById(MapUtils.getString(map,"id"));
if(workerInsurance==null) {
WorkerInsurance workerInsurance = workerInsuranceService.getById(MapUtils.getString(map, "id"));
if (workerInsurance == null) {
result.error500(MessageUtil.get("notFindErr"));
}else {
boolean ok = workerInsuranceService.removeById(MapUtils.getString(map,"id"));
if(ok) {
} else {
boolean ok = workerInsuranceService.removeById(MapUtils.getString(map, "id"));
if (ok) {
result.successMsg(MessageUtil.get("deleteSucess"));
}
}
@ -117,7 +130,6 @@ public class WorkerInsuranceController {
}
/**
* 通过id查询
* @param

View File

@ -1402,7 +1402,7 @@ public class WorkerInfoServiceImpl extends ServiceImpl<WorkerInfoMapper, WorkerI
if (list == null || list.size() == 0) {
throw new OpenAlertException(MessageUtil.get("excelNotDataErr"));
}
if (list != null && list.size() > 0) {
checkParams(list);
Map<String, Object> teamMap = teamInfoMapper.getTeamInfoMapBySn(projectSn);
Map<String, Object> departmentMap = departmentInfoMapper.getDepartmentInfoMapBySn(projectSn);
for (Map<String, String> importInfo : list) {
@ -1519,7 +1519,6 @@ public class WorkerInfoServiceImpl extends ServiceImpl<WorkerInfoMapper, WorkerI
workerInfoMapper.insert(workerInfo);
}
}
}
if (!"".equals(existName.toString())) {
existName.deleteCharAt(existName.lastIndexOf(""));
result.successMsg("劳务人员姓名为:" + existName + "的人员已存在对应信息(身份证等信息一致)");
@ -1536,6 +1535,59 @@ public class WorkerInfoServiceImpl extends ServiceImpl<WorkerInfoMapper, WorkerI
return result;
}
private void checkParams(List<Map<String, String>> list) {
for (Map<String, String> importInfo : list) {
if (StringUtils.isBlank(importInfo.get("*姓名"))) {
throw new OpenAlertException("有姓名未填写");
}
if (StringUtils.isBlank(importInfo.get("*身份证号码"))) {
throw new OpenAlertException("有身份证号码未填写");
}
if (StringUtils.isBlank(importInfo.get("*人员类型"))) {
throw new OpenAlertException("有人员类型未填写");
}
if (StringUtils.isBlank(importInfo.get("*民族"))) {
throw new OpenAlertException("有民族未填写");
}
if (StringUtils.isBlank(importInfo.get("*签发机构"))) {
throw new OpenAlertException("有签发机构未填写");
}
if (StringUtils.isBlank(importInfo.get("*籍贯"))) {
throw new OpenAlertException("有籍贯未填写");
}
if (StringUtils.isBlank(importInfo.get("*身份证有效日期"))) {
throw new OpenAlertException("有身份证有效日期未填写");
}
if (StringUtils.isBlank(importInfo.get("*联系电话"))) {
throw new OpenAlertException("有联系电话未填写");
}
if (StringUtils.isBlank(importInfo.get("*紧急联系人"))) {
throw new OpenAlertException("有紧急联系人未填写");
}
if (StringUtils.isBlank(importInfo.get("*紧急联系人电话"))) {
throw new OpenAlertException("有紧急联系人电话未填写");
}
//if (StringUtils.isBlank(importInfo.get("*部门(管理人员填)"))) {
// throw new OpenAlertException("有部门(管理人员填)未填写");
//}
//if (StringUtils.isBlank(importInfo.get("*班组(劳务人员填)"))) {
// throw new OpenAlertException("有班组(劳务人员填)未填写");
//}
}
//身份证判重
List<String> idCardList = list.stream().map(m -> m.get("*身份证号码")).distinct().collect(Collectors.toList());
Map<String, Long> idCardNumMap = list.stream().collect(
Collectors.groupingBy(m -> m.get("*身份证号码"), Collectors.counting()));
//筛出有重复的姓名
List<String> repeatList = idCardNumMap.keySet().stream().
filter(key -> idCardNumMap.get(key) > 1).collect(Collectors.toList());
if (idCardList.size() != list.size()) {
throw new OpenAlertException("身份证号码有重复,重复的号码为:" + StringUtils.join(repeatList));
}
}
@Override
public Map<String, Object> selectProjectWorkerStatisticsCount(Map<String, Object> map) {
Map<String, Object> data = new HashMap<>();

View File

@ -4,6 +4,7 @@ package com.zhgd.xmgl.modules.worker.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zhgd.jeecg.common.api.vo.Result;
import com.zhgd.jeecg.common.execption.OpenAlertException;
import com.zhgd.jeecg.common.mybatis.EntityMap;
@ -19,8 +20,6 @@ import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
@ -48,36 +47,39 @@ public class WorkerWagesPaymentServiceImpl extends ServiceImpl<WorkerWagesPaymen
int pageNo = Integer.parseInt(map.getOrDefault("pageNo", 1).toString());
int pageSize = Integer.parseInt(map.getOrDefault("pageSize", 10).toString());
Page<EntityMap> page = new Page<>(pageNo, pageSize);
List<EntityMap> list=workerWagesPaymentMapper.selectWorkerWagesPaymentPageList(page, map);
List<EntityMap> list = workerWagesPaymentMapper.selectWorkerWagesPaymentPageList(page, map);
return page.setRecords(list);
}
private void getPayMonth(Map<String, Object> map) {
String payMonth= MapUtils.getString(map,"payMonth");
String payMonth = MapUtils.getString(map, "payMonth");
//工资发放记录默认查询上个月且只能一个月的查询
if(StringUtils.isEmpty(payMonth)){
if (StringUtils.isEmpty(payMonth)) {
SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM");
Date date = new Date();
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.add(Calendar.MONTH, -1);
payMonth=sdf1.format(calendar.getTime());
map.put("payMonth",payMonth);
payMonth = sdf1.format(calendar.getTime());
map.put("payMonth", payMonth);
}
}
@Override
public void updateWorkerWagesPayment(WorkerWagesPayment workerWagesPayment) {
QueryWrapper<WorkerWagesPayment> queryWrapper=new QueryWrapper<>();
queryWrapper.lambda().eq(WorkerWagesPayment::getPersonSn,workerWagesPayment.getPersonSn())
.eq(WorkerWagesPayment::getPayMonth,workerWagesPayment.getPayMonth());
List<WorkerWagesPayment> list=workerWagesPaymentMapper.selectList(queryWrapper);
if(list!=null&&list.size()>0){
for(WorkerWagesPayment data:list){
QueryWrapper<WorkerWagesPayment> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(WorkerWagesPayment::getPersonSn, workerWagesPayment.getPersonSn())
.eq(WorkerWagesPayment::getPayMonth, workerWagesPayment.getPayMonth());
if (workerWagesPayment.getPayNet() != null) {
workerWagesPayment.setPayStatus(1);
}
List<WorkerWagesPayment> list = workerWagesPaymentMapper.selectList(queryWrapper);
if (list != null && list.size() > 0) {
for (WorkerWagesPayment data : list) {
workerWagesPayment.setId(data.getId());
workerWagesPaymentMapper.updateById(workerWagesPayment);
}
}else{
} else {
workerWagesPaymentMapper.insert(workerWagesPayment);
}
}
@ -92,12 +94,12 @@ public class WorkerWagesPaymentServiceImpl extends ServiceImpl<WorkerWagesPaymen
Result<String> result = new Result<String>();
try {
InputStream is = excelFile.getInputStream();
List<Map<String, String>> list= ExcelUtils.jxlExlToList(is,0);
List<Map<String, String>> list = ExcelUtils.jxlExlToList(is, 0);
if (list == null || list.size() == 0) {
throw new OpenAlertException(MessageUtil.get("excelNotDataErr"));
}
if(list!=null&&list.size()>0){
for(Map<String, String> importInfo:list){
if (list != null && list.size() > 0) {
for (Map<String, String> importInfo : list) {
if ((importInfo.get("身份证号码").equals("") || importInfo.get("身份证号码") == null)) {
continue;
}
@ -110,9 +112,9 @@ public class WorkerWagesPaymentServiceImpl extends ServiceImpl<WorkerWagesPaymen
if ((importInfo.get("实发工资").equals("") || importInfo.get("实发工资") == null)) {
continue;
}
WorkerInfo info=workerInfoMapper.selectWorkWorkerInfoWithIDCard(importInfo.get("身份证号码"),projectSn);
if(info!=null){
WorkerWagesPayment workerWagesPayment=new WorkerWagesPayment();
WorkerInfo info = workerInfoMapper.selectWorkWorkerInfoWithIDCard(importInfo.get("身份证号码"), projectSn);
if (info != null) {
WorkerWagesPayment workerWagesPayment = new WorkerWagesPayment();
workerWagesPayment.setProjectSn(projectSn);
workerWagesPayment.setPersonSn(info.getPersonSn());
workerWagesPayment.setPayGross(Double.valueOf(importInfo.get("应发工资")));
@ -121,7 +123,7 @@ public class WorkerWagesPaymentServiceImpl extends ServiceImpl<WorkerWagesPaymen
int payState = 0;
if ("已发".equals(importInfo.get("是否发放(已发/未发)"))) {
payState = 1;
}else if ("未发".equals(importInfo.get("是否发放(已发/未发)"))) {
} else if ("未发".equals(importInfo.get("是否发放(已发/未发)"))) {
payState = 0;
}
workerWagesPayment.setPayStatus(payState);
@ -131,10 +133,10 @@ public class WorkerWagesPaymentServiceImpl extends ServiceImpl<WorkerWagesPaymen
}
}
result.successMsg(MessageUtil.get("optSucess"));
}catch (OpenAlertException e){
} catch (OpenAlertException e) {
e.printStackTrace();
result.error500(e.getMessage());
}catch (Exception e){
} catch (Exception e) {
e.printStackTrace();
result.error500(MessageUtil.get("failErr"));
}