新购任务详情接口
This commit is contained in:
parent
cea40b603a
commit
2534ebd683
|
|
@ -4,8 +4,10 @@ import com.bonus.common.core.web.controller.BaseController;
|
||||||
import com.bonus.common.core.web.page.TableDataInfo;
|
import com.bonus.common.core.web.page.TableDataInfo;
|
||||||
import com.bonus.common.security.annotation.RequiresPermissions;
|
import com.bonus.common.security.annotation.RequiresPermissions;
|
||||||
import com.bonus.purchase.domain.BpmPurchaseInfo;
|
import com.bonus.purchase.domain.BpmPurchaseInfo;
|
||||||
|
import com.bonus.purchase.dto.PurchaseDto;
|
||||||
import com.bonus.purchase.dto.PurchaseTaskDto;
|
import com.bonus.purchase.dto.PurchaseTaskDto;
|
||||||
import com.bonus.purchase.service.impl.BpmPurchaseInfoService;
|
import com.bonus.purchase.service.impl.BpmPurchaseInfoService;
|
||||||
|
import com.bonus.purchase.vo.PurchaseVo;
|
||||||
import org.apache.poi.ss.formula.functions.T;
|
import org.apache.poi.ss.formula.functions.T;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
@ -33,11 +35,22 @@ public class BpmPurchaseInfoController extends BaseController {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页查询数据
|
* 分页查询--新购任务列表
|
||||||
*/
|
*/
|
||||||
@GetMapping(value = "/list")
|
@GetMapping(value = "/list")
|
||||||
@RequiresPermissions("purchase:bpmPurchaseInfo:query")
|
@RequiresPermissions("purchase:bpmPurchaseInfo:query")
|
||||||
public TableDataInfo getList(BpmPurchaseInfo bpmPurchaseInfo) {
|
public TableDataInfo getList(PurchaseDto purchaseDto) {
|
||||||
|
startPage();
|
||||||
|
List<PurchaseVo> list = this.bpmPurchaseInfoService.selectMangerList(purchaseDto);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询---新购任务详情列表
|
||||||
|
*/
|
||||||
|
@GetMapping(value = "/detailsList")
|
||||||
|
@RequiresPermissions("purchase:bpmPurchaseInfo:query")
|
||||||
|
public TableDataInfo getDetailsList(BpmPurchaseInfo bpmPurchaseInfo) {
|
||||||
startPage();
|
startPage();
|
||||||
List<BpmPurchaseInfo> list = this.bpmPurchaseInfoService.selectAll(bpmPurchaseInfo);
|
List<BpmPurchaseInfo> list = this.bpmPurchaseInfoService.selectAll(bpmPurchaseInfo);
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
package com.bonus.purchase.mapper;
|
package com.bonus.purchase.mapper;
|
||||||
import com.bonus.base.api.domain.MaType;
|
import com.bonus.base.api.domain.MaType;
|
||||||
|
import com.bonus.purchase.dto.PurchaseDto;
|
||||||
|
import com.bonus.purchase.vo.PurchaseVo;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
@ -18,6 +20,13 @@ public interface BpmPurchaseInfoMapper {
|
||||||
|
|
||||||
List<BpmPurchaseInfo> selectAll(BpmPurchaseInfo bpmPurchaseInfo);
|
List<BpmPurchaseInfo> selectAll(BpmPurchaseInfo bpmPurchaseInfo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询新购管理外层列表
|
||||||
|
* @param purchaseDto 请求体
|
||||||
|
* @return 集合列表
|
||||||
|
*/
|
||||||
|
List<PurchaseVo> selectMangerList(PurchaseDto purchaseDto);
|
||||||
|
|
||||||
int insertList(@Param("list")List<BpmPurchaseInfo> list);
|
int insertList(@Param("list")List<BpmPurchaseInfo> list);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -5,9 +5,13 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import cn.hutool.core.util.RandomUtil;
|
||||||
import com.bonus.base.api.domain.MaType;
|
import com.bonus.base.api.domain.MaType;
|
||||||
|
import com.bonus.common.core.utils.DateTimeHelper;
|
||||||
import com.bonus.common.core.utils.StringHelper;
|
import com.bonus.common.core.utils.StringHelper;
|
||||||
import com.bonus.common.security.utils.SecurityUtils;
|
import com.bonus.common.security.utils.SecurityUtils;
|
||||||
|
import com.bonus.purchase.dto.PurchaseDto;
|
||||||
|
import com.bonus.purchase.vo.PurchaseVo;
|
||||||
import com.bonus.task.domain.BpmTask;
|
import com.bonus.task.domain.BpmTask;
|
||||||
import com.bonus.purchase.dto.PurchaseTaskDto;
|
import com.bonus.purchase.dto.PurchaseTaskDto;
|
||||||
import com.bonus.purchase.mapper.BpmPurchaseInfoMapper;
|
import com.bonus.purchase.mapper.BpmPurchaseInfoMapper;
|
||||||
|
|
@ -77,13 +81,26 @@ public class BpmPurchaseInfoService{
|
||||||
return bpmPurchaseInfoMapper.selectAll(bpmPurchaseInfo);
|
return bpmPurchaseInfoMapper.selectAll(bpmPurchaseInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public int insertList(PurchaseTaskDto purchaseTaskDto) {
|
public int insertList(PurchaseTaskDto purchaseTaskDto) {
|
||||||
// 映射Dto至Pojo对象
|
// 映射Dto至Pojo对象
|
||||||
BpmTask task = new BpmTask();
|
BpmTask task = new BpmTask();
|
||||||
List<BpmPurchaseInfo> list = purchaseTaskDto.getBpmPurchaseDetailsList();
|
List<BpmPurchaseInfo> list = purchaseTaskDto.getBpmPurchaseDetailsList();
|
||||||
BeanUtil.copyProperties(purchaseTaskDto, task);
|
BeanUtil.copyProperties(purchaseTaskDto, task);
|
||||||
|
|
||||||
|
// 处理任务表数据 -------------- start ------
|
||||||
|
task.setDefinitionId(1);
|
||||||
|
// 查询任务已存在条数确认编码
|
||||||
|
int taskNumber = bpmTaskMapper.countById();
|
||||||
|
String formatTaskNumber = String.format("%06d", taskNumber + 1);
|
||||||
|
// 生成任务CODE
|
||||||
|
String code = "XG" + DateTimeHelper.getNowMonthFomart() + "-" + formatTaskNumber;
|
||||||
|
task.setCode(code);
|
||||||
|
// 赋值任务状态
|
||||||
|
task.setStatus(47);
|
||||||
|
String creator = String.valueOf(SecurityUtils.getLoginUser().getUserid());
|
||||||
|
task.setCreator(creator);
|
||||||
|
// 处理任务表数据 ---------------- end ------
|
||||||
|
|
||||||
// 新购设备前,先进行任务表创建
|
// 新购设备前,先进行任务表创建
|
||||||
int inserted = bpmTaskMapper.insertSelective(task);
|
int inserted = bpmTaskMapper.insertSelective(task);
|
||||||
if (inserted <= 0) {
|
if (inserted <= 0) {
|
||||||
|
|
@ -94,8 +111,8 @@ public class BpmPurchaseInfoService{
|
||||||
// 给集合中所有对象赋值任务ID
|
// 给集合中所有对象赋值任务ID
|
||||||
list.replaceAll(obj -> {
|
list.replaceAll(obj -> {
|
||||||
obj.setTaskId(task.getId());
|
obj.setTaskId(task.getId());
|
||||||
obj.setStatus((byte)1);
|
obj.setStatus((byte)47);
|
||||||
obj.setUpdater(String.valueOf(SecurityUtils.getLoginUser().getUserid()));
|
obj.setUpdater(creator);
|
||||||
return obj;
|
return obj;
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -107,6 +124,10 @@ public class BpmPurchaseInfoService{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public List<PurchaseVo> selectMangerList(PurchaseDto purchaseDto) {
|
||||||
|
return bpmPurchaseInfoMapper.selectMangerList(purchaseDto);
|
||||||
|
}
|
||||||
|
|
||||||
public MaType selectMaTypeById(Integer id) {
|
public MaType selectMaTypeById(Integer id) {
|
||||||
return bpmPurchaseInfoMapper.selectMaTypeById(id);
|
return bpmPurchaseInfoMapper.selectMaTypeById(id);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -57,4 +57,8 @@ public interface BpmTaskMapper {
|
||||||
* @return update count
|
* @return update count
|
||||||
*/
|
*/
|
||||||
int updateByPrimaryKey(BpmTask record);
|
int updateByPrimaryKey(BpmTask record);
|
||||||
|
|
||||||
|
Integer countById();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -59,4 +59,11 @@ public class BpmTaskService{
|
||||||
return bpmTaskMapper.updateByPrimaryKey(record);
|
return bpmTaskMapper.updateByPrimaryKey(record);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Integer countById(Integer id){
|
||||||
|
return bpmTaskMapper.countById();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,54 @@
|
||||||
|
package com.bonus.task.vo;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author : 阮世耀
|
||||||
|
* @version : 1.0
|
||||||
|
* @PackagePath: com.bonus.task.vo
|
||||||
|
* @CreateTime: 2024-08-21 14:21
|
||||||
|
* @Description: 新购到货管理一级列表返回Vo对象
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class PurchaseManageListVo {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "id")
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "任务id")
|
||||||
|
private String taskId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "到货时间")
|
||||||
|
private String arrivalTime;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "采购单号")
|
||||||
|
private String purchaseCode;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "采购物资拼接字符串")
|
||||||
|
private String purchaseGroup;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "采购数量")
|
||||||
|
private Integer purchaseNum;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "采购价格")
|
||||||
|
private Double purchasePrice;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "采购不含税价格")
|
||||||
|
private Double purchaseNotaxPrice;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "采购税率")
|
||||||
|
private Double purchaseTaxRate;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "采购状态")
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "操作人")
|
||||||
|
private String creator;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "操作时间")
|
||||||
|
private String createTime;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "备注")
|
||||||
|
private String remark;
|
||||||
|
}
|
||||||
|
|
@ -568,6 +568,46 @@
|
||||||
where is_active = 1
|
where is_active = 1
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectMangerList" resultType="com.bonus.purchase.vo.PurchaseVo">
|
||||||
|
SELECT
|
||||||
|
bt.id AS id,
|
||||||
|
bt.arrival_time AS arrivalTime,
|
||||||
|
bt.`code` AS purchaseCode,
|
||||||
|
GROUP_CONCAT( mt.`name` ) AS purchaseMaterial,
|
||||||
|
SUM( bp.purchase_num ) AS purchaseNum,
|
||||||
|
SUM( bp.purchase_price ) AS purchasePrice,
|
||||||
|
SUM( bp.notax_price ) AS notaxPrice,
|
||||||
|
'10' AS taxRate,
|
||||||
|
bt.creator AS createBy,
|
||||||
|
bt.create_time AS createTime,
|
||||||
|
bt.`status` AS STATUS,
|
||||||
|
sda.dict_label AS statusName,
|
||||||
|
bt.remark AS remark
|
||||||
|
FROM
|
||||||
|
bpm_purchase_info bp
|
||||||
|
LEFT JOIN bpm_task bt ON bp.task_id = bt.id
|
||||||
|
LEFT JOIN ma_type mt ON bp.type_id = mt.id
|
||||||
|
LEFT JOIN sys_dict_data sda ON sda.dict_code = bt.`status`
|
||||||
|
WHERE
|
||||||
|
bp.is_active = '1'
|
||||||
|
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
|
||||||
|
AND bt.arrival_time BETWEEN #{startTime} AND #{endTime}
|
||||||
|
</if>
|
||||||
|
<if test="keyWord != null and keyWord != ''">
|
||||||
|
AND (
|
||||||
|
bt.`code` LIKE CONCAT('%',#{keyWord},'%')
|
||||||
|
OR bp.tax_rate = #{keyWord}
|
||||||
|
OR bt.creator LIKE CONCAT('%',#{keyWord},'%')
|
||||||
|
OR bt.remark LIKE CONCAT('%',#{keyWord},'%')
|
||||||
|
)
|
||||||
|
</if>
|
||||||
|
<if test="status != null and status != ''">
|
||||||
|
AND bt.`status` = #{status}
|
||||||
|
</if>
|
||||||
|
GROUP BY
|
||||||
|
bp.task_id
|
||||||
|
</select>
|
||||||
|
|
||||||
<!--by syruan on 2024-08-20-->
|
<!--by syruan on 2024-08-20-->
|
||||||
<insert id="insertList" useGeneratedKeys="true" keyProperty="id">
|
<insert id="insertList" useGeneratedKeys="true" keyProperty="id">
|
||||||
INSERT INTO bpm_purchase_info(
|
INSERT INTO bpm_purchase_info(
|
||||||
|
|
|
||||||
|
|
@ -78,9 +78,7 @@
|
||||||
<if test="creator != null and creator != ''">
|
<if test="creator != null and creator != ''">
|
||||||
creator,
|
creator,
|
||||||
</if>
|
</if>
|
||||||
<if test="createTime != null">
|
|
||||||
create_time,
|
create_time,
|
||||||
</if>
|
|
||||||
<if test="auditor != null">
|
<if test="auditor != null">
|
||||||
auditor,
|
auditor,
|
||||||
</if>
|
</if>
|
||||||
|
|
@ -125,9 +123,7 @@
|
||||||
<if test="creator != null and creator != ''">
|
<if test="creator != null and creator != ''">
|
||||||
#{creator,jdbcType=VARCHAR},
|
#{creator,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
<if test="createTime != null">
|
now(),
|
||||||
#{createTime,jdbcType=TIMESTAMP},
|
|
||||||
</if>
|
|
||||||
<if test="auditor != null">
|
<if test="auditor != null">
|
||||||
#{auditor,jdbcType=INTEGER},
|
#{auditor,jdbcType=INTEGER},
|
||||||
</if>
|
</if>
|
||||||
|
|
@ -395,4 +391,9 @@
|
||||||
</if>
|
</if>
|
||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
|
<!--by syruan on 2024-08-21-->
|
||||||
|
<select id="countById" resultType="java.lang.Integer">
|
||||||
|
select count(id) from bpm_task
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
Loading…
Reference in New Issue