员工提成

This commit is contained in:
许允枞 2024-11-08 13:28:58 +08:00
parent b6c5d5515b
commit c55205c535
6 changed files with 185 additions and 9 deletions

View File

@ -107,7 +107,7 @@ public class InspectionInfoController extends BaseController {
@RequestParam(value = "pageNum", required = false, defaultValue = "1") Integer pageNum,
@RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize) {
Page<InspectionInfo> page = new Page<>(pageNum, pageSize);
return success(inspectionInfoService.geStelectInspection(page,inspectionInfo));
return success(inspectionInfoService.geStelectInspection(page, inspectionInfo));
}
/**
@ -130,39 +130,83 @@ public class InspectionInfoController extends BaseController {
* @return
*/
@PostMapping("orderTaking")
public CommonResult orderTaking(Integer inspectionId,String workNodeId) {
public CommonResult orderTaking(Integer inspectionId, String workNodeId) {
inspectionWorkNodeService.updateInspectionWorkNode(inspectionId, workNodeId);
return success("接单成功");
}
/**
* 项目操作退办理重审项目完成
*
* @param inspectionWorkNode
*/
@PostMapping("controls")
public CommonResult controls(@RequestBody InspectionWorkNode inspectionWorkNode){
public CommonResult controls(@RequestBody InspectionWorkNode inspectionWorkNode) {
inspectionWorkNodeService.updateImageAndStep(inspectionWorkNode);
return success("操作成功");
}
/**
* 通过工单id获取工单流程
*
* @param inspectionId
* @return
*/
@GetMapping("getWeorkNodesById")
public CommonResult getWeorkNodesById(Integer inspectionId) {
return success(inspectionInfoService.getWeorkNodesById(inspectionId));
}
}
/**
* 判断是否需要上传图片
*
* @param inspectionId
* @param workNodeId
* @return
*/
@GetMapping("orImages")
public CommonResult orImages(Integer inspectionId, String workNodeId){
return success(inspectionWorkNodeService.orImages(inspectionId,workNodeId));
}
public CommonResult orImages(Integer inspectionId, String workNodeId) {
return success(inspectionWorkNodeService.orImages(inspectionId, workNodeId));
}
/**
* 分页查询节点提成
* @param inspectionWorkNode
* @param pageNum
* @param pageSize
* @return
*/
@GetMapping("getRoyaltyList")
public CommonResult getRoyaltyList(InspectionWorkNode inspectionWorkNode,
@RequestParam(value = "pageNo", required = false, defaultValue = "1") Integer pageNum,
@RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize) {
IPage page = new Page(pageNum, pageSize);
return success(inspectionWorkNodeService.getRoyaltyList(page, inspectionWorkNode));
}
/**
* 获取提成总金额
* @param inspectionWorkNode
* @return
*/
@GetMapping("getRoyaltySum")
public CommonResult getRoyaltySum(InspectionWorkNode inspectionWorkNode) {
return success(inspectionWorkNodeService.getRoyaltySum(inspectionWorkNode));
}
/**
* app分页查询节点提成
* @param pageNum
* @param pageSize
* @return
*/
@GetMapping("getRoyaltyList")
public CommonResult getRoyaltyListApp(@RequestParam(value = "pageNo", required = false, defaultValue = "1") Integer pageNum,
@RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize) {
InspectionWorkNode inspectionWorkNode = new InspectionWorkNode();
inspectionWorkNode.setDealUserId(getUserId());
IPage page = new Page(pageNum, pageSize);
return success(inspectionWorkNodeService.getRoyaltyList(page, inspectionWorkNode));
}
}

View File

@ -92,6 +92,10 @@ public class InspectionWorkNode extends TenantBaseDO {
@TableField(exist = false)
private String projectName;
@TableField(exist = false)
private String rescueStartMonth;
@TableField(exist = false)
private String rescueStart;
@TableField(exist = false)
private String rescueEnd;
}

View File

@ -2,9 +2,12 @@ package cn.iocoder.yudao.module.inspection.mapper;
import cn.iocoder.yudao.module.inspection.entity.InspectionWorkNode;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
* <p>
@ -23,4 +26,7 @@ public interface InspectionWorkNodeMapper extends BaseMapper<InspectionWorkNode>
* @return
*/
List<InspectionWorkNode> getWeorkNodesById(Integer inspectionId);
IPage<Map> getRoyaltyList(@Param("page")IPage page,@Param("inspectionWorkNode") InspectionWorkNode inspectionWorkNode);
Map getRoyaltySum(@Param("inspectionWorkNode") InspectionWorkNode inspectionWorkNode);
}

View File

@ -1,9 +1,11 @@
package cn.iocoder.yudao.module.inspection.service;
import cn.iocoder.yudao.module.inspection.entity.InspectionWorkNode;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
import java.util.Map;
/**
* <p>
@ -35,4 +37,14 @@ public interface IInspectionWorkNodeService extends IService<InspectionWorkNode>
List<InspectionWorkNode> getWeorkNodesById(Integer inspectionId);
boolean orImages(Integer inspectionId, String workNodeId);
/**
* 分页查询提成
* @param page
* @param inspectionWorkNode
* @return
*/
IPage<Map> getRoyaltyList(IPage page, InspectionWorkNode inspectionWorkNode);
Map getRoyaltySum(InspectionWorkNode inspectionWorkNode);
}

