|
|
@ -10,9 +10,12 @@ import com.win.module.system.api.user.AdminUserApi; |
|
|
|
import com.win.module.system.api.user.dto.AdminUserRespDTO; |
|
|
|
import com.win.module.wms.controller.accountcalendar.vo.AccountcalendarRespVO; |
|
|
|
import com.win.module.wms.controller.currencyexchange.vo.*; |
|
|
|
import com.win.module.wms.controller.itembasic.vo.ItembasicExcelVO; |
|
|
|
import com.win.module.wms.convert.accountcalendar.AccountcalendarConvert; |
|
|
|
import com.win.module.wms.convert.currencyexchange.CurrencyexchangeConvert; |
|
|
|
import com.win.module.wms.convert.itembasic.ItembasicConvert; |
|
|
|
import com.win.module.wms.dal.dataobject.currencyexchange.CurrencyexchangeDO; |
|
|
|
import com.win.module.wms.dal.dataobject.itembasic.ItembasicDO; |
|
|
|
import com.win.module.wms.enums.DictTypeConstants; |
|
|
|
import com.win.module.wms.service.currencyexchange.CurrencyexchangeService; |
|
|
|
import io.swagger.v3.oas.annotations.Operation; |
|
|
@ -80,15 +83,6 @@ public class CurrencyexchangeController { |
|
|
|
return success(CurrencyexchangeConvert.INSTANCE.convert(currencyexchange)); |
|
|
|
} |
|
|
|
|
|
|
|
@GetMapping("/list") |
|
|
|
@Operation(summary = "获得货币转换列表") |
|
|
|
@Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048") |
|
|
|
@PreAuthorize("@ss.hasPermission('wms:currencyexchange:query')") |
|
|
|
public CommonResult<List<CurrencyexchangeRespVO>> getCurrencyexchangeList(@RequestParam("ids") Collection<Long> ids) { |
|
|
|
List<CurrencyexchangeDO> list = currencyexchangeService.getCurrencyexchangeList(ids); |
|
|
|
return success(CurrencyexchangeConvert.INSTANCE.convertList(list)); |
|
|
|
} |
|
|
|
|
|
|
|
@GetMapping("/page") |
|
|
|
@Operation(summary = "获得货币转换分页") |
|
|
|
@PreAuthorize("@ss.hasPermission('wms:currencyexchange:query')") |
|
|
@ -122,19 +116,35 @@ public class CurrencyexchangeController { |
|
|
|
public void exportCurrencyexchangeExcel(@Valid CurrencyexchangeExportReqVO exportReqVO, |
|
|
|
HttpServletResponse response) throws IOException { |
|
|
|
List<CurrencyexchangeDO> list = currencyexchangeService.getCurrencyexchangeList(exportReqVO); |
|
|
|
// 导出 Excel
|
|
|
|
List<CurrencyexchangeExcelVO> datas = CurrencyexchangeConvert.INSTANCE.convertList02(list); |
|
|
|
for(CurrencyexchangeExcelVO vo : datas) { |
|
|
|
AdminUserRespDTO user = userApi.getUser(Long.valueOf(vo.getCreator())); |
|
|
|
//后端创建个字段作为前端展示的虚拟字段
|
|
|
|
vo.setCreator(user.getNickname()); |
|
|
|
} Map<Integer, String[]> mapDropDown = new HashMap<>(); |
|
|
|
Map<Integer, String[]> mapDropDown = new HashMap<>(); |
|
|
|
List<CurrencyexchangeExcelVO> resultList = this.getExcelVo(list, mapDropDown); |
|
|
|
ExcelUtils.write(response, "货币转换.xlsx", "数据", CurrencyexchangeExcelVO.class, resultList, mapDropDown); |
|
|
|
} |
|
|
|
@PostMapping("/export-excel-senior") |
|
|
|
@Operation(summary = "导出货币转换 Excel") |
|
|
|
@PreAuthorize("@ss.hasPermission('wms:currencyexchange:export')") |
|
|
|
@OperateLog(type = EXPORT) |
|
|
|
public void exportCurrencyexchangeExcel(@Valid @RequestBody CustomConditions conditions, HttpServletResponse response) throws IOException { |
|
|
|
List<CurrencyexchangeDO> list = currencyexchangeService.getCurrencyexchangeList(conditions); |
|
|
|
Map<Integer, String[]> mapDropDown = new HashMap<>(); |
|
|
|
List<CurrencyexchangeExcelVO> resultList = this.getExcelVo(list, mapDropDown); |
|
|
|
ExcelUtils.write(response, "货币转换.xlsx", "数据", CurrencyexchangeExcelVO.class, resultList, mapDropDown); |
|
|
|
} |
|
|
|
private List<CurrencyexchangeExcelVO> getExcelVo(List<CurrencyexchangeDO> list, Map<Integer, String[]> mapDropDown) { |
|
|
|
String[] currency = DictFrameworkUtils.dictTypeDictDataValue(DictTypeConstants.CURRENCY); |
|
|
|
mapDropDown.put(0, currency); |
|
|
|
String[] isRequired = DictFrameworkUtils.dictTypeDictDataValue(DictTypeConstants.TRUE_FALSE); |
|
|
|
mapDropDown.put(3, isRequired); |
|
|
|
ExcelUtils.write(response, "货币转换.xls", "数据", CurrencyexchangeExcelVO.class, datas,mapDropDown); |
|
|
|
// 导出 Excel
|
|
|
|
List<CurrencyexchangeExcelVO> resultList = CurrencyexchangeConvert.INSTANCE.convertList02(list); |
|
|
|
for(CurrencyexchangeExcelVO vo : resultList) { |
|
|
|
AdminUserRespDTO user = userApi.getUser(Long.valueOf(vo.getCreator())); |
|
|
|
//后端创建个字段作为前端展示的虚拟字段
|
|
|
|
vo.setCreator(user.getNickname()); |
|
|
|
} |
|
|
|
return resultList; |
|
|
|
} |
|
|
|
|
|
|
|
@GetMapping("/get-import-template") |
|
|
|
@Operation(summary = "获得导入货币转换模板") |
|
|
|
public void importTemplate(HttpServletResponse response) throws IOException { |
|
|
|