feat:导入区划转中文

pg_adapter
wangxy 9 months ago
parent 8d5930d64f
commit 117e464cff

@ -8,14 +8,18 @@ import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.domain.TdTrain; import com.ruoyi.system.domain.TdTrain;
import com.ruoyi.system.service.ISysUserService;
import com.ruoyi.system.service.ITdTrainService; import com.ruoyi.system.service.ITdTrainService;
import com.ruoyi.web.controller.manager.SysAreaManager;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap; import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List; import java.util.List;
import java.util.Objects;
@Controller @Controller
@RequestMapping("/system/trainnum") @RequestMapping("/system/trainnum")
@ -24,6 +28,13 @@ public class SysTrainnumController extends BaseController {
@Autowired @Autowired
private ITdTrainService tdTrainService; private ITdTrainService tdTrainService;
@Resource
private SysAreaManager sysAreaManager;
@Resource
private ISysUserService sysUserService;
@RequiresPermissions("system:trainnum:view") @RequiresPermissions("system:trainnum:view")
@GetMapping() @GetMapping()
public String trainnum() public String trainnum()
@ -58,6 +69,14 @@ public class SysTrainnumController extends BaseController {
public AjaxResult export(TdTrain tdTrain) public AjaxResult export(TdTrain tdTrain)
{ {
List<TdTrain> list = tdTrainService.selectTdTrainList(tdTrain); List<TdTrain> list = tdTrainService.selectTdTrainList(tdTrain);
list.forEach(tdTrain1 -> {
tdTrain1.setAREAID(sysAreaManager.getAreaName(tdTrain1.getAREAID()));
tdTrain1.setFRAMEWORK(sysAreaManager.getAreaName(tdTrain1.getFRAMEWORK()));
SysUser sysUser = sysUserService.selectUserById(Long.valueOf(tdTrain1.getUSERNAME()));
if(Objects.nonNull(sysUser)){
tdTrain1.setUSERNAME(sysUser.getUserName());
}
});
ExcelUtil<TdTrain> util = new ExcelUtil<TdTrain>(TdTrain.class); ExcelUtil<TdTrain> util = new ExcelUtil<TdTrain>(TdTrain.class);
return util.exportExcel(list, "培训统计数据"); return util.exportExcel(list, "培训统计数据");
} }

Loading…
Cancel
Save