更新修改检测项目提成
This commit is contained in:
parent
ee30997021
commit
1aa4436ce6
@ -23,7 +23,7 @@ public interface ProjectRoyaltyMapper extends BaseMapper<ProjectRoyalty> {
|
|||||||
|
|
||||||
void deleteByProjectId(String projectId);
|
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);
|
void updtaBatch(@Param("list") List<ProjectRoyalty> createReq);
|
||||||
}
|
}
|
@ -72,9 +72,13 @@ public class DlInspectionProjectServiceImpl extends ServiceImpl<DlInspectionProj
|
|||||||
DlInspectionProject updateObj = BeanUtils.toBean(updateReqVO, DlInspectionProject.class);
|
DlInspectionProject updateObj = BeanUtils.toBean(updateReqVO, DlInspectionProject.class);
|
||||||
dlInspectionProjectMapper.updateById(updateObj);
|
dlInspectionProjectMapper.updateById(updateObj);
|
||||||
|
|
||||||
// 更新项目子表
|
//删除项目子表
|
||||||
|
projectRoyaltyService.deleteInsertProjectRoyalty(updateReqVO.getId());
|
||||||
|
//插入项目子表
|
||||||
List<ProjectRoyalty> projectRoyaltyList = updateReqVO.getProjectRoyaltyList();
|
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
|
@Override
|
||||||
|
@ -289,12 +289,12 @@ public class InspectionInfoServiceImpl extends ServiceImpl<InspectionInfoMapper,
|
|||||||
LambdaQueryWrapper<PartnerWorker> workerQueryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<PartnerWorker> workerQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
workerQueryWrapper.eq(PartnerWorker::getUserId, loginUser.getId()).eq(PartnerWorker::getPartnerId, partners.getPartnerId());
|
workerQueryWrapper.eq(PartnerWorker::getUserId, loginUser.getId()).eq(PartnerWorker::getPartnerId, partners.getPartnerId());
|
||||||
PartnerWorker worker = workerService.getOne(workerQueryWrapper);
|
PartnerWorker worker = workerService.getOne(workerQueryWrapper);
|
||||||
AdminUserDO workerUser = userService.getUser(worker.getUserId());
|
AdminUserDO workerUser = userService.getUser(loginUser.getId());
|
||||||
if (ObjectUtils.isNotEmpty(worker)) {
|
// if (ObjectUtils.isNotEmpty(worker)) {
|
||||||
inspectionInfo.setWorkId(worker.getId());
|
inspectionInfo.setWorkId(workerUser.getId());
|
||||||
} else {
|
// } else {
|
||||||
throw new Exception("请先将接待员加入员工");
|
// throw new Exception("请先将接待员加入员工");
|
||||||
}
|
// }
|
||||||
String buyName = StringUtils.isNotEmpty(inspectionInfo.getBuyName()) ? inspectionInfo.getBuyName() : "未知客户";
|
String buyName = StringUtils.isNotEmpty(inspectionInfo.getBuyName()) ? inspectionInfo.getBuyName() : "未知客户";
|
||||||
String buyPhone = StringUtils.isNotEmpty(inspectionInfo.getBuyPhone()) ? inspectionInfo.getBuyPhone() : 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);
|
AdminUserDO user = userService.getUserByMobile(buyPhone);
|
||||||
@ -385,17 +385,17 @@ public class InspectionInfoServiceImpl extends ServiceImpl<InspectionInfoMapper,
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public IPage<InspectionInfo> geStelectInspection(IPage page,InspectionInfo inspectionInfo) {
|
public IPage<InspectionInfo> geStelectInspection(IPage page, InspectionInfo inspectionInfo) {
|
||||||
//获取当前登录人
|
//获取当前登录人
|
||||||
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
||||||
//获取当前登陆人的角色
|
//获取当前登陆人的角色
|
||||||
List<UserRoleDO> byUserId = roleService.getByUserId(loginUser.getId());
|
List<UserRoleDO> byUserId = roleService.getByUserId(loginUser.getId());
|
||||||
List<Long> roleIds = byUserId.stream().map(UserRoleDO::getRoleId).collect(Collectors.toList());
|
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());
|
inspectionInfo.setDealUserId(loginUser.getId());
|
||||||
}
|
}
|
||||||
return baseMapper.selectByUser(page,roleIds,inspectionInfo);
|
return baseMapper.selectByUser(page, roleIds, inspectionInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -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.entity.ProjectRoyalty;
|
||||||
import cn.iocoder.yudao.module.inspection.mapper.ProjectRoyaltyMapper;
|
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.service.ProjectRoyaltyService;
|
||||||
import cn.iocoder.yudao.module.inspection.vo.ProjectRoyaltySaveReqVO;
|
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.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
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 org.springframework.stereotype.Service;
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
@ -24,6 +28,9 @@ public class ProjectRoyaltyServiceImpl extends ServiceImpl<ProjectRoyaltyMapper,
|
|||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private ProjectRoyaltyMapper projectRoyaltyMapper;
|
private ProjectRoyaltyMapper projectRoyaltyMapper;
|
||||||
|
@Autowired
|
||||||
|
@Lazy
|
||||||
|
private AppInspectionPartnerService appInspectionPartnerService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Long createProjectRoyalty(ProjectRoyaltySaveReqVO createReqVO) {
|
public Long createProjectRoyalty(ProjectRoyaltySaveReqVO createReqVO) {
|
||||||
@ -62,7 +69,12 @@ public class ProjectRoyaltyServiceImpl extends ServiceImpl<ProjectRoyaltyMapper,
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<ProjectRoyalty> getProjectRoyaltyList(String projectId) {
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -23,6 +23,6 @@
|
|||||||
AND role_id = #{entity.roleId}
|
AND role_id = #{entity.roleId}
|
||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
ORDER BY create_time DESC
|
ORDER BY update_time DESC
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
@ -30,13 +30,20 @@
|
|||||||
</foreach>
|
</foreach>
|
||||||
</update>
|
</update>
|
||||||
<delete id="deleteByProjectId" parameterType="java.lang.String">
|
<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>
|
</delete>
|
||||||
<select id="selectListByProjrctId" resultType="cn.iocoder.yudao.module.inspection.entity.ProjectRoyalty"
|
<select id="selectListByProjrctId" resultType="cn.iocoder.yudao.module.inspection.entity.ProjectRoyalty"
|
||||||
parameterType="java.lang.String">
|
parameterType="java.lang.String">
|
||||||
SELECT ir.royalty_amount / 100 royaltyAmount, goods.title title, ir.id id, goods.id goodsId
|
SELECT g.id id,
|
||||||
FROM inspection_project_royalty ir
|
g.title title,
|
||||||
LEFT JOIN shop_inspection_goods goods ON goods.id = ir.goods_id
|
COALESCE(r.royalty_amount / 100, 0) AS royalty_amount
|
||||||
WHERE ir.project_id = #{projectId}
|
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>
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
Loading…
Reference in New Issue
Block a user