更新修改检测项目提成

This commit is contained in:
许允枞 2024-11-11 16:31:26 +08:00
parent ee30997021
commit 1aa4436ce6
6 changed files with 42 additions and 19 deletions

View File

@ -23,7 +23,7 @@ public interface ProjectRoyaltyMapper extends BaseMapper<ProjectRoyalty> {
void deleteByProjectId(String projectId);
List<ProjectRoyalty> selectListByProjrctId(String projectId);
List<ProjectRoyalty> selectListByProjrctId(@Param("projectId")String projectId,@Param("parentId") String parentId);
void updtaBatch(@Param("list") List<ProjectRoyalty> createReq);
}

View File

@ -72,9 +72,13 @@ public class DlInspectionProjectServiceImpl extends ServiceImpl<DlInspectionProj
DlInspectionProject updateObj = BeanUtils.toBean(updateReqVO, DlInspectionProject.class);
dlInspectionProjectMapper.updateById(updateObj);
// 更新项目子表
//删除项目子表
projectRoyaltyService.deleteInsertProjectRoyalty(updateReqVO.getId());
//插入项目子表
List<ProjectRoyalty> projectRoyaltyList = updateReqVO.getProjectRoyaltyList();
projectRoyaltyService.updtaBatch(projectRoyaltyList);
//设置项目id
List<ProjectRoyalty> collect = projectRoyaltyList.stream().map(item -> item.setProjectId(updateReqVO.getId())).collect(Collectors.toList());
projectRoyaltyService.batchInsertProjectRoyalty(collect);
}
@Override

View File

@ -289,12 +289,12 @@ public class InspectionInfoServiceImpl extends ServiceImpl<InspectionInfoMapper,
LambdaQueryWrapper<PartnerWorker> workerQueryWrapper = new LambdaQueryWrapper<>();
workerQueryWrapper.eq(PartnerWorker::getUserId, loginUser.getId()).eq(PartnerWorker::getPartnerId, partners.getPartnerId());
PartnerWorker worker = workerService.getOne(workerQueryWrapper);
AdminUserDO workerUser = userService.getUser(worker.getUserId());
if (ObjectUtils.isNotEmpty(worker)) {
inspectionInfo.setWorkId(worker.getId());
} else {
throw new Exception("请先将接待员加入员工");
}
AdminUserDO workerUser = userService.getUser(loginUser.getId());
// if (ObjectUtils.isNotEmpty(worker)) {
inspectionInfo.setWorkId(workerUser.getId());
// } else {
// throw new Exception("请先将接待员加入员工");
// }
String buyName = StringUtils.isNotEmpty(inspectionInfo.getBuyName()) ? inspectionInfo.getBuyName() : "未知客户";
String buyPhone = StringUtils.isNotEmpty(inspectionInfo.getBuyPhone()) ? inspectionInfo.getBuyPhone() : StringUtils.isNotEmpty(inspectionInfo.getBuyName()) ? inspectionInfo.getBuyName() : "";
AdminUserDO user = userService.getUserByMobile(buyPhone);
@ -385,17 +385,17 @@ public class InspectionInfoServiceImpl extends ServiceImpl<InspectionInfoMapper,
* @return
*/
@Override
public IPage<InspectionInfo> geStelectInspection(IPage page,InspectionInfo inspectionInfo) {
public IPage<InspectionInfo> geStelectInspection(IPage page, InspectionInfo inspectionInfo) {
//获取当前登录人
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
//获取当前登陆人的角色
List<UserRoleDO> byUserId = roleService.getByUserId(loginUser.getId());
List<Long> roleIds = byUserId.stream().map(UserRoleDO::getRoleId).collect(Collectors.toList());
if(!"1".equals(inspectionInfo.getStatus())){
if (!"1".equals(inspectionInfo.getStatus())) {
//进行中 已完成
inspectionInfo.setDealUserId(loginUser.getId());
}
return baseMapper.selectByUser(page,roleIds,inspectionInfo);
return baseMapper.selectByUser(page, roleIds, inspectionInfo);
}
/**

View File

@ -2,10 +2,14 @@ package cn.iocoder.yudao.module.inspection.service.impl;
import cn.iocoder.yudao.module.inspection.entity.ProjectRoyalty;
import cn.iocoder.yudao.module.inspection.mapper.ProjectRoyaltyMapper;
import cn.iocoder.yudao.module.inspection.service.AppInspectionPartnerService;
import cn.iocoder.yudao.module.inspection.service.ProjectRoyaltyService;
import cn.iocoder.yudao.module.inspection.vo.ProjectRoyaltySaveReqVO;
import cn.iocoder.yudao.module.shop.entity.ShopMallPartners;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
@ -24,6 +28,9 @@ public class ProjectRoyaltyServiceImpl extends ServiceImpl<ProjectRoyaltyMapper,
@Resource
private ProjectRoyaltyMapper projectRoyaltyMapper;
@Autowired
@Lazy
private AppInspectionPartnerService appInspectionPartnerService;
@Override
public Long createProjectRoyalty(ProjectRoyaltySaveReqVO createReqVO) {
@ -62,7 +69,12 @@ public class ProjectRoyaltyServiceImpl extends ServiceImpl<ProjectRoyaltyMapper,
*/
@Override
public List<ProjectRoyalty> getProjectRoyaltyList(String projectId) {
return baseMapper.selectListByProjrctId(projectId);
try {
ShopMallPartners one = appInspectionPartnerService.shopInfoByUserId();
return baseMapper.selectListByProjrctId(projectId, one.getPartnerId().toString());
} catch (Exception e) {
throw new RuntimeException(e);
}
}
/**

View File

@ -23,6 +23,6 @@
AND role_id = #{entity.roleId}
</if>
</where>
ORDER BY create_time DESC
ORDER BY update_time DESC
</select>
</mapper>

View File

@ -30,13 +30,20 @@
</foreach>
</update>
<delete id="deleteByProjectId" parameterType="java.lang.String">
UPDATE inspection_project_royalty SET deleted = 1 WHERE project_id = #{projectId}
delete from inspection_project_royalty where project_id = #{projectId}
</delete>
<select id="selectListByProjrctId" resultType="cn.iocoder.yudao.module.inspection.entity.ProjectRoyalty"
parameterType="java.lang.String">
SELECT ir.royalty_amount / 100 royaltyAmount, goods.title title, ir.id id, goods.id goodsId
FROM inspection_project_royalty ir
LEFT JOIN shop_inspection_goods goods ON goods.id = ir.goods_id
WHERE ir.project_id = #{projectId}
SELECT g.id id,
g.title title,
COALESCE(r.royalty_amount / 100, 0) AS royalty_amount
FROM shop_inspection_goods g
LEFT JOIN inspection_project_royalty r
ON g.id = r.goods_id
AND r.deleted = 0
AND r.project_id = #{projectId}
WHERE g.deleted = 0
AND g.partner_id = #{parentId}
</select>
</mapper>