|
|
@ -1,8 +1,12 @@ |
|
|
|
package com.win.module.wms.controller.onlinesettlementRecord; |
|
|
|
|
|
|
|
import com.win.framework.common.pojo.CustomConditions; |
|
|
|
import com.win.framework.dict.core.util.DictFrameworkUtils; |
|
|
|
import com.win.module.system.api.user.AdminUserApi; |
|
|
|
import com.win.module.system.api.user.dto.AdminUserRespDTO; |
|
|
|
import com.win.module.wms.dal.dataobject.onlinesettlementRecord.OnlinesettlementRecordDetailDO; |
|
|
|
import com.win.module.wms.enums.DictTypeConstants; |
|
|
|
import com.win.module.wms.service.onlinesettlementRecord.OnlinesettlementRecordDetailService; |
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
import javax.annotation.Resource; |
|
|
|
import org.springframework.validation.annotation.Validated; |
|
|
@ -36,36 +40,14 @@ import com.win.module.wms.service.onlinesettlementRecord.OnlinesettlementRecordM |
|
|
|
@Validated |
|
|
|
public class OnlinesettlementRecordMainController { |
|
|
|
|
|
|
|
@Resource |
|
|
|
private OnlinesettlementRecordDetailService onlinesettlementRecordDetailService; |
|
|
|
@Resource |
|
|
|
private OnlinesettlementRecordMainService onlinesettlementRecordMainService; |
|
|
|
|
|
|
|
@Resource |
|
|
|
private AdminUserApi userApi; |
|
|
|
|
|
|
|
@PostMapping("/create") |
|
|
|
@Operation(summary = "创建上线结算记录主") |
|
|
|
@PreAuthorize("@ss.hasPermission('wms:onlinesettlement-record-main:create')") |
|
|
|
public CommonResult<Long> createOnlinesettlementRecordMain(@Valid @RequestBody OnlinesettlementRecordMainCreateReqVO createReqVO) { |
|
|
|
return success(onlinesettlementRecordMainService.createOnlinesettlementRecordMain(createReqVO)); |
|
|
|
} |
|
|
|
|
|
|
|
@PutMapping("/update") |
|
|
|
@Operation(summary = "更新上线结算记录主") |
|
|
|
@PreAuthorize("@ss.hasPermission('wms:onlinesettlement-record-main:update')") |
|
|
|
public CommonResult<Boolean> updateOnlinesettlementRecordMain(@Valid @RequestBody OnlinesettlementRecordMainUpdateReqVO updateReqVO) { |
|
|
|
onlinesettlementRecordMainService.updateOnlinesettlementRecordMain(updateReqVO); |
|
|
|
return success(true); |
|
|
|
} |
|
|
|
|
|
|
|
@DeleteMapping("/delete") |
|
|
|
@Operation(summary = "删除上线结算记录主") |
|
|
|
@Parameter(name = "id", description = "编号", required = true) |
|
|
|
@PreAuthorize("@ss.hasPermission('wms:onlinesettlement-record-main:delete')") |
|
|
|
public CommonResult<Boolean> deleteOnlinesettlementRecordMain(@RequestParam("id") Long id) { |
|
|
|
onlinesettlementRecordMainService.deleteOnlinesettlementRecordMain(id); |
|
|
|
return success(true); |
|
|
|
} |
|
|
|
|
|
|
|
@GetMapping("/get") |
|
|
|
@Operation(summary = "获得上线结算记录主") |
|
|
|
@Parameter(name = "id", description = "编号", required = true, example = "1024") |
|
|
@ -106,21 +88,51 @@ public class OnlinesettlementRecordMainController { |
|
|
|
return success(result); |
|
|
|
} |
|
|
|
|
|
|
|
private List<OnlinesettlementRecordMainExcelVO> getExcelVo(List<OnlinesettlementRecordMainDO> list, Map<Integer, String[]> mapDropDown) { |
|
|
|
String[] trueFalse = DictFrameworkUtils.dictTypeDictDataValue(DictTypeConstants.TRUE_FALSE); |
|
|
|
mapDropDown.put(15, trueFalse); |
|
|
|
String[] uom = DictFrameworkUtils.dictTypeDictDataValue(DictTypeConstants.UOM); |
|
|
|
mapDropDown.put(28, uom); |
|
|
|
List<OnlinesettlementRecordMainExcelVO> resultList = new ArrayList<>(); |
|
|
|
// 导出
|
|
|
|
for(OnlinesettlementRecordMainDO mainDO : list) { |
|
|
|
List<OnlinesettlementRecordDetailDO> subList = onlinesettlementRecordDetailService.selectList(mainDO.getId()); |
|
|
|
for(OnlinesettlementRecordDetailDO detailDO : subList) { |
|
|
|
OnlinesettlementRecordMainExcelVO vo = OnlinesettlementRecordMainConvert.INSTANCE.convert(mainDO, detailDO); |
|
|
|
AdminUserRespDTO user = userApi.getUser(Long.valueOf(mainDO.getCreator())); |
|
|
|
vo.setCreator(user.getNickname()); |
|
|
|
vo.setUpdater(user.getNickname()); |
|
|
|
resultList.add(vo); |
|
|
|
} |
|
|
|
} |
|
|
|
return resultList; |
|
|
|
} |
|
|
|
|
|
|
|
@GetMapping("/export-excel") |
|
|
|
@Operation(summary = "导出上线结算记录主 Excel") |
|
|
|
@Operation(summary = "导出上线结算记录 Excel") |
|
|
|
@PreAuthorize("@ss.hasPermission('wms:onlinesettlement-record-main:export')") |
|
|
|
@OperateLog(type = EXPORT) |
|
|
|
public void exportOnlinesettlementRecordMainExcel(@Valid OnlinesettlementRecordMainExportReqVO exportReqVO, |
|
|
|
HttpServletResponse response) throws IOException { |
|
|
|
List<OnlinesettlementRecordMainDO> list = onlinesettlementRecordMainService.getOnlinesettlementRecordMainList(exportReqVO); |
|
|
|
//组装vo
|
|
|
|
Map<Integer, String[]> mapDropDown = new HashMap<>(); |
|
|
|
List<OnlinesettlementRecordMainExcelVO> resultList = this.getExcelVo(list, mapDropDown); |
|
|
|
// 导出 Excel
|
|
|
|
List<OnlinesettlementRecordMainExcelVO> datas = OnlinesettlementRecordMainConvert.INSTANCE.convertList02(list); |
|
|
|
for(OnlinesettlementRecordMainExcelVO vo : datas) { |
|
|
|
AdminUserRespDTO user = userApi.getUser(Long.valueOf(vo.getCreator())); |
|
|
|
//后端创建个字段作为前端展示的虚拟字段
|
|
|
|
vo.setCreator(user.getNickname()); |
|
|
|
ExcelUtils.write(response, "上线结算记录.xlsx", "上线结算记录", OnlinesettlementRecordMainExcelVO.class, resultList, mapDropDown); |
|
|
|
} |
|
|
|
ExcelUtils.write(response, "上线结算记录主.xls", "数据", OnlinesettlementRecordMainExcelVO.class, datas); |
|
|
|
|
|
|
|
@PostMapping("/export-excel-senior") |
|
|
|
@Operation(summary = "导出上线结算记录 Excel") |
|
|
|
@PreAuthorize("@ss.hasPermission('wms:onlinesettlement-record-main:export')") |
|
|
|
@OperateLog(type = EXPORT) |
|
|
|
public void exportOnlinesettlementRecordMainSeniorExcel(@Valid @RequestBody CustomConditions conditions, HttpServletResponse response) throws IOException { |
|
|
|
List<OnlinesettlementRecordMainDO> list = onlinesettlementRecordMainService.getOnlinesettlementRecordMainList(conditions); |
|
|
|
//组装vo
|
|
|
|
Map<Integer, String[]> mapDropDown = new HashMap<>(); |
|
|
|
List<OnlinesettlementRecordMainExcelVO> resultList = this.getExcelVo(list, mapDropDown); |
|
|
|
// 导出 Excel
|
|
|
|
ExcelUtils.write(response, "上线结算记录.xlsx", "上线结算记录", OnlinesettlementRecordMainExcelVO.class, resultList, mapDropDown); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|