View File

@ -17,12 +17,14 @@ import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
import cn.iocoder.yudao.module.system.service.user.AdminUserService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Map;
/**
* <p>
@ -217,6 +219,23 @@ public class InspectionWorkNodeServiceImpl extends ServiceImpl<InspectionWorkNod
return false;
}
/**
* 分页查询提成
*
* @param page
* @param inspectionWorkNode
* @return
*/
@Override
public IPage<Map> getRoyaltyList(IPage page, InspectionWorkNode inspectionWorkNode) {
return baseMapper.getRoyaltyList(page, inspectionWorkNode);
}
@Override
public Map getRoyaltySum(InspectionWorkNode inspectionWorkNode) {
return baseMapper.getRoyaltySum(inspectionWorkNode);
}
/**
* 判断传入的 InspectionWorkNode 对象是否在集合中有后续项目
*

View File

@ -10,4 +10,95 @@
WHERE wn.inspection_info_id = #{inspectionId}
ORDER BY wn.order_num ASC
</select>
<select id="getRoyaltyList" resultType="java.util.Map">
SELECT
node.id AS node_id,
node.project_id,
proj.project_name AS projectName, -- Assuming there's a project name in the inspection project table
node.deal_user_name AS handlerName,
IFNULL(royalty.royalty_amount, 0) / 100 AS royaltyAmount,
node.create_time AS node_create_time,
royalty.update_time AS royalty_create_time
FROM
inspection_work_node AS node
LEFT JOIN
inspection_project_royalty AS royalty
ON node.project_id = royalty.project_id
LEFT JOIN
system_users AS users
ON node.deal_user_id = users.id
LEFT JOIN
inspection_project AS proj -- Assuming this is the table for project details
ON node.project_id = proj.id
LEFT JOIN
inspection_info AS info
ON node.inspection_info_id = info.id
<where>
node.status = '2' AND info.status = '1'
<if test="inspectionWorkNode.createTime != null">
AND node.create_time = #{inspectionWorkNode.createTime}
</if>
<if test="inspectionWorkNode.projectId != null">
AND node.project_id = #{inspectionWorkNode.projectId}
</if>
<if test="inspectionWorkNode.dealUserId != null">
AND node.deal_user_id = #{inspectionWorkNode.dealUserId}
</if>
<if test="inspectionWorkNode.dealUserName != null">
AND node.deal_user_name LIKE CONCAT('%', #{inspectionWorkNode.dealUserName} , '%')
</if>
<if test="inspectionWorkNode.rescueStartMonth != null">
AND DATE_FORMAT(info.end_time, '%Y-%m') = #{inspectionWorkNode.rescueStartMonth}
</if>
<if test="inspectionWorkNode.rescueStartMonth != null">
AND DATE_FORMAT(info.end_time, '%Y-%m') = #{inspectionWorkNode.rescueStartMonth}
</if>
<if test="inspectionWorkNode.rescueStart != null and inspectionWorkNode.rescueEnd != null">
AND info.end_time BETWEEN #{inspectionWorkNode.rescueStart} AND #{inspectionWorkNode.rescueEnd}
</if>
</where>
ORDER BY
node.create_time DESC;
</select>
<select id="getRoyaltySum" resultType="java.util.Map">
SELECT
IFNULL(SUM(IFNULL(royalty.royalty_amount, 0) / 100 ),0)AS royaltyAmountSum
FROM
inspection_work_node AS node
LEFT JOIN
inspection_project_royalty AS royalty
ON node.project_id = royalty.project_id
LEFT JOIN
system_users AS users
ON node.deal_user_id = users.id
LEFT JOIN
inspection_project AS proj -- Assuming this is the table for project details
ON node.project_id = proj.id
LEFT JOIN
inspection_info AS info
ON node.inspection_info_id = info.id
<where>
node.status = '2' AND info.status = '1'
<if test="inspectionWorkNode.createTime != null">
AND node.create_time = #{inspectionWorkNode.createTime}
</if>
<if test="inspectionWorkNode.projectId != null">
AND node.project_id = #{inspectionWorkNode.projectId}
</if>
<if test="inspectionWorkNode.dealUserId != null">
AND node.deal_user_id = #{inspectionWorkNode.dealUserId}
</if>
<if test="inspectionWorkNode.dealUserName != null">
AND node.deal_user_name LIKE CONCAT('%', #{inspectionWorkNode.dealUserName} , '%')
</if>
<if test="inspectionWorkNode.rescueStartMonth != null">
AND DATE_FORMAT(info.end_time, '%Y-%m') = #{inspectionWorkNode.rescueStartMonth}
</if>
<if test="inspectionWorkNode.rescueStart != null and inspectionWorkNode.rescueEnd != null">
AND info.end_time BETWEEN #{inspectionWorkNode.rescueStart} AND #{inspectionWorkNode.rescueEnd}
</if>
</where>
ORDER BY
node.create_time DESC;
</select>
</mapper>