领料管理--去除冗余代码、增加导出字段

This commit is contained in:
syruan 2024-11-13 15:54:52 +08:00
parent 2fbd4e7466
commit 4c9970886f
4 changed files with 21 additions and 17 deletions

View File

@ -12,9 +12,9 @@ import com.bonus.material.lease.service.ILeaseApplyInfoService;
import com.bonus.material.task.domain.vo.TmTaskRequestVo; import com.bonus.material.task.domain.vo.TmTaskRequestVo;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import java.util.List; import java.util.List;
@ -29,7 +29,8 @@ import java.util.List;
@RestController @RestController
@RequestMapping("/lease_apply_info") @RequestMapping("/lease_apply_info")
public class LeaseApplyInfoController extends BaseController { public class LeaseApplyInfoController extends BaseController {
@Autowired
@Resource
private ILeaseApplyInfoService leaseApplyInfoService; private ILeaseApplyInfoService leaseApplyInfoService;
/** /**
@ -54,7 +55,7 @@ public class LeaseApplyInfoController extends BaseController {
@PostMapping("/export") @PostMapping("/export")
public void export(HttpServletResponse response, LeaseApplyInfo leaseApplyInfo) { public void export(HttpServletResponse response, LeaseApplyInfo leaseApplyInfo) {
List<LeaseApplyInfo> list = leaseApplyInfoService.selectLeaseApplyInfoList(leaseApplyInfo); List<LeaseApplyInfo> list = leaseApplyInfoService.selectLeaseApplyInfoList(leaseApplyInfo);
ExcelUtil<LeaseApplyInfo> util = new ExcelUtil<LeaseApplyInfo>(LeaseApplyInfo.class); ExcelUtil<LeaseApplyInfo> util = new ExcelUtil<>(LeaseApplyInfo.class);
util.exportExcel(response, list, "领料任务数据"); util.exportExcel(response, list, "领料任务数据");
} }
@ -64,7 +65,7 @@ public class LeaseApplyInfoController extends BaseController {
@ApiOperation(value = "获取领料任务详细信息") @ApiOperation(value = "获取领料任务详细信息")
//@RequiresPermissions("lease:info:query") //@RequiresPermissions("lease:info:query")
@GetMapping(value = "/{id}") @GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") @NotNull(message = "领料任务ID不能为空") Long id) { public AjaxResult getInfo(@NotNull(message = "领料任务ID不能为空") @PathVariable("id") Long id) {
return success(leaseApplyInfoService.selectLeaseApplyInfoById(id)); return success(leaseApplyInfoService.selectLeaseApplyInfoById(id));
} }
@ -76,7 +77,7 @@ public class LeaseApplyInfoController extends BaseController {
//@RequiresPermissions("lease:info:add") //@RequiresPermissions("lease:info:add")
@SysLog(title = "领料任务", businessType = OperaType.INSERT, logType = 1,module = "仓储管理->新增领料任务") @SysLog(title = "领料任务", businessType = OperaType.INSERT, logType = 1,module = "仓储管理->新增领料任务")
@PostMapping @PostMapping
public AjaxResult add(@RequestBody @NotNull(message = "领料任务不能为空") TmTaskRequestVo tmTaskRequestVo) { public AjaxResult add(@NotNull(message = "领料任务不能为空") @RequestBody TmTaskRequestVo tmTaskRequestVo) {
try { try {
return leaseApplyInfoService.insertLeaseApplyInfo(tmTaskRequestVo); return leaseApplyInfoService.insertLeaseApplyInfo(tmTaskRequestVo);
} catch (Exception e) { } catch (Exception e) {

View File

@ -117,7 +117,7 @@ public class LeaseApplyInfo extends BaseEntity {
private Long directId; private Long directId;
/** 0工程1长期 */ /** 0工程1长期 */
@Excel(name = "0工程1长期") @Excel(name = "领用类型",readConverterExp = "0=工程,1=长期")
@ApiModelProperty(value = "0工程1长期") @ApiModelProperty(value = "0工程1长期")
private String leaseType; private String leaseType;
@ -137,12 +137,14 @@ public class LeaseApplyInfo extends BaseEntity {
List<LeaseApplyDetails> leaseApplyDetails; List<LeaseApplyDetails> leaseApplyDetails;
@ApiModelProperty(value = "租赁工程") @ApiModelProperty(value = "租赁工程")
@Excel(name = "领料工程")
private String leaseProject; private String leaseProject;
@ApiModelProperty(value = "租赁工程id") @ApiModelProperty(value = "租赁工程id")
private Integer leaseProjectId; private Integer leaseProjectId;
@ApiModelProperty(value = "租赁单位") @ApiModelProperty(value = "租赁单位")
@Excel(name = "领料单位")
private String leaseUnit; private String leaseUnit;
@ApiModelProperty(value = "租赁单位id") @ApiModelProperty(value = "租赁单位id")
@ -152,6 +154,7 @@ public class LeaseApplyInfo extends BaseEntity {
private Long agreementId; private Long agreementId;
@ApiModelProperty(value = "协议号") @ApiModelProperty(value = "协议号")
@Excel(name = "协议号")
private String agreementCode; private String agreementCode;
} }

View File

@ -19,7 +19,6 @@ import com.bonus.material.task.domain.TmTaskAgreement;
import com.bonus.material.task.domain.vo.TmTaskRequestVo; import com.bonus.material.task.domain.vo.TmTaskRequestVo;
import com.bonus.material.task.mapper.TmTaskAgreementMapper; import com.bonus.material.task.mapper.TmTaskAgreementMapper;
import com.bonus.material.task.mapper.TmTaskMapper; import com.bonus.material.task.mapper.TmTaskMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataAccessException; import org.springframework.dao.DataAccessException;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.bonus.material.lease.mapper.LeaseApplyInfoMapper; import com.bonus.material.lease.mapper.LeaseApplyInfoMapper;
@ -37,10 +36,11 @@ import javax.annotation.Resource;
*/ */
@Service @Service
public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService { public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
@Autowired
@Resource
private LeaseApplyInfoMapper leaseApplyInfoMapper; private LeaseApplyInfoMapper leaseApplyInfoMapper;
@Autowired @Resource
private LeaseApplyDetailsMapper leaseApplyDetailsMapper; private LeaseApplyDetailsMapper leaseApplyDetailsMapper;
@Resource @Resource
@ -49,7 +49,6 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
@Resource @Resource
TmTaskAgreementMapper tmTaskAgreementMapper; TmTaskAgreementMapper tmTaskAgreementMapper;
/** /**
* 查询领料任务 * 查询领料任务
* *
@ -175,7 +174,7 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
try { try {
// 提取到局部变量中减少重复代码 // 提取到局部变量中减少重复代码
LeaseApplyInfo leaseApplyInfo = tmTaskRequestVo.getLeaseApplyInfo(); LeaseApplyInfo leaseApplyInfo = tmTaskRequestVo.getLeaseApplyInfo();
if (leaseApplyInfo != null) { if (leaseApplyInfo != null && leaseApplyInfo.getId() != null) {
leaseApplyInfo.setUpdateTime(DateUtils.getNowDate()); leaseApplyInfo.setUpdateTime(DateUtils.getNowDate());
leaseApplyInfo.setUpdateBy(SecurityUtils.getUsername()); leaseApplyInfo.setUpdateBy(SecurityUtils.getUsername());

View File

@ -10,13 +10,14 @@ import com.bonus.material.task.domain.TmTaskAgreement;
* @date 2024-10-16 * @date 2024-10-16
*/ */
public interface TmTaskAgreementMapper { public interface TmTaskAgreementMapper {
/** /**
* 查询任务 * 查询任务
* *
* @param taskId 任务主键 * @param taskId 任务主键
* @return 任务 * @return 任务
*/ */
public TmTaskAgreement selectTmTaskAgreementByTaskId(Long taskId); TmTaskAgreement selectTmTaskAgreementByTaskId(Long taskId);
/** /**
* 查询任务列表 * 查询任务列表
@ -24,7 +25,7 @@ public interface TmTaskAgreementMapper {
* @param tmTaskAgreement 任务 * @param tmTaskAgreement 任务
* @return 任务集合 * @return 任务集合
*/ */
public List<TmTaskAgreement> selectTmTaskAgreementList(TmTaskAgreement tmTaskAgreement); List<TmTaskAgreement> selectTmTaskAgreementList(TmTaskAgreement tmTaskAgreement);
/** /**
* 新增任务 * 新增任务
@ -32,7 +33,7 @@ public interface TmTaskAgreementMapper {
* @param tmTaskAgreement 任务 * @param tmTaskAgreement 任务
* @return 结果 * @return 结果
*/ */
public int insertTmTaskAgreement(TmTaskAgreement tmTaskAgreement); int insertTmTaskAgreement(TmTaskAgreement tmTaskAgreement);
/** /**
* 修改任务 * 修改任务
@ -40,7 +41,7 @@ public interface TmTaskAgreementMapper {
* @param tmTaskAgreement 任务 * @param tmTaskAgreement 任务
* @return 结果 * @return 结果
*/ */
public int updateTmTaskAgreement(TmTaskAgreement tmTaskAgreement); int updateTmTaskAgreement(TmTaskAgreement tmTaskAgreement);
/** /**
* 删除任务 * 删除任务
@ -48,7 +49,7 @@ public interface TmTaskAgreementMapper {
* @param taskId 任务主键 * @param taskId 任务主键
* @return 结果 * @return 结果
*/ */
public int deleteTmTaskAgreementByTaskId(Long taskId); int deleteTmTaskAgreementByTaskId(Long taskId);
/** /**
* 批量删除任务 * 批量删除任务
@ -56,5 +57,5 @@ public interface TmTaskAgreementMapper {
* @param taskIds 需要删除的数据主键集合 * @param taskIds 需要删除的数据主键集合
* @return 结果 * @return 结果
*/ */
public int deleteTmTaskAgreementByTaskIds(Long[] taskIds); int deleteTmTaskAgreementByTaskIds(Long[] taskIds);
} }