员工提成

This commit is contained in:
许允枞 2024-11-08 17:35:17 +08:00
parent c55205c535
commit b623133c22
2 changed files with 40 additions and 17 deletions

View File

@ -4,6 +4,8 @@ import java.util.List;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.security.core.LoginUser;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.module.inspection.entity.InspectionInfo; import cn.iocoder.yudao.module.inspection.entity.InspectionInfo;
import cn.iocoder.yudao.module.inspection.entity.InspectionWorkNode; import cn.iocoder.yudao.module.inspection.entity.InspectionWorkNode;
import cn.iocoder.yudao.module.inspection.service.IInspectionInfoService; import cn.iocoder.yudao.module.inspection.service.IInspectionInfoService;
@ -171,6 +173,7 @@ public class InspectionInfoController extends BaseController {
/** /**
* 分页查询节点提成 * 分页查询节点提成
*
* @param inspectionWorkNode * @param inspectionWorkNode
* @param pageNum * @param pageNum
* @param pageSize * @param pageSize
@ -186,6 +189,7 @@ public class InspectionInfoController extends BaseController {
/** /**
* 获取提成总金额 * 获取提成总金额
*
* @param inspectionWorkNode * @param inspectionWorkNode
* @return * @return
*/ */
@ -197,16 +201,32 @@ public class InspectionInfoController extends BaseController {
/** /**
* app分页查询节点提成 * app分页查询节点提成
*
* @param pageNum * @param pageNum
* @param pageSize * @param pageSize
* @return * @return
*/ */
@GetMapping("getRoyaltyList") @GetMapping("getRoyaltyListApp")
public CommonResult getRoyaltyListApp(@RequestParam(value = "pageNo", required = false, defaultValue = "1") Integer pageNum, public CommonResult getRoyaltyListApp(InspectionWorkNode inspectionWorkNode,
@RequestParam(value = "pageNo", required = false, defaultValue = "1") Integer pageNum,
@RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize) { @RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize) {
InspectionWorkNode inspectionWorkNode = new InspectionWorkNode(); //获取当前登陆人
inspectionWorkNode.setDealUserId(getUserId()); LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
inspectionWorkNode.setDealUserId(loginUser.getId());
IPage page = new Page(pageNum, pageSize); IPage page = new Page(pageNum, pageSize);
return success(inspectionWorkNodeService.getRoyaltyList(page, inspectionWorkNode)); return success(inspectionWorkNodeService.getRoyaltyList(page, inspectionWorkNode));
} }
/**
* 获取提成总金额app
*
* @return
*/
@GetMapping("getRoyaltySumApp")
public CommonResult getRoyaltySumApp(InspectionWorkNode inspectionWorkNode) {
//获取当前登陆人
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
inspectionWorkNode.setDealUserId(loginUser.getId());
return success(inspectionWorkNodeService.getRoyaltySum(inspectionWorkNode));
}
} }

View File

@ -17,14 +17,11 @@
proj.project_name AS projectName, -- Assuming there's a project name in the inspection project table proj.project_name AS projectName, -- Assuming there's a project name in the inspection project table
node.deal_user_name AS handlerName, node.deal_user_name AS handlerName,
IFNULL(royalty.royalty_amount, 0) / 100 AS royaltyAmount, IFNULL(royalty.royalty_amount, 0) / 100 AS royaltyAmount,
node.create_time AS node_create_time, node.update_time AS node_create_time,
royalty.update_time AS royalty_create_time node.update_time AS royalty_create_time
FROM FROM
inspection_work_node AS node inspection_work_node AS node
LEFT JOIN LEFT JOIN
inspection_project_royalty AS royalty
ON node.project_id = royalty.project_id
LEFT JOIN
system_users AS users system_users AS users
ON node.deal_user_id = users.id ON node.deal_user_id = users.id
LEFT JOIN LEFT JOIN
@ -33,6 +30,12 @@
LEFT JOIN LEFT JOIN
inspection_info AS info inspection_info AS info
ON node.inspection_info_id = info.id ON node.inspection_info_id = info.id
LEFT JOIN
order_info orders
ON info.inspection_order_id = orders.id
LEFT JOIN
inspection_project_royalty AS royalty
ON node.project_id = royalty.project_id and orders.goods_id = royalty.goods_id
<where> <where>
node.status = '2' AND info.status = '1' node.status = '2' AND info.status = '1'
<if test="inspectionWorkNode.createTime != null"> <if test="inspectionWorkNode.createTime != null">
@ -50,15 +53,12 @@
<if test="inspectionWorkNode.rescueStartMonth != null"> <if test="inspectionWorkNode.rescueStartMonth != null">
AND DATE_FORMAT(info.end_time, '%Y-%m') = #{inspectionWorkNode.rescueStartMonth} AND DATE_FORMAT(info.end_time, '%Y-%m') = #{inspectionWorkNode.rescueStartMonth}
</if> </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"> <if test="inspectionWorkNode.rescueStart != null and inspectionWorkNode.rescueEnd != null">
AND info.end_time BETWEEN #{inspectionWorkNode.rescueStart} AND #{inspectionWorkNode.rescueEnd} AND info.end_time BETWEEN #{inspectionWorkNode.rescueStart} AND #{inspectionWorkNode.rescueEnd}
</if> </if>
</where> </where>
ORDER BY ORDER BY
node.create_time DESC; info.end_time DESC;
</select> </select>
<select id="getRoyaltySum" resultType="java.util.Map"> <select id="getRoyaltySum" resultType="java.util.Map">
SELECT SELECT
@ -66,9 +66,6 @@
FROM FROM
inspection_work_node AS node inspection_work_node AS node
LEFT JOIN LEFT JOIN
inspection_project_royalty AS royalty
ON node.project_id = royalty.project_id
LEFT JOIN
system_users AS users system_users AS users
ON node.deal_user_id = users.id ON node.deal_user_id = users.id
LEFT JOIN LEFT JOIN
@ -77,6 +74,12 @@
LEFT JOIN LEFT JOIN
inspection_info AS info inspection_info AS info
ON node.inspection_info_id = info.id ON node.inspection_info_id = info.id
LEFT JOIN
order_info orders
ON info.inspection_order_id = orders.id
LEFT JOIN
inspection_project_royalty AS royalty
ON node.project_id = royalty.project_id and orders.goods_id = royalty.goods_id
<where> <where>
node.status = '2' AND info.status = '1' node.status = '2' AND info.status = '1'
<if test="inspectionWorkNode.createTime != null"> <if test="inspectionWorkNode.createTime != null">