1、解决pad端-请领单-物料累计请领数量不正确问题

2、服务指令通过镜像码同步处理代码逻辑,实现管理端记录同步日志功能
This commit is contained in:
1378012178@qq.com 2025-12-22 11:18:01 +08:00
parent 19da989f39
commit c1cc6f8a62
6 changed files with 144 additions and 50 deletions

View File

@ -385,7 +385,7 @@ public class InvoicingQldApi {
return Result.error("缺少参数");
}
//一次只能出库一单
if(dto.getQldNo().indexOf(",")>0){
if (dto.getQldNo().indexOf(",") > 0) {
return Result.error("出库失败");
}
Map<String, Object> result = qinglingApi.outbound(dto);

View File

@ -4,7 +4,7 @@
<update id="editQyty">
update nu_config_material_info set iz_enabled = #{izEnabled}
update nu_config_material_info set iz_enabled = #{izEnabled}
<where>
<if test="categoryId != null and categoryId != ''">
and category_id = #{categoryId}
@ -19,8 +19,9 @@
</update>
<select id="getConfiguredList" resultType="com.nu.modules.ConfigMaterial.entity.ConfigMaterialInfo">
select * from nu_config_material_info a
where del_flag = '0' and iz_enabled = 'Y' and id not in ( select wl_id from nu_warehouse_material_info where del_flag = '0' and iz_enabled = 'Y' )
select * from nu_config_material_info a
where del_flag = '0' and iz_enabled = 'Y' and id not in ( select wl_id from nu_warehouse_material_info where
del_flag = '0' and iz_enabled = 'Y' )
<if test="param.checkId != null and param.checkId != ''">
and id not in ( ${param.checkId} )
</if>
@ -35,87 +36,103 @@
</if>
<if test="param.paramWlxx != null and param.paramWlxx != ''">
and (material_name like concat('%', #{param.paramWlxx} , '%') or
pinyin like concat('%', #{param.paramWlxx} , '%') or
material_no like concat('%', #{param.paramWlxx} , '%') or
specification_model like concat('%', #{param.paramWlxx} , '%')
pinyin like concat('%', #{param.paramWlxx} , '%') or
material_no like concat('%', #{param.paramWlxx} , '%') or
specification_model like concat('%', #{param.paramWlxx} , '%')
)
</if>
</select>
<select id="queryWlInfoByWlId" resultType="com.nu.modules.ConfigMaterial.entity.ConfigMaterialInfo">
select a.*,b.kcsl,c.item_text as izYbbxName,d.item_text as izJgyhName,e.item_text as izEnabledName ,f.category_name,g.type_name,h.medication_name,tag.item_text as tagName
select a.*,
b.kcsl,
c.item_text as izYbbxName,
d.item_text as izJgyhName,
e.item_text as izEnabledName,
f.category_name,
g.type_name,
h.medication_name,
tag.item_text as tagName
from nu_config_material_info a
left join nu_warehouse_material_info b on a.id = b.wl_id and b.nu_id = #{nuId}
left join sys_dict_item c on a.iz_ybbx = c.item_value and c.dict_id = 'a7adbcd86c37f7dbc9b66945c82ef9e6'
left join sys_dict_item d on a.iz_jgyh = d.item_value and d.dict_id = 'a7adbcd86c37f7dbc9b66945c82ef9e6'
left join sys_dict_item e on a.iz_enabled = e.item_value and e.dict_id = '1900072409995653121'
left join nu_warehouse_material_info b on a.id = b.wl_id and b.nu_id = #{nuId}
left join sys_dict_item c
on a.iz_ybbx = c.item_value and c.dict_id = 'a7adbcd86c37f7dbc9b66945c82ef9e6'
left join sys_dict_item d
on a.iz_jgyh = d.item_value and d.dict_id = 'a7adbcd86c37f7dbc9b66945c82ef9e6'
left join sys_dict_item e on a.iz_enabled = e.item_value and e.dict_id = '1900072409995653121'
left join nu_config_material_category f on a.category_id = f.id
left join nu_config_material_type g on a.type_id = g.id
left join nu_config_material_medication h on a.medication_id = h.id
left join sys_dict_item tag on a.tag_type = tag.item_value and tag.dict_id = '1978662656563613698'
left join nu_config_material_category f on a.category_id = f.id
left join nu_config_material_type g on a.type_id = g.id
left join nu_config_material_medication h on a.medication_id = h.id
left join sys_dict_item tag on a.tag_type = tag.item_value and tag.dict_id = '1978662656563613698'
where a.id = #{wlId}
</select>
<select id="getTreeDataWlnum" resultType="com.nu.modules.ConfigMaterial.entity.ConfigMaterialInfo">
select a.*
from nu_warehouse_material_info a
left join nu_config_material_info b on b.id = a.wl_id
${ew.customSqlSegment}
from nu_warehouse_material_info a
left join nu_config_material_info b on b.id = a.wl_id
${ew.customSqlSegment}
</select>
<select id="getGysListByWlId" resultType="com.nu.modules.ConfigMaterial.entity.ConfigMaterialInfo">
select a.id,a.suppliers,GROUP_CONCAT(b.suppliers_name) as suppliers_name from nu_config_material_info a
left join nu_config_suppliers_info b on FIND_IN_SET(b.id,a.suppliers)
select a.id, a.suppliers, GROUP_CONCAT(b.suppliers_name) as suppliers_name
from nu_config_material_info a
left join nu_config_suppliers_info b on FIND_IN_SET(b.id, a.suppliers)
where a.id = #{wlId}
GROUP BY a.id,a.suppliers
GROUP BY a.id, a.suppliers
</select>
<select id="getGwcTreeDataWlnum" resultType="com.nu.modules.ConfigMaterial.entity.ConfigMaterialInfo">
select a.*
from nu_invoicing_qgd_info a
left join nu_config_material_info b on b.id = a.wl_id
${ew.customSqlSegment}
from nu_invoicing_qgd_info a
left join nu_config_material_info b on b.id = a.wl_id
${ew.customSqlSegment}
</select>
<select id="getCgdTreeDataWlnum" resultType="com.nu.modules.ConfigMaterial.entity.ConfigMaterialInfo">
select a.*
from nu_invoicing_cgd_info a
left join nu_config_material_info b on b.id = a.wl_id
${ew.customSqlSegment}
from nu_invoicing_cgd_info a
left join nu_config_material_info b on b.id = a.wl_id
${ew.customSqlSegment}
</select>
<select id="queryMaterialInfo" resultType="com.nu.modules.ConfigMaterial.entity.ConfigMaterialInfo">
select info.*,nukcsl.wl_num AS wlNum,gwc.ql_num AS qlNum
select info.*, qlinfo.wl_num AS wlNum, gwc.ql_num AS qlNum
from nu_config_material_info info
left join nu_invoicing_nu_kcsl nukcsl on info.id = nukcsl.wl_id and nukcsl.nu_id = #{nuId} and nukcsl.elder_id = #{elderId}
left join nu_invoicing_qld_gwc gwc on gwc.wl_id = info.id and gwc.nu_id = #{nuId} and gwc.elder_id = #{elderId}
where info.id = #{wlId}
left join (select wl_id, sum(wl_num) as wl_num
from nu_invoicing_nu_crk_log
where nu_id = #{nuId}
and elder_id = #{elderId}
and wl_id = #{wlId}
and type = '1'
group by wl_id) qlinfo on qlinfo.wl_id = info.id
left join nu_invoicing_qld_gwc gwc
on gwc.wl_id = info.id and gwc.nu_id = #{nuId} and gwc.elder_id = #{elderId}
where info.id = #{wlId}
</select>
<update id="updateOneTwoPrice">
update nu_config_material_info set
one_unit = #{params.oneUnit},
one_unit_proportion = #{params.oneUnitProportion},
one_unit_price = #{params.oneUnitPrice},
two_unit = #{params.twoUnit},
two_unit_proportion = #{params.twoUnitProportion},
two_unit_price = #{params.twoUnitPrice}
update nu_config_material_info
set one_unit = #{params.oneUnit},
one_unit_proportion = #{params.oneUnitProportion},
one_unit_price = #{params.oneUnitPrice},
two_unit = #{params.twoUnit},
two_unit_proportion = #{params.twoUnitProportion},
two_unit_price = #{params.twoUnitPrice}
where id = #{params.id}
</update>
<select id="queryByWlids" resultType="com.nu.modules.ConfigMaterial.entity.ConfigMaterialInfo">
select a.*,f.category_name,g.type_name,h.medication_name
from nu_config_material_info a
left join nu_config_material_category f on a.category_id = f.id
left join nu_config_material_type g on a.type_id = g.id
left join nu_config_material_medication h on a.medication_id = h.id
left join nu_config_material_category f on a.category_id = f.id
left join nu_config_material_type g on a.type_id = g.id
left join nu_config_material_medication h on a.medication_id = h.id
<where>
a.id in
<foreach collection="ids" item="id" open="(" close=")" separator=",">

View File

@ -460,7 +460,7 @@ public class ConfigServiceDirectiveController extends JeecgController<ConfigServ
//同步
if (StringUtils.isNotBlank(dto.getSyncIds())) {
new Thread(() -> {
configServiceDirectiveService.syncDirective(sourceOrgCode, dto.getSyncIds());
configServiceDirectiveService.syncDirective(sourceOrgCode, dto.getSyncIds(), dto.getSyncCode());
}).start();
}
//发送消息

View File

@ -330,4 +330,6 @@ public class ConfigServiceDirective implements Serializable {
private String cycleTypeShow;
@TableField(exist = false)
private String cycleTypeValue;
@TableField(exist = false)
private String syncCode;
}

View File

@ -67,7 +67,7 @@ public interface IConfigServiceDirectiveService extends IService<ConfigServiceDi
List<ConfigServiceDirective> allData();
DirectiveMQDto syncDirective(String sourceOrgCode, String syncIds);
DirectiveMQDto syncDirective(String sourceOrgCode, String syncIds, String syncCode);
List<ConfigServiceDirective> compareList(ConfigServiceDirective configServiceDirective);

View File

@ -1,9 +1,11 @@
package com.nu.modules.config.servicedirective.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.IdUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
@ -456,11 +458,12 @@ public class ConfigServiceDirectiveServiceImpl extends ServiceImpl<ConfigService
}
/**
* @param syncIds 需要同步的指令ID
* @param syncIds 需要同步的指令ID
* @param syncCode
*/
@Override
@DS("#sourceOrgCode")
public DirectiveMQDto syncDirective(String sourceOrgCode, String syncIds) {
public DirectiveMQDto syncDirective(String sourceOrgCode, String syncIds, String syncCode) {
DirectiveMQDto directiveMQDto = new DirectiveMQDto();
List<ConfigServiceDirective> directives;
List<String> directiveIds = Arrays.asList(syncIds.split(","));
@ -503,6 +506,7 @@ public class ConfigServiceDirectiveServiceImpl extends ServiceImpl<ConfigService
// }
}
//分类标签
Map<String, String> instructionTagMap = new HashMap<>();
{
List<String> instructionTagIds = directives.stream().map(ConfigServiceDirective::getInstructionTagId).filter(instructionTagId -> instructionTagId != null && !instructionTagId.isEmpty()).distinct().collect(Collectors.toList());
if (!instructionTagIds.isEmpty()) {
@ -510,9 +514,16 @@ public class ConfigServiceDirectiveServiceImpl extends ServiceImpl<ConfigService
qw.in("id", instructionTagIds);
List<InstructionTag> list = instructionTagService.list(qw);
directiveMQDto.setInstructionList(BeanUtil.copyToList(list, InstructionTagMQDto.class));
instructionTagMap = list.stream()
.collect(Collectors.toMap(
InstructionTag::getId,
InstructionTag::getInstructionName,
(v1, v2) -> v1
));
}
}
//服务类别
Map<String, String> categoryMap = new HashMap<>();
{
List<String> categoryIds = directives.stream().map(ConfigServiceDirective::getCategoryId).filter(categoryId -> categoryId != null && !categoryId.isEmpty()).distinct().collect(Collectors.toList());
if (!categoryIds.isEmpty()) {
@ -520,9 +531,16 @@ public class ConfigServiceDirectiveServiceImpl extends ServiceImpl<ConfigService
qw.in("id", categoryIds);
List<ConfigServiceCategory> list = categoryService.list(qw);
directiveMQDto.setCategoryList(BeanUtil.copyToList(list, CategoryMQDto.class));
categoryMap = list.stream()
.collect(Collectors.toMap(
ConfigServiceCategory::getId,
ConfigServiceCategory::getCategoryName,
(v1, v2) -> v1
));
}
}
//服务类型
Map<String, String> typeMap = new HashMap<>();
{
List<String> typeIds = directives.stream().map(ConfigServiceDirective::getTypeId).filter(typeId -> typeId != null && !typeId.isEmpty()).distinct().collect(Collectors.toList());
if (!typeIds.isEmpty()) {
@ -530,6 +548,12 @@ public class ConfigServiceDirectiveServiceImpl extends ServiceImpl<ConfigService
qw.in("id", typeIds);
List<ConfigServiceType> list = typeService.list(qw);
directiveMQDto.setTypeList(BeanUtil.copyToList(list, DirectiveTypeMQDto.class));
typeMap = list.stream()
.collect(Collectors.toMap(
ConfigServiceType::getId,
ConfigServiceType::getTypeName,
(v1, v2) -> v1
));
}
}
//体型标签
@ -564,6 +588,57 @@ public class ConfigServiceDirectiveServiceImpl extends ServiceImpl<ConfigService
// }
directiveMQListener.handleCreateMedia2(directiveMQDto, apiAddress);
//同步结果保存到管理平台
{
String syncId = IdUtil.simpleUUID();//本次镜像id
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();//操作人信息
DynamicDataSourceContextHolder.push("master");
JSONObject deptInfo;//本机构信息
try {
deptInfo = sysBaseAPI.getDeptInfo();
} finally {
DynamicDataSourceContextHolder.clear();
}
DirectiveSyncLogMainMQDto syncDto = new DirectiveSyncLogMainMQDto();
List<DirectiveSyncLogInfoMQDto> syncInfoList = Lists.newArrayList();
syncDto.setId(syncId);
syncDto.setOpeOrgCode(deptInfo.getString("code"));//镜像机构101同步102指令 那就是101
syncDto.setTargetOrgCode(sourceOrgCode);//被镜像机构101同步102指令 那就是102
syncDto.setOrgDirectiveCode(syncCode.replaceAll("\\*", ""));//镜像码
syncDto.setCreateBy(sysUser.getRealname());//操作人姓名
for (DirectiveAsyncMQDto item : directiveMQDto.getDirectiveList()) {
DirectiveSyncLogInfoMQDto info = new DirectiveSyncLogInfoMQDto();
info.setPkId(syncId);//主表id
info.setInstructionTagId(item.getInstructionTagId());//分类标签ID
info.setInstructionTagName(instructionTagMap.get(item.getInstructionTagId()));//分类标签名称
info.setCategoryId(item.getCategoryId());//服务类别id
info.setCategoryName(categoryMap.get(item.getCategoryId()));//服务类别名称
info.setTypeId(item.getTypeId());//服务类型ID
info.setTypeName(typeMap.get(item.getTypeId()));//服务类型名称
info.setDirectiveId(item.getId());//服务指令ID
info.setDirectiveName(item.getDirectiveName());//服务指令名称
info.setTollPrice(item.getTollPrice());//收费价格
info.setComPrice(item.getComPrice());//提成价格
info.setCycleType(item.getCycleType());//周期类型
info.setServiceContent(item.getServiceContent());//服务说明
info.setServiceDuration(item.getServiceDuration());//服务时长
info.setSysOrgCode(item.getSysOrgCode());//所属部门
info.setMp3File(item.getMp3File());//语音文件
info.setMp4File(item.getMp4File());//视频文件
info.setPreviewFile(item.getPreviewFile());//服务指令图片大图
info.setPreviewFileSmall(item.getPreviewFileSmall());//服务指令图片小图
info.setImmediateFile(item.getImmediateFile());//即时指令图片
info.setImmediateFileFocus(item.getImmediateFileFocus());//即时指令焦点图片
info.setCreateTime(new Date());//创建日期
syncInfoList.add(info);
}
syncDto.setSyncInfoList(syncInfoList);
rabbitMQUtil.sendToExchange("hldy.fwzl", "fwzl.synccode.log", syncDto);
}
//给对应业务平台发送消息
return directiveMQDto;
}
@ -715,7 +790,7 @@ public class ConfigServiceDirectiveServiceImpl extends ServiceImpl<ConfigService
opeApiAddress = opeApiAddress.substring(0, opeApiAddress.length() - 1);
}
try {
String apiAddress = opeApiAddress + "/api/services/directive/getOrgCodeBySyncCode?syncCode=" + URLEncoder.encode(syncCode.replaceAll("\\*",""), "UTF-8");
String apiAddress = opeApiAddress + "/api/services/directive/getOrgCodeBySyncCode?syncCode=" + URLEncoder.encode(syncCode.replaceAll("\\*", ""), "UTF-8");
String res = HttpRequestUtil.doGet(apiAddress, HttpRequestUtil.createDefaultHeaders());
JSONObject jsonResponse = JSON.parseObject(res);
JSONObject r_ = jsonResponse.getJSONObject("result");
@ -726,7 +801,7 @@ public class ConfigServiceDirectiveServiceImpl extends ServiceImpl<ConfigService
JSONObject deptInfo = sysBaseAPI.getDeptInfo();
Map<String, String> result = Maps.newHashMap();
if(StringUtils.isNotBlank(orgCode) && orgCode.equals(deptInfo.getString("code"))){
if (StringUtils.isNotBlank(orgCode) && orgCode.equals(deptInfo.getString("code"))) {
return "-1";
}