正在显示
19 个修改的文件
包含
326 行增加
和
170 行删除
| @@ -288,6 +288,28 @@ public class JeecgController<T, S extends IService<T>> { | @@ -288,6 +288,28 @@ public class JeecgController<T, S extends IService<T>> { | ||
| 288 | return Result.error("文件导入失败!"); | 288 | return Result.error("文件导入失败!"); |
| 289 | } | 289 | } |
| 290 | 290 | ||
| 291 | + // 去除列表中对象字段的空格 | ||
| 292 | + private void trimSpaces(List<T> list) { | ||
| 293 | + for (T item : list) { | ||
| 294 | + Field[] fields = item.getClass().getDeclaredFields(); | ||
| 295 | + for (Field field : fields) { | ||
| 296 | + field.setAccessible(true); // 确保可以访问私有字段 | ||
| 297 | + try { | ||
| 298 | + if (field.getType() == String.class) { | ||
| 299 | + String value = (String) field.get(item); | ||
| 300 | + if (value != null) { | ||
| 301 | + // 去除空格并更新字段值 | ||
| 302 | + String trimmedValue = value.replaceAll("\\s", ""); | ||
| 303 | + field.set(item, trimmedValue); | ||
| 304 | + } | ||
| 305 | + } | ||
| 306 | + } catch (IllegalAccessException e) { | ||
| 307 | + // 异常处理 | ||
| 308 | + } | ||
| 309 | + } | ||
| 310 | + } | ||
| 311 | + } | ||
| 312 | + //员工基本信息导入 | ||
| 291 | protected Result<?> importExcelbase(HttpServletRequest request, HttpServletResponse response, Class<T> clazz) { | 313 | protected Result<?> importExcelbase(HttpServletRequest request, HttpServletResponse response, Class<T> clazz) { |
| 292 | MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; | 314 | MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; |
| 293 | Map<String, MultipartFile> fileMap = multipartRequest.getFileMap(); | 315 | Map<String, MultipartFile> fileMap = multipartRequest.getFileMap(); |
| @@ -302,20 +324,91 @@ public class JeecgController<T, S extends IService<T>> { | @@ -302,20 +324,91 @@ public class JeecgController<T, S extends IService<T>> { | ||
| 302 | params.setNeedSave(true); | 324 | params.setNeedSave(true); |
| 303 | try { | 325 | try { |
| 304 | List<T> list = ExcelImportUtil.importExcel(file.getInputStream(), clazz, params); | 326 | List<T> list = ExcelImportUtil.importExcel(file.getInputStream(), clazz, params); |
| 327 | + // 去除导入数据的空格 | ||
| 328 | + trimSpaces(list); | ||
| 329 | + List<T> dataListToSave = new ArrayList<>(); | ||
| 330 | + for (T data : list) { | ||
| 331 | + if (data != null) { | ||
| 332 | + // 获取对象的所有字段 | ||
| 333 | + Field[] fields = data.getClass().getDeclaredFields(); | ||
| 334 | + boolean hasNonNullValue = false; | ||
| 335 | + for (Field field : fields) { | ||
| 336 | + // 排除 serialVersionUID 字段 | ||
| 337 | + if ("serialVersionUID".equals(field.getName())) { | ||
| 338 | + continue; | ||
| 339 | + } | ||
| 340 | + field.setAccessible(true); // 设置字段可访问 | ||
| 341 | + try { | ||
| 342 | + // 获取字段值,并检查是否为空 | ||
| 343 | + Object value = field.get(data); | ||
| 344 | + if (value != null) { | ||
| 305 | 345 | ||
| 346 | + hasNonNullValue = true; | ||
| 347 | + break; | ||
| 348 | + } | ||
| 349 | + } catch (IllegalAccessException e) { | ||
| 350 | + e.printStackTrace(); | ||
| 351 | + } | ||
| 352 | + } | ||
| 353 | + if (hasNonNullValue) { | ||
| 306 | 354 | ||
| 307 | - //update-begin-author:taoyan date:20190528 for:批量插入数据 | ||
| 308 | - long start = System.currentTimeMillis(); | ||
| 309 | 355 | ||
| 310 | - service.saveBatch(list); | ||
| 311 | - //400条 saveBatch消耗时间1592毫秒 循环插入消耗时间1947毫秒 | ||
| 312 | - //1200条 saveBatch消耗时间3687毫秒 循环插入消耗时间5212毫秒 | ||
| 313 | - log.info("消耗时间" + (System.currentTimeMillis() - start) + "毫秒"); | ||
| 314 | - //update-end-author:taoyan date:20190528 for:批量插入数据 | ||
| 315 | - return Result.ok("文件导入成功!数据行数:" + list.size()); | 356 | + // 如果至少有一个字段值不为空,则保存数据到待保存列表 |
| 357 | + dataListToSave.add(data); | ||
| 358 | + } | ||
| 359 | + } | ||
| 360 | + } | ||
| 361 | + | ||
| 362 | + if (!dataListToSave.isEmpty()) { | ||
| 363 | + // 如果有数据需要保存,则批量保存 | ||
| 364 | + long start = System.currentTimeMillis(); | ||
| 365 | + service.saveBatch(dataListToSave); | ||
| 366 | + List<T> recordsToUpdate = service.list(); | ||
| 367 | + List<T> updateList = new ArrayList<>(); | ||
| 368 | + for (T item : recordsToUpdate) { | ||
| 369 | + Class<?> clazz2 = item.getClass(); | ||
| 370 | + // 获取 jobName 字段 | ||
| 371 | + Field jobname = clazz2.getDeclaredField("jobName"); | ||
| 372 | + jobname.setAccessible(true); | ||
| 373 | + String jobName = (String) jobname.get(item); | ||
| 374 | + // 获取 jobTitle 字段 | ||
| 375 | + Field jobTitle = clazz2.getDeclaredField("jobTitle"); | ||
| 376 | + jobTitle.setAccessible(true); // 确保可以访问私有字段 | ||
| 377 | + if (jobName.equals("普工")) { | ||
| 378 | + jobTitle.set(item,"WorkshopGeneralWorker"); | ||
| 379 | + } else if (jobName.equals("装配主管")) { | ||
| 380 | + jobTitle.set(item,"AssemblySupervisor"); | ||
| 381 | + } else if (jobName.equals("装配工")) { | ||
| 382 | + jobTitle.set(item,"Assembler"); | ||
| 383 | + } else if (jobName.equals("采购主管")) { | ||
| 384 | + jobTitle.set(item,"ProcurementSupervisor"); | ||
| 385 | + } else if (jobName.equals("采购员")) { | ||
| 386 | + jobTitle.set(item,"PurchasingOfficer"); | ||
| 387 | + } else if (jobName.equals("车间辅助人员")) { | ||
| 388 | + jobTitle.set(item,"WorkshopAuxiliaryPersonnel"); | ||
| 389 | + } else if (jobName.equals("车间技术员")) { | ||
| 390 | + jobTitle.set(item,"WorkshopTechnician"); | ||
| 391 | + } else if (jobName.equals("车间技术主管")) { | ||
| 392 | + jobTitle.set(item,"WorkshopTechnicalManager"); | ||
| 393 | + } else if (jobName.equals("车间管理员")) { | ||
| 394 | + jobTitle.set(item,"WorkshopDirector"); | ||
| 395 | + } else if (jobName.equals("办公室行政人员")) { | ||
| 396 | + jobTitle.set(item,"OfficeAdministrative"); | ||
| 397 | + } | ||
| 398 | + updateList.add(item); | ||
| 399 | + } | ||
| 400 | + service.updateBatchById(updateList); | ||
| 401 | + log.info("批量保存消耗时间:" + (System.currentTimeMillis() - start) + "毫秒"); | ||
| 402 | + if(dataListToSave.size()<=0){ | ||
| 403 | + return Result.error("没有有效的导入数据"); | ||
| 404 | + } | ||
| 405 | + return Result.ok("文件导入成功!数据行数:" + dataListToSave.size()); | ||
| 406 | + } else { | ||
| 407 | + return Result.error("文件导入失败:没有有效的数据需要保存!"); | ||
| 408 | + } | ||
| 316 | }catch (ExcelImportException e) { | 409 | }catch (ExcelImportException e) { |
| 317 | return Result.error("文件导入失败,导入数据格式错误"); | 410 | return Result.error("文件导入失败,导入数据格式错误"); |
| 318 | - }catch (Exception e) { | 411 | + } catch (Exception e) { |
| 319 | //update-begin-author:taoyan date:20211124 for: 导入数据重复增加提示 | 412 | //update-begin-author:taoyan date:20211124 for: 导入数据重复增加提示 |
| 320 | String msg = e.getMessage(); | 413 | String msg = e.getMessage(); |
| 321 | log.error(msg, e); | 414 | log.error(msg, e); |
| @@ -469,14 +469,14 @@ public class JeecgController2<T, t, b,w, V extends IService<t>, S extends IServi | @@ -469,14 +469,14 @@ public class JeecgController2<T, t, b,w, V extends IService<t>, S extends IServi | ||
| 469 | SimpleDateFormat outputFormat = new SimpleDateFormat("yyyy-MM"); | 469 | SimpleDateFormat outputFormat = new SimpleDateFormat("yyyy-MM"); |
| 470 | String outputDateString = outputFormat.format(salaryMonth); | 470 | String outputDateString = outputFormat.format(salaryMonth); |
| 471 | 471 | ||
| 472 | - queryWrapper.eq("name",userName+"(普工)"); | 472 | + queryWrapper.eq("undertaker",userName+"(普工)"); |
| 473 | List<w> list = serviceTime.list(queryWrapper); | 473 | List<w> list = serviceTime.list(queryWrapper); |
| 474 | if(list.size()==0) { | 474 | if(list.size()==0) { |
| 475 | return true; | 475 | return true; |
| 476 | }else { | 476 | }else { |
| 477 | - queryWrapper.eq("work_time",workingHours); | ||
| 478 | - queryWrapper.eq("name",userName+"(普工)"); | ||
| 479 | - queryWrapper.apply("DATE_FORMAT(salary_month, '%Y-%m') = '" + outputDateString + "'"); | 477 | + queryWrapper.eq("work_hours",workingHours); |
| 478 | + queryWrapper.eq("undertaker",userName+"(普工)"); | ||
| 479 | + queryWrapper.apply("DATE_FORMAT(yan_time, '%Y-%m') = '" + outputDateString + "'"); | ||
| 480 | System.out.println("输出:"+serviceTime.getOne(queryWrapper)); | 480 | System.out.println("输出:"+serviceTime.getOne(queryWrapper)); |
| 481 | w one2 = serviceTime.getOne(queryWrapper); | 481 | w one2 = serviceTime.getOne(queryWrapper); |
| 482 | if(one2!=null){ | 482 | if(one2!=null){ |
| 1 | package org.jeecg.modules.erp.order_form.controller; | 1 | package org.jeecg.modules.erp.order_form.controller; |
| 2 | 2 | ||
| 3 | -import java.text.ParseException; | ||
| 4 | import java.text.SimpleDateFormat; | 3 | import java.text.SimpleDateFormat; |
| 5 | -import java.time.LocalDate; | ||
| 6 | import java.util.*; | 4 | import java.util.*; |
| 7 | -import java.util.stream.Collectors; | ||
| 8 | -import java.io.IOException; | ||
| 9 | -import java.io.UnsupportedEncodingException; | ||
| 10 | -import java.net.URLDecoder; | ||
| 11 | import javax.servlet.http.HttpServletRequest; | 5 | import javax.servlet.http.HttpServletRequest; |
| 12 | import javax.servlet.http.HttpServletResponse; | 6 | import javax.servlet.http.HttpServletResponse; |
| 13 | import org.jeecg.common.api.vo.Result; | 7 | import org.jeecg.common.api.vo.Result; |
| 14 | -import org.jeecg.common.system.query.QueryGenerator; | ||
| 15 | -import org.jeecg.common.util.oConvertUtils; | ||
| 16 | 8 | ||
| 17 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 9 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| 18 | import com.baomidou.mybatisplus.core.metadata.IPage; | 10 | import com.baomidou.mybatisplus.core.metadata.IPage; |
| 19 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | 11 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| 20 | import lombok.extern.slf4j.Slf4j; | 12 | import lombok.extern.slf4j.Slf4j; |
| 21 | 13 | ||
| 22 | -import org.jeecg.modules.erp.order_form.entity.TblWorkTime; | ||
| 23 | -import org.jeecg.modules.erp.order_form.service.ITblWorkTimeService; | ||
| 24 | -import org.jeecgframework.poi.excel.ExcelImportUtil; | ||
| 25 | -import org.jeecgframework.poi.excel.def.NormalExcelConstants; | ||
| 26 | -import org.jeecgframework.poi.excel.entity.ExportParams; | ||
| 27 | -import org.jeecgframework.poi.excel.entity.ImportParams; | ||
| 28 | -import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; | 14 | +import org.jeecg.modules.erp.order_form.entity.ViewWorkTime; |
| 15 | +import org.jeecg.modules.erp.order_form.service.IViewWorkTimeService; | ||
| 29 | import org.jeecg.common.system.base.controller.JeecgController; | 16 | import org.jeecg.common.system.base.controller.JeecgController; |
| 30 | import org.springframework.beans.factory.annotation.Autowired; | 17 | import org.springframework.beans.factory.annotation.Autowired; |
| 31 | import org.springframework.web.bind.annotation.*; | 18 | import org.springframework.web.bind.annotation.*; |
| 32 | -import org.springframework.web.multipart.MultipartFile; | ||
| 33 | -import org.springframework.web.multipart.MultipartHttpServletRequest; | ||
| 34 | import org.springframework.web.servlet.ModelAndView; | 19 | import org.springframework.web.servlet.ModelAndView; |
| 35 | -import com.alibaba.fastjson.JSON; | ||
| 36 | import io.swagger.annotations.Api; | 20 | import io.swagger.annotations.Api; |
| 37 | import io.swagger.annotations.ApiOperation; | 21 | import io.swagger.annotations.ApiOperation; |
| 38 | import org.jeecg.common.aspect.annotation.AutoLog; | 22 | import org.jeecg.common.aspect.annotation.AutoLog; |
| @@ -43,72 +27,71 @@ import org.jeecg.common.aspect.annotation.AutoLog; | @@ -43,72 +27,71 @@ import org.jeecg.common.aspect.annotation.AutoLog; | ||
| 43 | * @Date: 2024-06-13 | 27 | * @Date: 2024-06-13 |
| 44 | * @Version: V1.0 | 28 | * @Version: V1.0 |
| 45 | */ | 29 | */ |
| 46 | -@Api(tags="tbl_work_time") | 30 | +@Api(tags="view_work_time") |
| 47 | @RestController | 31 | @RestController |
| 48 | -@RequestMapping("/work_time/tblWorkTime") | 32 | +@RequestMapping("/work_time/viewWorkTime") |
| 49 | @Slf4j | 33 | @Slf4j |
| 50 | -public class TblWorkTimeController extends JeecgController<TblWorkTime, ITblWorkTimeService> { | 34 | +public class ViewWorkTimeController extends JeecgController<ViewWorkTime, IViewWorkTimeService> { |
| 51 | @Autowired | 35 | @Autowired |
| 52 | - private ITblWorkTimeService tblWorkTimeService; | 36 | + private IViewWorkTimeService tblWorkTimeService; |
| 53 | 37 | ||
| 54 | /** | 38 | /** |
| 55 | * 分页列表查询 | 39 | * 分页列表查询 |
| 56 | * | 40 | * |
| 57 | - * @param tblWorkTime | 41 | + * @param viewWorkTime |
| 58 | * @param pageNo | 42 | * @param pageNo |
| 59 | * @param pageSize | 43 | * @param pageSize |
| 60 | * @param req | 44 | * @param req |
| 61 | * @return | 45 | * @return |
| 62 | */ | 46 | */ |
| 63 | //@AutoLog(value = "tbl_work_time-分页列表查询") | 47 | //@AutoLog(value = "tbl_work_time-分页列表查询") |
| 64 | - @ApiOperation(value="tbl_work_time-分页列表查询", notes="tbl_work_time-分页列表查询") | 48 | + @ApiOperation(value="view_work_time-分页列表查询", notes="view_work_time-分页列表查询") |
| 65 | @GetMapping(value = "/list") | 49 | @GetMapping(value = "/list") |
| 66 | - public Result<IPage<TblWorkTime>> queryPageList(TblWorkTime tblWorkTime, | 50 | + public Result<IPage<ViewWorkTime>> queryPageList(ViewWorkTime viewWorkTime, |
| 67 | @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, | 51 | @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, |
| 68 | @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, | 52 | @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, |
| 69 | HttpServletRequest req) { | 53 | HttpServletRequest req) { |
| 70 | - QueryWrapper<TblWorkTime> queryWrapper = new QueryWrapper<>(); | ||
| 71 | - queryWrapper.orderByDesc("salary_month"); | ||
| 72 | - if(tblWorkTime.getName()!=null && !tblWorkTime.getName().isEmpty()){ | ||
| 73 | - String name = tblWorkTime.getName().replace("*", ""); | ||
| 74 | - queryWrapper.like("name", "%" + name + "%"); | 54 | + QueryWrapper<ViewWorkTime> queryWrapper = new QueryWrapper<>(); |
| 55 | + queryWrapper.orderByDesc("yan_time"); | ||
| 56 | + if(viewWorkTime.getUndertaker()!=null && !viewWorkTime.getUndertaker().isEmpty()){ | ||
| 57 | + queryWrapper.like("undertaker", "%" + viewWorkTime.getUndertaker() + "%"); | ||
| 75 | } | 58 | } |
| 76 | - if(tblWorkTime.getSalaryMonth()!=null){ | ||
| 77 | - Date salaryMonth = tblWorkTime.getSalaryMonth(); | 59 | + if(viewWorkTime.getYanTime()!=null){ |
| 60 | + Date salaryMonth = viewWorkTime.getYanTime(); | ||
| 78 | SimpleDateFormat outputFormat = new SimpleDateFormat("yyyy-MM"); | 61 | SimpleDateFormat outputFormat = new SimpleDateFormat("yyyy-MM"); |
| 79 | String outputDateString = outputFormat.format(salaryMonth); | 62 | String outputDateString = outputFormat.format(salaryMonth); |
| 80 | - queryWrapper.apply("DATE_FORMAT(salary_month, '%Y-%m') = '" + outputDateString + "'"); | 63 | + queryWrapper.apply("DATE_FORMAT(yan_time, '%Y-%m') = '" + outputDateString + "'"); |
| 81 | } | 64 | } |
| 82 | - Page<TblWorkTime> page = new Page<TblWorkTime>(pageNo, pageSize); | ||
| 83 | - IPage<TblWorkTime> pageList = tblWorkTimeService.page(page, queryWrapper); | 65 | + Page<ViewWorkTime> page = new Page<ViewWorkTime>(pageNo, pageSize); |
| 66 | + IPage<ViewWorkTime> pageList = tblWorkTimeService.page(page, queryWrapper); | ||
| 84 | return Result.OK(pageList); | 67 | return Result.OK(pageList); |
| 85 | } | 68 | } |
| 86 | 69 | ||
| 87 | /** | 70 | /** |
| 88 | * 添加 | 71 | * 添加 |
| 89 | * | 72 | * |
| 90 | - * @param tblWorkTime | 73 | + * @param viewWorkTime |
| 91 | * @return | 74 | * @return |
| 92 | */ | 75 | */ |
| 93 | @AutoLog(value = "tbl_work_time-添加") | 76 | @AutoLog(value = "tbl_work_time-添加") |
| 94 | @ApiOperation(value="tbl_work_time-添加", notes="tbl_work_time-添加") | 77 | @ApiOperation(value="tbl_work_time-添加", notes="tbl_work_time-添加") |
| 95 | @PostMapping(value = "/add") | 78 | @PostMapping(value = "/add") |
| 96 | - public Result<String> add(@RequestBody TblWorkTime tblWorkTime) { | ||
| 97 | - tblWorkTimeService.save(tblWorkTime); | 79 | + public Result<String> add(@RequestBody ViewWorkTime viewWorkTime) { |
| 80 | + tblWorkTimeService.save(viewWorkTime); | ||
| 98 | return Result.OK("添加成功!"); | 81 | return Result.OK("添加成功!"); |
| 99 | } | 82 | } |
| 100 | 83 | ||
| 101 | /** | 84 | /** |
| 102 | * 编辑 | 85 | * 编辑 |
| 103 | * | 86 | * |
| 104 | - * @param tblWorkTime | 87 | + * @param viewWorkTime |
| 105 | * @return | 88 | * @return |
| 106 | */ | 89 | */ |
| 107 | @AutoLog(value = "tbl_work_time-编辑") | 90 | @AutoLog(value = "tbl_work_time-编辑") |
| 108 | @ApiOperation(value="tbl_work_time-编辑", notes="tbl_work_time-编辑") | 91 | @ApiOperation(value="tbl_work_time-编辑", notes="tbl_work_time-编辑") |
| 109 | @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) | 92 | @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) |
| 110 | - public Result<String> edit(@RequestBody TblWorkTime tblWorkTime) { | ||
| 111 | - tblWorkTimeService.updateById(tblWorkTime); | 93 | + public Result<String> edit(@RequestBody ViewWorkTime viewWorkTime) { |
| 94 | + tblWorkTimeService.updateById(viewWorkTime); | ||
| 112 | return Result.OK("编辑成功!"); | 95 | return Result.OK("编辑成功!"); |
| 113 | } | 96 | } |
| 114 | 97 | ||
| @@ -149,23 +132,23 @@ public class TblWorkTimeController extends JeecgController<TblWorkTime, ITblWork | @@ -149,23 +132,23 @@ public class TblWorkTimeController extends JeecgController<TblWorkTime, ITblWork | ||
| 149 | //@AutoLog(value = "tbl_work_time-通过id查询") | 132 | //@AutoLog(value = "tbl_work_time-通过id查询") |
| 150 | @ApiOperation(value="tbl_work_time-通过id查询", notes="tbl_work_time-通过id查询") | 133 | @ApiOperation(value="tbl_work_time-通过id查询", notes="tbl_work_time-通过id查询") |
| 151 | @GetMapping(value = "/queryById") | 134 | @GetMapping(value = "/queryById") |
| 152 | - public Result<TblWorkTime> queryById(@RequestParam(name="id",required=true) String id) { | ||
| 153 | - TblWorkTime tblWorkTime = tblWorkTimeService.getById(id); | ||
| 154 | - if(tblWorkTime==null) { | 135 | + public Result<ViewWorkTime> queryById(@RequestParam(name="id",required=true) String id) { |
| 136 | + ViewWorkTime viewWorkTime = tblWorkTimeService.getById(id); | ||
| 137 | + if(viewWorkTime ==null) { | ||
| 155 | return Result.error("未找到对应数据"); | 138 | return Result.error("未找到对应数据"); |
| 156 | } | 139 | } |
| 157 | - return Result.OK(tblWorkTime); | 140 | + return Result.OK(viewWorkTime); |
| 158 | } | 141 | } |
| 159 | 142 | ||
| 160 | /** | 143 | /** |
| 161 | * 导出excel | 144 | * 导出excel |
| 162 | * | 145 | * |
| 163 | * @param request | 146 | * @param request |
| 164 | - * @param tblWorkTime | 147 | + * @param viewWorkTime |
| 165 | */ | 148 | */ |
| 166 | @RequestMapping(value = "/exportXls") | 149 | @RequestMapping(value = "/exportXls") |
| 167 | - public ModelAndView exportXls(HttpServletRequest request, TblWorkTime tblWorkTime) { | ||
| 168 | - return super.exportXls(request, tblWorkTime, TblWorkTime.class, "tbl_work_time"); | 150 | + public ModelAndView exportXls(HttpServletRequest request, ViewWorkTime viewWorkTime) { |
| 151 | + return super.exportXls(request, viewWorkTime, ViewWorkTime.class, "月工时信息"); | ||
| 169 | } | 152 | } |
| 170 | 153 | ||
| 171 | /** | 154 | /** |
| @@ -177,7 +160,7 @@ public class TblWorkTimeController extends JeecgController<TblWorkTime, ITblWork | @@ -177,7 +160,7 @@ public class TblWorkTimeController extends JeecgController<TblWorkTime, ITblWork | ||
| 177 | */ | 160 | */ |
| 178 | @RequestMapping(value = "/importExcel", method = RequestMethod.POST) | 161 | @RequestMapping(value = "/importExcel", method = RequestMethod.POST) |
| 179 | public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { | 162 | public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { |
| 180 | - return super.importExcel(request, response, TblWorkTime.class); | 163 | + return super.importExcel(request, response, ViewWorkTime.class); |
| 181 | } | 164 | } |
| 182 | 165 | ||
| 183 | } | 166 | } |
| @@ -53,11 +53,11 @@ public class TblOrderForm implements Serializable { | @@ -53,11 +53,11 @@ public class TblOrderForm implements Serializable { | ||
| 53 | @ApiModelProperty(value = "所属部门") | 53 | @ApiModelProperty(value = "所属部门") |
| 54 | private java.lang.String sysOrgCode; | 54 | private java.lang.String sysOrgCode; |
| 55 | /**主料号*/ | 55 | /**主料号*/ |
| 56 | - @Excel(name = "主料号", width = 15) | 56 | +// @Excel(name = "主料号", width = 15) |
| 57 | @ApiModelProperty(value = "主料号") | 57 | @ApiModelProperty(value = "主料号") |
| 58 | private java.lang.String orderId; | 58 | private java.lang.String orderId; |
| 59 | /**订货单位*/ | 59 | /**订货单位*/ |
| 60 | - @Excel(name = "订货单位", width = 15) | 60 | +// @Excel(name = "订货单位", width = 15) |
| 61 | @ApiModelProperty(value = "订货单位") | 61 | @ApiModelProperty(value = "订货单位") |
| 62 | private java.lang.String orderCompany; | 62 | private java.lang.String orderCompany; |
| 63 | 63 |
| @@ -22,28 +22,65 @@ import java.math.BigDecimal; | @@ -22,28 +22,65 @@ import java.math.BigDecimal; | ||
| 22 | * @Version: V1.0 | 22 | * @Version: V1.0 |
| 23 | */ | 23 | */ |
| 24 | @Data | 24 | @Data |
| 25 | -@TableName("tbl_work_time") | 25 | +@TableName("view_work_time") |
| 26 | @Accessors(chain = true) | 26 | @Accessors(chain = true) |
| 27 | @EqualsAndHashCode(callSuper = false) | 27 | @EqualsAndHashCode(callSuper = false) |
| 28 | -@ApiModel(value="tbl_work_time对象", description="tbl_work_time") | ||
| 29 | -public class TblWorkTime implements Serializable { | 28 | +@ApiModel(value="view_work_time对象", description="view_work_time") |
| 29 | +public class ViewWorkTime implements Serializable { | ||
| 30 | private static final long serialVersionUID = 1L; | 30 | private static final long serialVersionUID = 1L; |
| 31 | 31 | ||
| 32 | /**id*/ | 32 | /**id*/ |
| 33 | @TableId(type = IdType.ASSIGN_ID) | 33 | @TableId(type = IdType.ASSIGN_ID) |
| 34 | @ApiModelProperty(value = "id") | 34 | @ApiModelProperty(value = "id") |
| 35 | private java.lang.Integer id; | 35 | private java.lang.Integer id; |
| 36 | - /**月份*/ | 36 | + /**订单号*/ |
| 37 | +// @Excel(name = "订单号", width = 15) | ||
| 38 | + @ApiModelProperty(value = "订单号") | ||
| 39 | + private java.lang.String orderNumber; | ||
| 40 | + /**产品类型*/ | ||
| 41 | +// @Excel(name = "产品类型", width = 15) | ||
| 42 | + @ApiModelProperty(value = "产品类型") | ||
| 43 | + private java.lang.String productType; | ||
| 44 | + /**工序*/ | ||
| 45 | +// @Excel(name = "工序", width = 15) | ||
| 46 | + @ApiModelProperty(value = "工序") | ||
| 47 | + private java.lang.String workingProcedure; | ||
| 48 | + /**承接人*/ | ||
| 49 | + @Excel(name = "承接人", width = 15) | ||
| 50 | + @ApiModelProperty(value = "承接人") | ||
| 51 | + private java.lang.String undertaker; | ||
| 52 | + /**工时*/ | ||
| 53 | + @Excel(name = "工时", width = 15) | ||
| 54 | + @ApiModelProperty(value = "工时") | ||
| 55 | + private java.math.BigDecimal workHours; | ||
| 56 | + /**派发时间*/ | ||
| 57 | +// @Excel(name = "派发时间", width = 15, format = "yyyy-MM-dd") | ||
| 58 | + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd") | ||
| 59 | + @DateTimeFormat(pattern="yyyy-MM-dd") | ||
| 60 | + @ApiModelProperty(value = "派发时间") | ||
| 61 | + private java.util.Date dispatchTime; | ||
| 62 | + /**派发人*/ | ||
| 63 | +// @Excel(name = "派发人", width = 15) | ||
| 64 | + @ApiModelProperty(value = "派发人") | ||
| 65 | + private java.lang.String dispatchRen; | ||
| 66 | + /**验收时间*/ | ||
| 67 | + @Excel(name = "验收时间", width = 15, format = "yyyy-MM") | ||
| 37 | @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM") | 68 | @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM") |
| 38 | @DateTimeFormat(pattern="yyyy-MM") | 69 | @DateTimeFormat(pattern="yyyy-MM") |
| 39 | - @ApiModelProperty(value = "月份") | ||
| 40 | - private java.util.Date salaryMonth; | ||
| 41 | - /**姓名*/ | ||
| 42 | - @ApiModelProperty(value = "姓名") | ||
| 43 | - private java.lang.String name; | ||
| 44 | - /**月总工时*/ | ||
| 45 | - @ApiModelProperty(value = "月总工时") | ||
| 46 | - private BigDecimal workTime; | 70 | + @ApiModelProperty(value = "验收时间") |
| 71 | + private java.util.Date yanTime; | ||
| 72 | + /**验收人*/ | ||
| 73 | +// @Excel(name = "验收人", width = 15) | ||
| 74 | + @ApiModelProperty(value = "验收人") | ||
| 75 | + private java.lang.String yanRen; | ||
| 76 | + /**验收结果*/ | ||
| 77 | +// @Excel(name = "验收结果", width = 15) | ||
| 78 | + @ApiModelProperty(value = "验收结果") | ||
| 79 | + private java.lang.String yanResult; | ||
| 80 | + /**备注*/ | ||
| 81 | +// @Excel(name = "备注", width = 15) | ||
| 82 | + @ApiModelProperty(value = "备注") | ||
| 83 | + private java.lang.String notes; | ||
| 47 | /**创建人*/ | 84 | /**创建人*/ |
| 48 | @ApiModelProperty(value = "创建人") | 85 | @ApiModelProperty(value = "创建人") |
| 49 | private java.lang.String createBy; | 86 | private java.lang.String createBy; |
| 1 | package org.jeecg.modules.erp.order_form.mapper; | 1 | package org.jeecg.modules.erp.order_form.mapper; |
| 2 | 2 | ||
| 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| 4 | -import org.jeecg.modules.erp.order_form.entity.TblWorkTime; | 4 | +import org.jeecg.modules.erp.order_form.entity.ViewWorkTime; |
| 5 | 5 | ||
| 6 | -public interface TblWorkTimeMapper extends BaseMapper<TblWorkTime> { | 6 | +public interface ViewWorkTimeMapper extends BaseMapper<ViewWorkTime> { |
| 7 | 7 | ||
| 8 | } | 8 | } |
| 1 | <?xml version="1.0" encoding="UTF-8"?> | 1 | <?xml version="1.0" encoding="UTF-8"?> |
| 2 | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | 2 | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| 3 | -<mapper namespace="org.jeecg.modules.erp.order_form.mapper.TblWorkTimeMapper"> | 3 | +<mapper namespace="org.jeecg.modules.erp.order_form.mapper.ViewWorkTimeMapper"> |
| 4 | 4 | ||
| 5 | </mapper> | 5 | </mapper> |
| 1 | package org.jeecg.modules.erp.order_form.service; | 1 | package org.jeecg.modules.erp.order_form.service; |
| 2 | 2 | ||
| 3 | import com.baomidou.mybatisplus.extension.service.IService; | 3 | import com.baomidou.mybatisplus.extension.service.IService; |
| 4 | -import org.jeecg.modules.erp.order_form.entity.TblWorkTime; | 4 | +import org.jeecg.modules.erp.order_form.entity.ViewWorkTime; |
| 5 | 5 | ||
| 6 | -public interface ITblWorkTimeService extends IService<TblWorkTime> { | 6 | +public interface IViewWorkTimeService extends IService<ViewWorkTime> { |
| 7 | } | 7 | } |
| 1 | package org.jeecg.modules.erp.order_form.service.impl; | 1 | package org.jeecg.modules.erp.order_form.service.impl; |
| 2 | 2 | ||
| 3 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | 3 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| 4 | -import org.jeecg.modules.erp.order_form.entity.TblWorkTime; | ||
| 5 | -import org.jeecg.modules.erp.order_form.mapper.TblWorkTimeMapper; | ||
| 6 | -import org.jeecg.modules.erp.order_form.service.ITblWorkTimeService; | 4 | +import org.jeecg.modules.erp.order_form.entity.ViewWorkTime; |
| 5 | +import org.jeecg.modules.erp.order_form.mapper.ViewWorkTimeMapper; | ||
| 6 | +import org.jeecg.modules.erp.order_form.service.IViewWorkTimeService; | ||
| 7 | import org.springframework.stereotype.Service; | 7 | import org.springframework.stereotype.Service; |
| 8 | 8 | ||
| 9 | @Service | 9 | @Service |
| 10 | -public class TblWorkTimeServiceImpl extends ServiceImpl<TblWorkTimeMapper, TblWorkTime> implements ITblWorkTimeService { | 10 | +public class ViewWorkTimeServiceImpl extends ServiceImpl<ViewWorkTimeMapper, ViewWorkTime> implements IViewWorkTimeService { |
| 11 | } | 11 | } |
| @@ -101,21 +101,14 @@ public class TblProductionGongxuController extends JeecgController<TblProduction | @@ -101,21 +101,14 @@ public class TblProductionGongxuController extends JeecgController<TblProduction | ||
| 101 | @PutMapping("/updateYan") | 101 | @PutMapping("/updateYan") |
| 102 | @Transactional(rollbackFor = Exception.class) | 102 | @Transactional(rollbackFor = Exception.class) |
| 103 | public Result<?> updateYan(@RequestBody List<TblProductionGongxu> tblProductionGongxuList){ | 103 | public Result<?> updateYan(@RequestBody List<TblProductionGongxu> tblProductionGongxuList){ |
| 104 | +// if(tblProductionGongxuList.size()<=0){ | ||
| 105 | +// return Result.ok("没有修改的数据"); | ||
| 106 | +// } | ||
| 104 | boolean b = tblProductionGongxuService.updateBatchById(tblProductionGongxuList); | 107 | boolean b = tblProductionGongxuService.updateBatchById(tblProductionGongxuList); |
| 105 | - LambdaQueryWrapper<TblProductionGongxu> queryWrapper=new LambdaQueryWrapper<TblProductionGongxu>() | ||
| 106 | - .eq(TblProductionGongxu::getOrderNumber,tblProductionGongxuList.get(0).getOrderNumber()); | ||
| 107 | if(b){ | 108 | if(b){ |
| 108 | - tblProductionGongxuService.selectAdd();//查询已合格工序并汇总工时 | ||
| 109 | - List<TblProductionGongxu> list = tblProductionGongxuService.list(queryWrapper); | ||
| 110 | - boolean allHhhQualified = true; | ||
| 111 | - for (TblProductionGongxu productionGongxu : list) { | ||
| 112 | - if (!"合格入库".equals(productionGongxu.getYanResult())) { | ||
| 113 | - // 如果有任何一个元素的hhh值不是“合格入库”,则置标志位为false,并跳出循环 | ||
| 114 | - allHhhQualified = false; | ||
| 115 | - break; | ||
| 116 | - } | ||
| 117 | - } | ||
| 118 | - if(allHhhQualified){ | 109 | + //tblProductionGongxuService.selectAdd();//查询已合格工序并汇总工时 |
| 110 | + int count=tblProductionGongxuService.selectCount(tblProductionGongxuList.get(0).getOrderNumber()); //查工序表不合格数据 | ||
| 111 | + if(count<=0){ | ||
| 119 | tblProductionGongxuService.updateByStatus(tblProductionGongxuList.get(0).getOrderNumber()); | 112 | tblProductionGongxuService.updateByStatus(tblProductionGongxuList.get(0).getOrderNumber()); |
| 120 | } | 113 | } |
| 121 | } | 114 | } |
| @@ -11,7 +11,6 @@ import com.fasterxml.jackson.annotation.JsonFormat; | @@ -11,7 +11,6 @@ import com.fasterxml.jackson.annotation.JsonFormat; | ||
| 11 | import org.jeecg.common.api.vo.Result; | 11 | import org.jeecg.common.api.vo.Result; |
| 12 | import org.jeecg.common.system.query.QueryGenerator; | 12 | import org.jeecg.common.system.query.QueryGenerator; |
| 13 | import org.jeecg.modules.erp.order_form.entity.TblOrderForm; | 13 | import org.jeecg.modules.erp.order_form.entity.TblOrderForm; |
| 14 | -import org.jeecg.modules.erp.order_form.entity.TblWorkTime; | ||
| 15 | import org.jeecg.modules.erp.order_form.service.ITblOrderFormService; | 14 | import org.jeecg.modules.erp.order_form.service.ITblOrderFormService; |
| 16 | import org.jeecg.modules.erp.product_design.entity.TblProductDesign; | 15 | import org.jeecg.modules.erp.product_design.entity.TblProductDesign; |
| 17 | import org.jeecg.modules.erp.product_design.service.ITblProductDesignService; | 16 | import org.jeecg.modules.erp.product_design.service.ITblProductDesignService; |
| @@ -28,7 +27,6 @@ import org.springframework.beans.factory.annotation.Autowired; | @@ -28,7 +27,6 @@ import org.springframework.beans.factory.annotation.Autowired; | ||
| 28 | import org.springframework.format.annotation.DateTimeFormat; | 27 | import org.springframework.format.annotation.DateTimeFormat; |
| 29 | import org.springframework.web.bind.annotation.*; | 28 | import org.springframework.web.bind.annotation.*; |
| 30 | import org.springframework.web.servlet.ModelAndView; | 29 | import org.springframework.web.servlet.ModelAndView; |
| 31 | -import io.swagger.annotations.Api; | ||
| 32 | import io.swagger.annotations.ApiOperation; | 30 | import io.swagger.annotations.ApiOperation; |
| 33 | import org.jeecg.common.aspect.annotation.AutoLog; | 31 | import org.jeecg.common.aspect.annotation.AutoLog; |
| 34 | 32 | ||
| @@ -99,15 +97,15 @@ public class TblProductionPlanController extends JeecgController<TblOrderForm, I | @@ -99,15 +97,15 @@ public class TblProductionPlanController extends JeecgController<TblOrderForm, I | ||
| 99 | 97 | ||
| 100 | // 根据日期、姓名查找工序 | 98 | // 根据日期、姓名查找工序 |
| 101 | @GetMapping(value = "/querygxone") | 99 | @GetMapping(value = "/querygxone") |
| 102 | - public Result<?> querygxone(@RequestParam(name = "salaryMonth") | 100 | + public Result<?> querygxone(@RequestParam(name = "yanTime") |
| 103 | @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM") | 101 | @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM") |
| 104 | @DateTimeFormat(pattern="yyyy-MM") | 102 | @DateTimeFormat(pattern="yyyy-MM") |
| 105 | - Date salaryMonth, @RequestParam(name="name",required=true) String name) { | 103 | + Date yanTime, @RequestParam(name="undertaker",required=true) String undertaker) { |
| 106 | QueryWrapper<TblProductionGongxu> queryWrapper = new QueryWrapper<>(); | 104 | QueryWrapper<TblProductionGongxu> queryWrapper = new QueryWrapper<>(); |
| 107 | SimpleDateFormat outputFormat = new SimpleDateFormat("yyyy-MM"); | 105 | SimpleDateFormat outputFormat = new SimpleDateFormat("yyyy-MM"); |
| 108 | - String outputDateString = outputFormat.format(salaryMonth); | 106 | + String outputDateString = outputFormat.format(yanTime); |
| 109 | queryWrapper.apply("DATE_FORMAT(yan_time, '%Y-%m') = '" + outputDateString + "'"); | 107 | queryWrapper.apply("DATE_FORMAT(yan_time, '%Y-%m') = '" + outputDateString + "'"); |
| 110 | - queryWrapper.eq("undertaker",name); | 108 | + queryWrapper.eq("undertaker",undertaker); |
| 111 | queryWrapper.eq("yan_result","合格入库"); | 109 | queryWrapper.eq("yan_result","合格入库"); |
| 112 | List<TblProductionGongxu> list = gongxuService.list(queryWrapper); | 110 | List<TblProductionGongxu> list = gongxuService.list(queryWrapper); |
| 113 | return Result.OK(list); | 111 | return Result.OK(list); |
| @@ -25,4 +25,6 @@ public interface TblProductionGongxuMapper extends BaseMapper<TblProductionGongx | @@ -25,4 +25,6 @@ public interface TblProductionGongxuMapper extends BaseMapper<TblProductionGongx | ||
| 25 | Integer deleteByOrderId(String orderId); | 25 | Integer deleteByOrderId(String orderId); |
| 26 | 26 | ||
| 27 | void selectAdd(); | 27 | void selectAdd(); |
| 28 | + | ||
| 29 | + int selectNoClount(String orderNumber); | ||
| 28 | } | 30 | } |
| @@ -13,6 +13,18 @@ | @@ -13,6 +13,18 @@ | ||
| 13 | <select id="getByhours" resultType="org.jeecg.modules.erp.order_form.entity.TblOrderForm"> | 13 | <select id="getByhours" resultType="org.jeecg.modules.erp.order_form.entity.TblOrderForm"> |
| 14 | select * from tbl_order_form where order_id=#{orderNumber} | 14 | select * from tbl_order_form where order_id=#{orderNumber} |
| 15 | </select> | 15 | </select> |
| 16 | + <select id="selectNoClount" resultType="java.lang.Integer"> | ||
| 17 | + SELECT | ||
| 18 | + count( 1 ) | ||
| 19 | + FROM | ||
| 20 | + tbl_production_gongxu | ||
| 21 | + WHERE | ||
| 22 | + order_number = #{orderNumber} | ||
| 23 | + AND ( | ||
| 24 | + yan_result IS NULL | ||
| 25 | + OR yan_result = '' | ||
| 26 | + OR yan_result = '不合格') | ||
| 27 | + </select> | ||
| 16 | <insert id="selectAdd"> | 28 | <insert id="selectAdd"> |
| 17 | INSERT INTO tbl_work_time(`name`, salary_month, work_time) | 29 | INSERT INTO tbl_work_time(`name`, salary_month, work_time) |
| 18 | SELECT undertaker,yan_time, SUM(work_hours) | 30 | SELECT undertaker,yan_time, SUM(work_hours) |
| @@ -25,4 +25,6 @@ public interface ITblProductionGongxuService extends IService<TblProductionGongx | @@ -25,4 +25,6 @@ public interface ITblProductionGongxuService extends IService<TblProductionGongx | ||
| 25 | Integer deleteByOrderId(String orderId); | 25 | Integer deleteByOrderId(String orderId); |
| 26 | 26 | ||
| 27 | void selectAdd(); | 27 | void selectAdd(); |
| 28 | + | ||
| 29 | + int selectCount(String orderNumber); | ||
| 28 | } | 30 | } |
| @@ -49,4 +49,9 @@ public class TblProductionGongxuServiceImpl extends ServiceImpl<TblProductionGon | @@ -49,4 +49,9 @@ public class TblProductionGongxuServiceImpl extends ServiceImpl<TblProductionGon | ||
| 49 | tblProductionGongxuMapper.selectAdd(); | 49 | tblProductionGongxuMapper.selectAdd(); |
| 50 | } | 50 | } |
| 51 | 51 | ||
| 52 | + @Override | ||
| 53 | + public int selectCount(String orderNumber) { | ||
| 54 | + return tblProductionGongxuMapper.selectNoClount(orderNumber); | ||
| 55 | + } | ||
| 56 | + | ||
| 52 | } | 57 | } |
| 1 | package org.jeecg.modules.erp.salary.controller; | 1 | package org.jeecg.modules.erp.salary.controller; |
| 2 | 2 | ||
| 3 | +import com.aliyun.oss.common.utils.StringUtils; | ||
| 3 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | 4 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| 4 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 5 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| 5 | import com.baomidou.mybatisplus.core.metadata.IPage; | 6 | import com.baomidou.mybatisplus.core.metadata.IPage; |
| @@ -16,15 +17,18 @@ import org.jeecg.common.system.query.QueryGenerator; | @@ -16,15 +17,18 @@ import org.jeecg.common.system.query.QueryGenerator; | ||
| 16 | import org.jeecg.modules.erp.order_form.entity.TblOrderForm; | 17 | import org.jeecg.modules.erp.order_form.entity.TblOrderForm; |
| 17 | import org.jeecg.modules.erp.salary.entity.TblSalaryBase; | 18 | import org.jeecg.modules.erp.salary.entity.TblSalaryBase; |
| 18 | import org.jeecg.modules.erp.salary.entity.TblSalarySuanfa; | 19 | import org.jeecg.modules.erp.salary.entity.TblSalarySuanfa; |
| 20 | +import org.jeecg.modules.erp.salary.service.ITblSalaryCalculationService; | ||
| 19 | import org.jeecg.modules.erp.salary.service.ITblSalarySuanfaService; | 21 | import org.jeecg.modules.erp.salary.service.ITblSalarySuanfaService; |
| 20 | import org.jeecg.modules.erp.salary.service.TblSalaryBaseService; | 22 | import org.jeecg.modules.erp.salary.service.TblSalaryBaseService; |
| 21 | import org.jeecg.modules.erp.trad.entity.TblTradTender; | 23 | import org.jeecg.modules.erp.trad.entity.TblTradTender; |
| 22 | import org.springframework.beans.factory.annotation.Autowired; | 24 | import org.springframework.beans.factory.annotation.Autowired; |
| 25 | +import org.springframework.transaction.annotation.Transactional; | ||
| 23 | import org.springframework.web.bind.annotation.*; | 26 | import org.springframework.web.bind.annotation.*; |
| 24 | import org.springframework.web.servlet.ModelAndView; | 27 | import org.springframework.web.servlet.ModelAndView; |
| 25 | 28 | ||
| 26 | import javax.servlet.http.HttpServletRequest; | 29 | import javax.servlet.http.HttpServletRequest; |
| 27 | import javax.servlet.http.HttpServletResponse; | 30 | import javax.servlet.http.HttpServletResponse; |
| 31 | +import java.lang.reflect.Field; | ||
| 28 | import java.util.*; | 32 | import java.util.*; |
| 29 | 33 | ||
| 30 | /** | 34 | /** |
| @@ -42,7 +46,8 @@ public class TblSalaryBaseController extends JeecgController<TblSalaryBase, Tbl | @@ -42,7 +46,8 @@ public class TblSalaryBaseController extends JeecgController<TblSalaryBase, Tbl | ||
| 42 | @Autowired | 46 | @Autowired |
| 43 | private TblSalaryBaseService tblSalaryBaseService; | 47 | private TblSalaryBaseService tblSalaryBaseService; |
| 44 | 48 | ||
| 45 | - | 49 | + @Autowired |
| 50 | + private ITblSalaryCalculationService tblSalaryCalculationService; | ||
| 46 | /** | 51 | /** |
| 47 | * 分页列表查询 | 52 | * 分页列表查询 |
| 48 | * | 53 | * |
| @@ -59,44 +64,40 @@ public class TblSalaryBaseController extends JeecgController<TblSalaryBase, Tbl | @@ -59,44 +64,40 @@ public class TblSalaryBaseController extends JeecgController<TblSalaryBase, Tbl | ||
| 59 | @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, | 64 | @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, |
| 60 | HttpServletRequest req){ | 65 | HttpServletRequest req){ |
| 61 | 66 | ||
| 67 | + // 去除 tblSalaryBase 对象中的字符串字段的空格 | ||
| 68 | + trimStringFields(tblSalaryBase); | ||
| 62 | QueryWrapper<TblSalaryBase> queryWrapper = QueryGenerator.initQueryWrapper(tblSalaryBase, req.getParameterMap()); | 69 | QueryWrapper<TblSalaryBase> queryWrapper = QueryGenerator.initQueryWrapper(tblSalaryBase, req.getParameterMap()); |
| 63 | Page<TblSalaryBase> page = new Page<>(pageNo, pageSize); | 70 | Page<TblSalaryBase> page = new Page<>(pageNo, pageSize); |
| 64 | IPage<TblSalaryBase> pageList = tblSalaryBaseService.page(page,queryWrapper); | 71 | IPage<TblSalaryBase> pageList = tblSalaryBaseService.page(page,queryWrapper); |
| 65 | - // 查询所有符合条件的记录 | ||
| 66 | - List<TblSalaryBase> recordsToUpdate = tblSalaryBaseService.list(queryWrapper); | ||
| 67 | - List<TblSalaryBase> updateList = new ArrayList<>(); | ||
| 68 | - // 在这里可以根据需要进行更新操作 | ||
| 69 | - for (TblSalaryBase item : recordsToUpdate) { | ||
| 70 | - // 根据业务需求更新字段 | ||
| 71 | - if(item.getJobTitle() == null || item.getJobTitle().isEmpty()) { | ||
| 72 | - | ||
| 73 | - if (item.getJobName().equals("普工")) { | ||
| 74 | - item.setJobTitle("WorkshopGeneralWorker"); | ||
| 75 | - } else if (item.getJobName().equals("装配主管")) { | ||
| 76 | - item.setJobTitle("AssemblySupervisor"); | ||
| 77 | - } else if (item.getJobName().equals("装配工")) { | ||
| 78 | - item.setJobTitle("Assembler"); | ||
| 79 | - } else if (item.getJobName().equals("采购主管")) { | ||
| 80 | - item.setJobTitle("ProcurementSupervisor"); | ||
| 81 | - } else if (item.getJobName().equals("采购员")) { | ||
| 82 | - item.setJobTitle("PurchasingOfficer"); | ||
| 83 | - } else if (item.getJobName().equals("车间辅助人员")) { | ||
| 84 | - item.setJobTitle("WorkshopAuxiliaryPersonnel"); | ||
| 85 | - } else if (item.getJobName().equals("车间技术员")) { | ||
| 86 | - item.setJobTitle("WorkshopTechnician"); | ||
| 87 | - } else if (item.getJobName().equals("车间技术主管")) { | ||
| 88 | - item.setJobTitle("WorkshopTechnicalManager"); | ||
| 89 | - } else if (item.getJobName().equals("车间管理员")) { | ||
| 90 | - item.setJobTitle("WorkshopDirector"); | ||
| 91 | - } else if (item.getJobName().equals("办公室行政人员")) { | ||
| 92 | - item.setJobTitle("OfficeAdministrative"); | ||
| 93 | - } | ||
| 94 | - updateList.add(item); // 将需要更新的对象加入集合 | ||
| 95 | - } | ||
| 96 | - } | ||
| 97 | - tblSalaryBaseService.updateBatchById(updateList); // 批量更新数据 | ||
| 98 | return Result.OK(pageList); | 72 | return Result.OK(pageList); |
| 99 | } | 73 | } |
| 74 | + private void trimStringFields(Object obj) { | ||
| 75 | + if (obj == null) { | ||
| 76 | + return; | ||
| 77 | + } | ||
| 78 | + | ||
| 79 | + // 获取所有声明的字段,包括私有字段 | ||
| 80 | + Field[] fields = obj.getClass().getDeclaredFields(); | ||
| 81 | + for (Field field : fields) { | ||
| 82 | + if (field.getType() == String.class) { | ||
| 83 | + try { | ||
| 84 | + // 设置私有字段可访问 | ||
| 85 | + field.setAccessible(true); | ||
| 86 | + // 获取字段值 | ||
| 87 | + String value = (String) field.get(obj); | ||
| 88 | + if (value != null) { | ||
| 89 | + // 去除空格并重新设置字段值 | ||
| 90 | + String trimmedValue = value.replaceAll("\\s", ""); | ||
| 91 | + field.set(obj, trimmedValue); | ||
| 92 | + System.out.println("Trimmed field: " + field.getName() + ", Original: [" + value + "], Trimmed: [" + trimmedValue + "]"); | ||
| 93 | + } | ||
| 94 | + } catch (IllegalAccessException e) { | ||
| 95 | + // 处理异常 | ||
| 96 | + e.printStackTrace(); | ||
| 97 | + } | ||
| 98 | + } | ||
| 99 | + } | ||
| 100 | + } | ||
| 100 | 101 | ||
| 101 | //人员下拉 | 102 | //人员下拉 |
| 102 | @GetMapping(value = "/listSalary") | 103 | @GetMapping(value = "/listSalary") |
| @@ -130,8 +131,34 @@ public class TblSalaryBaseController extends JeecgController<TblSalaryBase, Tbl | @@ -130,8 +131,34 @@ public class TblSalaryBaseController extends JeecgController<TblSalaryBase, Tbl | ||
| 130 | 131 | ||
| 131 | @ApiOperation(value = "tbl_salary_base-新增") | 132 | @ApiOperation(value = "tbl_salary_base-新增") |
| 132 | @PostMapping(value = "/add") | 133 | @PostMapping(value = "/add") |
| 134 | + @Transactional(rollbackFor = Exception.class) | ||
| 133 | public Result<String> add(@RequestBody TblSalaryBase tblSalaryBase){ | 135 | public Result<String> add(@RequestBody TblSalaryBase tblSalaryBase){ |
| 134 | - tblSalaryBaseService.save(tblSalaryBase); | 136 | + boolean save = tblSalaryBaseService.save(tblSalaryBase); |
| 137 | + if (save) { | ||
| 138 | + if (tblSalaryBase.getJobName().equals("普工")) { | ||
| 139 | + tblSalaryBase.setJobTitle("WorkshopGeneralWorker"); | ||
| 140 | + } else if (tblSalaryBase.getJobName().equals("装配主管")) { | ||
| 141 | + tblSalaryBase.setJobTitle("AssemblySupervisor"); | ||
| 142 | + } else if (tblSalaryBase.getJobName().equals("装配工")) { | ||
| 143 | + tblSalaryBase.setJobTitle("Assembler"); | ||
| 144 | + } else if (tblSalaryBase.getJobName().equals("采购主管")) { | ||
| 145 | + tblSalaryBase.setJobTitle("ProcurementSupervisor"); | ||
| 146 | + } else if (tblSalaryBase.getJobName().equals("采购员")) { | ||
| 147 | + tblSalaryBase.setJobTitle("PurchasingOfficer"); | ||
| 148 | + } else if (tblSalaryBase.getJobName().equals("车间辅助人员")) { | ||
| 149 | + tblSalaryBase.setJobTitle("WorkshopAuxiliaryPersonnel"); | ||
| 150 | + } else if (tblSalaryBase.getJobName().equals("车间技术员")) { | ||
| 151 | + tblSalaryBase.setJobTitle("WorkshopTechnician"); | ||
| 152 | + } else if (tblSalaryBase.getJobName().equals("车间技术主管")) { | ||
| 153 | + tblSalaryBase.setJobTitle("WorkshopTechnicalManager"); | ||
| 154 | + } else if (tblSalaryBase.getJobName().equals("车间管理员")) { | ||
| 155 | + tblSalaryBase.setJobTitle("WorkshopDirector"); | ||
| 156 | + } else if (tblSalaryBase.getJobName().equals("办公室行政人员")) { | ||
| 157 | + tblSalaryBase.setJobTitle("OfficeAdministrative"); | ||
| 158 | + } | ||
| 159 | + tblSalaryBaseService.updateById(tblSalaryBase); | ||
| 160 | + } | ||
| 161 | + | ||
| 135 | return Result.ok("添加成功"); | 162 | return Result.ok("添加成功"); |
| 136 | } | 163 | } |
| 137 | 164 | ||
| @@ -171,8 +198,35 @@ public class TblSalaryBaseController extends JeecgController<TblSalaryBase, Tbl | @@ -171,8 +198,35 @@ public class TblSalaryBaseController extends JeecgController<TblSalaryBase, Tbl | ||
| 171 | @AutoLog(value = "tbl_salary_base-编辑") | 198 | @AutoLog(value = "tbl_salary_base-编辑") |
| 172 | @ApiOperation(value="tbl_salary_base-编辑", notes="tbl_salary_base-编辑") | 199 | @ApiOperation(value="tbl_salary_base-编辑", notes="tbl_salary_base-编辑") |
| 173 | @RequestMapping(value = "/update", method = {RequestMethod.PUT,RequestMethod.POST}) | 200 | @RequestMapping(value = "/update", method = {RequestMethod.PUT,RequestMethod.POST}) |
| 201 | + @Transactional(rollbackFor = Exception.class) | ||
| 174 | public Result<String> update(@RequestBody TblSalaryBase tblSalaryBase) { | 202 | public Result<String> update(@RequestBody TblSalaryBase tblSalaryBase) { |
| 203 | + boolean b = tblSalaryBaseService.updateById(tblSalaryBase); | ||
| 204 | + if(b){ | ||
| 205 | + if (tblSalaryBase.getJobName().equals("普工")) { | ||
| 206 | + tblSalaryBase.setJobTitle("WorkshopGeneralWorker"); | ||
| 207 | + } else if (tblSalaryBase.getJobName().equals("装配主管")) { | ||
| 208 | + tblSalaryBase.setJobTitle("AssemblySupervisor"); | ||
| 209 | + } else if (tblSalaryBase.getJobName().equals("装配工")) { | ||
| 210 | + tblSalaryBase.setJobTitle("Assembler"); | ||
| 211 | + } else if (tblSalaryBase.getJobName().equals("采购主管")) { | ||
| 212 | + tblSalaryBase.setJobTitle("ProcurementSupervisor"); | ||
| 213 | + } else if (tblSalaryBase.getJobName().equals("采购员")) { | ||
| 214 | + tblSalaryBase.setJobTitle("PurchasingOfficer"); | ||
| 215 | + } else if (tblSalaryBase.getJobName().equals("车间辅助人员")) { | ||
| 216 | + tblSalaryBase.setJobTitle("WorkshopAuxiliaryPersonnel"); | ||
| 217 | + } else if (tblSalaryBase.getJobName().equals("车间技术员")) { | ||
| 218 | + tblSalaryBase.setJobTitle("WorkshopTechnician"); | ||
| 219 | + } else if (tblSalaryBase.getJobName().equals("车间技术主管")) { | ||
| 220 | + tblSalaryBase.setJobTitle("WorkshopTechnicalManager"); | ||
| 221 | + } else if (tblSalaryBase.getJobName().equals("车间管理员")) { | ||
| 222 | + tblSalaryBase.setJobTitle("WorkshopDirector"); | ||
| 223 | + } else if (tblSalaryBase.getJobName().equals("办公室行政人员")) { | ||
| 224 | + tblSalaryBase.setJobTitle("OfficeAdministrative"); | ||
| 225 | + } | ||
| 175 | tblSalaryBaseService.updateById(tblSalaryBase); | 226 | tblSalaryBaseService.updateById(tblSalaryBase); |
| 227 | + tblSalaryCalculationService.selectAndUpd(); | ||
| 228 | + } | ||
| 229 | + | ||
| 176 | return Result.OK("编辑成功!"); | 230 | return Result.OK("编辑成功!"); |
| 177 | } | 231 | } |
| 178 | 232 | ||
| @@ -214,6 +268,6 @@ public class TblSalaryBaseController extends JeecgController<TblSalaryBase, Tbl | @@ -214,6 +268,6 @@ public class TblSalaryBaseController extends JeecgController<TblSalaryBase, Tbl | ||
| 214 | */ | 268 | */ |
| 215 | @RequestMapping(value = "/importExcel", method = RequestMethod.POST) | 269 | @RequestMapping(value = "/importExcel", method = RequestMethod.POST) |
| 216 | public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { | 270 | public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { |
| 217 | - return super.importExcel(request, response, TblSalaryBase.class); | 271 | + return super.importExcelbase(request, response, TblSalaryBase.class); |
| 218 | } | 272 | } |
| 219 | } | 273 | } |
| @@ -12,9 +12,8 @@ import org.jeecg.common.api.vo.Result; | @@ -12,9 +12,8 @@ import org.jeecg.common.api.vo.Result; | ||
| 12 | import org.jeecg.common.aspect.annotation.AutoLog; | 12 | import org.jeecg.common.aspect.annotation.AutoLog; |
| 13 | import org.jeecg.common.system.base.controller.JeecgController2; | 13 | import org.jeecg.common.system.base.controller.JeecgController2; |
| 14 | import org.jeecg.common.system.query.QueryGenerator; | 14 | import org.jeecg.common.system.query.QueryGenerator; |
| 15 | -import org.jeecg.common.util.oConvertUtils; | ||
| 16 | -import org.jeecg.modules.erp.order_form.entity.TblWorkTime; | ||
| 17 | -import org.jeecg.modules.erp.order_form.service.ITblWorkTimeService; | 15 | +import org.jeecg.modules.erp.order_form.entity.ViewWorkTime; |
| 16 | +import org.jeecg.modules.erp.order_form.service.IViewWorkTimeService; | ||
| 18 | import org.jeecg.modules.erp.salary.entity.TblSalaryBase; | 17 | import org.jeecg.modules.erp.salary.entity.TblSalaryBase; |
| 19 | import org.jeecg.modules.erp.salary.entity.TblSalaryCalculation; | 18 | import org.jeecg.modules.erp.salary.entity.TblSalaryCalculation; |
| 20 | import org.jeecg.modules.erp.salary.entity.TblSalaryCalculationVo; | 19 | import org.jeecg.modules.erp.salary.entity.TblSalaryCalculationVo; |
| @@ -31,8 +30,6 @@ import org.springframework.http.*; | @@ -31,8 +30,6 @@ import org.springframework.http.*; | ||
| 31 | import org.springframework.transaction.annotation.Transactional; | 30 | import org.springframework.transaction.annotation.Transactional; |
| 32 | import org.springframework.web.bind.annotation.*; | 31 | import org.springframework.web.bind.annotation.*; |
| 33 | 32 | ||
| 34 | -import org.springframework.core.io.ClassPathResource; | ||
| 35 | -import org.springframework.core.io.InputStreamResource; | ||
| 36 | import org.springframework.http.MediaType; | 33 | import org.springframework.http.MediaType; |
| 37 | import org.springframework.http.ResponseEntity; | 34 | import org.springframework.http.ResponseEntity; |
| 38 | import org.springframework.web.bind.annotation.GetMapping; | 35 | import org.springframework.web.bind.annotation.GetMapping; |
| @@ -40,26 +37,18 @@ import org.springframework.web.bind.annotation.RequestMapping; | @@ -40,26 +37,18 @@ import org.springframework.web.bind.annotation.RequestMapping; | ||
| 40 | import org.springframework.web.bind.annotation.RestController; | 37 | import org.springframework.web.bind.annotation.RestController; |
| 41 | 38 | ||
| 42 | import java.io.*; | 39 | import java.io.*; |
| 43 | -import java.net.URL; | ||
| 44 | -import java.net.URLEncoder; | ||
| 45 | -import java.nio.charset.StandardCharsets; | 40 | + |
| 46 | import org.springframework.web.servlet.ModelAndView; | 41 | import org.springframework.web.servlet.ModelAndView; |
| 47 | import org.springframework.web.util.HtmlUtils; | 42 | import org.springframework.web.util.HtmlUtils; |
| 48 | 43 | ||
| 49 | -import javax.servlet.http.HttpServlet; | ||
| 50 | import javax.servlet.http.HttpServletRequest; | 44 | import javax.servlet.http.HttpServletRequest; |
| 51 | import javax.servlet.http.HttpServletResponse; | 45 | import javax.servlet.http.HttpServletResponse; |
| 52 | import java.io.InputStream; | 46 | import java.io.InputStream; |
| 53 | -import java.nio.charset.StandardCharsets; | ||
| 54 | -import java.nio.file.Files; | ||
| 55 | import java.text.SimpleDateFormat; | 47 | import java.text.SimpleDateFormat; |
| 56 | import java.util.Arrays; | 48 | import java.util.Arrays; |
| 57 | import java.util.Date; | 49 | import java.util.Date; |
| 58 | import java.util.List; | 50 | import java.util.List; |
| 59 | import java.util.Objects; | 51 | import java.util.Objects; |
| 60 | -import java.util.stream.Collectors; | ||
| 61 | - | ||
| 62 | -import static org.apache.poi.hemf.record.emfplus.HemfPlusRecordType.object; | ||
| 63 | 52 | ||
| 64 | /** | 53 | /** |
| 65 | * @Description: tbl_salary_calculation | 54 | * @Description: tbl_salary_calculation |
| @@ -71,7 +60,7 @@ import static org.apache.poi.hemf.record.emfplus.HemfPlusRecordType.object; | @@ -71,7 +60,7 @@ import static org.apache.poi.hemf.record.emfplus.HemfPlusRecordType.object; | ||
| 71 | @RestController | 60 | @RestController |
| 72 | @RequestMapping("/salary/calculation") | 61 | @RequestMapping("/salary/calculation") |
| 73 | @Slf4j | 62 | @Slf4j |
| 74 | -public class TblSalaryCalculationController extends JeecgController2<TblSalaryCalculation, TblSalaryCalculationVo, TblSalaryBase, TblWorkTime, ITblSalaryCalculationVoService, ITblSalaryCalculationService, TblSalaryBaseService, ITblWorkTimeService> { | 63 | +public class TblSalaryCalculationController extends JeecgController2<TblSalaryCalculation, TblSalaryCalculationVo, TblSalaryBase, ViewWorkTime, ITblSalaryCalculationVoService, ITblSalaryCalculationService, TblSalaryBaseService, IViewWorkTimeService> { |
| 75 | @Autowired | 64 | @Autowired |
| 76 | private ITblSalaryCalculationService tblSalaryCalculationService; | 65 | private ITblSalaryCalculationService tblSalaryCalculationService; |
| 77 | @Autowired | 66 | @Autowired |
| @@ -94,7 +83,7 @@ public class TblSalaryCalculationController extends JeecgController2<TblSalaryCa | @@ -94,7 +83,7 @@ public class TblSalaryCalculationController extends JeecgController2<TblSalaryCa | ||
| 94 | HttpServletRequest req) { | 83 | HttpServletRequest req) { |
| 95 | QueryWrapper<TblSalaryCalculation> queryWrapper = QueryGenerator.initQueryWrapper(tblSalaryCalculation, req.getParameterMap()); | 84 | QueryWrapper<TblSalaryCalculation> queryWrapper = QueryGenerator.initQueryWrapper(tblSalaryCalculation, req.getParameterMap()); |
| 96 | Page<TblSalaryCalculation> page = new Page<>(pageNo, pageSize); | 85 | Page<TblSalaryCalculation> page = new Page<>(pageNo, pageSize); |
| 97 | - tblSalaryCalculationService.selectAndUpd(); | 86 | + |
| 98 | IPage<TblSalaryCalculation> pageList = tblSalaryCalculationService.page(page, queryWrapper); | 87 | IPage<TblSalaryCalculation> pageList = tblSalaryCalculationService.page(page, queryWrapper); |
| 99 | return Result.OK(pageList); | 88 | return Result.OK(pageList); |
| 100 | } | 89 | } |
| @@ -226,7 +215,7 @@ public class TblSalaryCalculationController extends JeecgController2<TblSalaryCa | @@ -226,7 +215,7 @@ public class TblSalaryCalculationController extends JeecgController2<TblSalaryCa | ||
| 226 | @ApiOperation(value="tbl_salary_calculation-导入", notes="tbl_salary_calculation-导入") | 215 | @ApiOperation(value="tbl_salary_calculation-导入", notes="tbl_salary_calculation-导入") |
| 227 | @RequestMapping(value = "/importExcel", method = RequestMethod.POST) | 216 | @RequestMapping(value = "/importExcel", method = RequestMethod.POST) |
| 228 | public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { | 217 | public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { |
| 229 | - return super.importExcelgz(request, response, TblSalaryCalculation.class,TblSalaryBase.class,TblWorkTime.class); | 218 | + return super.importExcelgz(request, response, TblSalaryCalculation.class,TblSalaryBase.class, ViewWorkTime.class); |
| 230 | } | 219 | } |
| 231 | 220 | ||
| 232 | 221 |
| @@ -37,7 +37,7 @@ | @@ -37,7 +37,7 @@ | ||
| 37 | sc.social_person = sb.social_person | 37 | sc.social_person = sb.social_person |
| 38 | 38 | ||
| 39 | WHERE | 39 | WHERE |
| 40 | - sc.salary_month = #{salaryMonth} AND EXISTS ( SELECT 1 FROM tbl_salary_base WHERE sb.user_name = sc.user_name ); | 40 | + sc.salary_month = #{salaryMonth} |
| 41 | </update> | 41 | </update> |
| 42 | <select id="select" resultType="org.jeecg.modules.erp.salary.entity.TblSalaryCalculation"> | 42 | <select id="select" resultType="org.jeecg.modules.erp.salary.entity.TblSalaryCalculation"> |
| 43 | select * from tbl_salary_calculation | 43 | select * from tbl_salary_calculation |
| @@ -150,16 +150,4 @@ public class TblTradZongController extends JeecgController<TblTradZong, TblTradZ | @@ -150,16 +150,4 @@ public class TblTradZongController extends JeecgController<TblTradZong, TblTradZ | ||
| 150 | return super.exportXls(request, tblTradZong, TblTradZong.class, "tbl_trad_zong"); | 150 | return super.exportXls(request, tblTradZong, TblTradZong.class, "tbl_trad_zong"); |
| 151 | } | 151 | } |
| 152 | 152 | ||
| 153 | - /** | ||
| 154 | - * 通过excel导入数据 | ||
| 155 | - * | ||
| 156 | - * @param request | ||
| 157 | - * @param response | ||
| 158 | - * @return | ||
| 159 | - */ | ||
| 160 | - @RequestMapping(value = "/importExcel", method = RequestMethod.POST) | ||
| 161 | - public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { | ||
| 162 | - return super.importExcelbase(request, response, TblTradZong.class); | ||
| 163 | - } | ||
| 164 | - | ||
| 165 | } | 153 | } |
-
请 注册 或 登录 后发表评论