Commit 7f947997 by 宋祥

1.生产任务查询权限根据组过滤,

parent d6c4aa2e
......@@ -116,6 +116,15 @@ public class UserSessionUtils extends UserSession {
}
/**
* 获取登录用户的组织信息
*
* @return
*/
public static List<Org> getOrg() {
return HGXSTools.XsOrg.queryByUser();
}
/**
* 获取登录用户的公司编码
*
* @return
......
......@@ -152,9 +152,6 @@
<isNotEmpty prepend=" AND " property="unfinishWeight">
unfinish_weight = #unfinishWeight#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="accountCode">
account_code = #accountCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdBy">
created_by = #createdBy#
</isNotEmpty>
......@@ -173,19 +170,13 @@
<isNotEmpty prepend=" AND " property="updatedTime">
updated_time = #updatedTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="ids">
id IN <iterate close=")" open="(" conjunction="," property="ids">#ids[]#</iterate>
</isNotEmpty>
<!-- 移动端请求参数 -->
<isEqual prepend=" AND " property="completeStatus" compareValue="0">
trim(ifnull(complete_date,'')) = ''
</isEqual>
<isEqual prepend=" AND " property="completeStatus" compareValue="1">
trim(ifnull(complete_date,'')) != ''
</isEqual>
</sql>
<sql id="customCondition">
<include refid="condition"/>
<isNotEmpty prepend=" AND " property="ids">
id IN <iterate close=")" open="(" conjunction="," property="ids">#ids[]#</iterate>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCodes">
COMPANY_CODE IN <iterate close=")" open="(" conjunction="," property="companyCodes">#companyCodes[]#</iterate>
</isNotEmpty>
......@@ -201,6 +192,13 @@
<isNotEmpty prepend=" AND " property="groupNames">
GROUP_NAME IN <iterate close=")" open="(" conjunction="," property="groupNames">#groupNames[]#</iterate>
</isNotEmpty>
<!-- 移动端请求参数 -->
<isEqual prepend=" AND " property="completeStatus" compareValue="0">
TRIM(IFNULL(COMPLETE_DATE, '')) = ''
</isEqual>
<isEqual prepend=" AND " property="completeStatus" compareValue="1">
TRIM(IFNULL(COMPLETE_DATE, '')) != ''
</isEqual>
</sql>
<sql id="appCondition">
......@@ -247,7 +245,7 @@
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
id desc, product_type asc, product_name, process_order desc
ID DESC, PRODUCT_TYPE ASC, PRODUCT_NAME, PROCESS_ORDER DESC
</isEmpty>
</dynamic>
</sql>
......@@ -257,7 +255,6 @@
<include refid="column"/>
FROM ${hggpSchema}.HGSC007
WHERE 1=1
<include refid="condition"/>
<include refid="customCondition"/>
<include refid="orderBy"/>
</select>
......@@ -265,12 +262,11 @@
<select id="count" resultClass="int">
SELECT COUNT(*) FROM ${hggpSchema}.HGSC007
WHERE 1=1
<include refid="condition"/>
<include refid="customCondition"/>
</select>
<insert id="insert">
INSERT INTO ${hggpSchema}.HGSC007 (id,
INSERT INTO ${hggpSchema}.HGSC007 (
mat_id, <!-- 物料清单ID -->
order_id, <!-- 生产计划ID -->
order_detail_id, <!-- 生产计划明细ID -->
......@@ -313,13 +309,14 @@
updated_time, <!-- 更新时间 -->
spec,
length
)
VALUES (#id#, #matId#, #orderId#, #orderDetailId#, #techFlowId#, #techFlowName#, #inventProcessId#,
) VALUES (
#matId#, #orderId#, #orderDetailId#, #techFlowId#, #techFlowName#, #inventProcessId#,
#processCode#, #processName#, #processOrder#, #companyCode#, #companyName#, #depCode#, #depName#, #projCode#,
#projName#, #taskCode#, #productType#, #productCode#, #productName#, #planStartDate#, #planEndDate#,
#factoryCode#, #factoryName#, #groupCode#, #groupName#, #completeDate#, #quantity#, #finishQuantity#,
#unfinishQuantity#, #singleWeight#, #totalWeight#, #finishWeight#, #unfinishWeight#, #accountCode#, #createdBy#,
#createdName#, #createdTime#, #updatedBy#, #updatedName#, #updatedTime#, #spec#, #length#)
#createdName#, #createdTime#, #updatedBy#, #updatedName#, #updatedTime#, #spec#, #length#
)
</insert>
<delete id="delete">
......@@ -329,50 +326,45 @@
<update id="update">
UPDATE ${hggpSchema}.HGSC007
SET
mat_id = #matId#, <!-- 物料清单ID -->
order_id = #orderId#, <!-- 生产计划ID -->
order_detail_id = #orderDetailId#, <!-- 生产计划明细ID -->
tech_flow_id = #techFlowId#, <!-- 工艺流程ID -->
tech_flow_name = #techFlowName#, <!-- 工艺流程名称 -->
invent_process_id = #inventProcessId#, <!-- 存货工序ID,对应HGPZ005A.id -->
process_code = #processCode#, <!-- 工序编码 -->
process_name = #processName#, <!-- 工序名称 -->
process_order = #processOrder#, <!-- 加工顺序 -->
company_code = #companyCode#, <!-- 公司编码 -->
company_name = #companyName#, <!-- 公司名称 -->
dep_code = #depCode#, <!-- 部门编码 -->
dep_name = #depName#, <!-- 部门名称 -->
proj_code = #projCode#, <!-- 项目编码 -->
proj_name = #projName#, <!-- 项目名称 -->
task_code = #taskCode#, <!-- 任务编码 -->
product_type = #productType#, <!-- 产品类型 -->
product_code = #productCode#, <!-- 产品编号 -->
product_name = #productName#, <!-- 产品名称 -->
plan_start_date = #planStartDate#, <!-- 计划开始日期 -->
plan_end_date = #planEndDate#, <!-- 计划结束日期 -->
factory_code = #factoryCode#, <!-- 工厂编号 -->
factory_name = #factoryName#, <!-- 工厂名称 -->
group_code = #groupCode#, <!-- 工作组编号 -->
group_name = #groupName#, <!-- 工作组名称 -->
complete_date = #completeDate#, <!-- 完工日期 -->
quantity = #quantity#, <!-- 数量 -->
finish_quantity = #finishQuantity#, <!-- 完工数量 -->
unfinish_quantity = #unfinishQuantity#, <!-- 未完工数量 -->
single_weight = #singleWeight#, <!-- 单重 -->
total_weight = #totalWeight#, <!-- 总重 -->
finish_weight = #finishWeight#, <!-- 完工重量 -->
unfinish_weight = #unfinishWeight#, <!-- 未完工重量 -->
account_code = #accountCode#, <!-- 帐套 -->
created_by = #createdBy#, <!-- 创建人 -->
created_name = #createdName#, <!-- 创建人名称 -->
created_time = #createdTime#, <!-- 创建时间 -->
updated_by = #updatedBy#, <!-- 更新人 -->
updated_name = #updatedName#, <!-- 修改人名称 -->
updated_time = #updatedTime#, <!-- 更新时间 -->
spec = #spec#,
length = #length#
WHERE
id = #id#
mat_id = #matId#, <!-- 物料清单ID -->
order_id = #orderId#, <!-- 生产计划ID -->
order_detail_id = #orderDetailId#, <!-- 生产计划明细ID -->
tech_flow_id = #techFlowId#, <!-- 工艺流程ID -->
tech_flow_name = #techFlowName#, <!-- 工艺流程名称 -->
invent_process_id = #inventProcessId#, <!-- 存货工序ID,对应HGPZ005A.id -->
process_code = #processCode#, <!-- 工序编码 -->
process_name = #processName#, <!-- 工序名称 -->
process_order = #processOrder#, <!-- 加工顺序 -->
company_code = #companyCode#, <!-- 公司编码 -->
company_name = #companyName#, <!-- 公司名称 -->
dep_code = #depCode#, <!-- 部门编码 -->
dep_name = #depName#, <!-- 部门名称 -->
proj_code = #projCode#, <!-- 项目编码 -->
proj_name = #projName#, <!-- 项目名称 -->
task_code = #taskCode#, <!-- 任务编码 -->
product_type = #productType#, <!-- 产品类型 -->
product_code = #productCode#, <!-- 产品编号 -->
product_name = #productName#, <!-- 产品名称 -->
plan_start_date = #planStartDate#, <!-- 计划开始日期 -->
plan_end_date = #planEndDate#, <!-- 计划结束日期 -->
factory_code = #factoryCode#, <!-- 工厂编号 -->
factory_name = #factoryName#, <!-- 工厂名称 -->
group_code = #groupCode#, <!-- 工作组编号 -->
group_name = #groupName#, <!-- 工作组名称 -->
complete_date = #completeDate#, <!-- 完工日期 -->
quantity = #quantity#, <!-- 数量 -->
finish_quantity = #finishQuantity#, <!-- 完工数量 -->
unfinish_quantity = #unfinishQuantity#, <!-- 未完工数量 -->
single_weight = #singleWeight#, <!-- 单重 -->
total_weight = #totalWeight#, <!-- 总重 -->
finish_weight = #finishWeight#, <!-- 完工重量 -->
unfinish_weight = #unfinishWeight#, <!-- 未完工重量 -->
updated_by = #updatedBy#, <!-- 更新人 -->
updated_name = #updatedName#, <!-- 修改人名称 -->
updated_time = #updatedTime#, <!-- 更新时间 -->
spec = #spec#,
length = #length#
WHERE id = #id#
</update>
<!-- 行锁 -->
......@@ -381,10 +373,10 @@
SET CREATED_TIME = CREATED_TIME
WHERE 1=1
<isNotEmpty prepend=" AND " property="id">
id = #id#
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="ids">
id IN <iterate close=")" open="(" conjunction="," property="ids">#ids[]#</iterate>
ID IN <iterate close=")" open="(" conjunction="," property="ids">#ids[]#</iterate>
</isNotEmpty>
</update>
......
package com.baosight.hggp.hg.sc.util;
import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.core.enums.OrgTypeEnum;
import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.xs.domain.Org;
import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.xservices.xs.util.LoginUserDetails;
import org.apache.commons.collections.CollectionUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
......@@ -31,26 +35,12 @@ public class HgScUtils {
if (LoginUserDetails.isUserAdmin(UserSessionUtils.getLoginName())) {
return;
}
// 查询自己所在组的任务 added by songx at 20240820
// 查询自己所在组的任务 added by songx at 20240820
List<String> allGroupNames = UserSessionUtils.getAllGroupName();
if (CollectionUtils.isNotEmpty(allGroupNames)) {
queryMap.put("groupNames", allGroupNames);
return;
}
// 如果没有组,则查看所在厂区的任务
List<String> factoryNames = UserSessionUtils.getFactoryName();
if (CollectionUtils.isNotEmpty(factoryNames)) {
queryMap.put("factoryNames", factoryNames);
return;
}
// 如果没有厂区,则查看所在公司的任务
List<String> companyCodes = UserSessionUtils.getCompanyCode();
if (CollectionUtils.isNotEmpty(companyCodes)) {
queryMap.put("companyCodes", companyCodes);
return;
queryMap.put("enableRoleAuth", CommonConstant.YesNo.NO_0);
}
// 当用户无组织机构时,抛出异常
throw new PlatException("当前用户未绑定组织机构,无法操作数据,请联系管理员!");
}
}
......
......@@ -6,14 +6,24 @@
<isNotEmpty prepend=" AND " property="accountCode">
ACCOUNT_CODE = #accountCode#
</isNotEmpty>
<!-- 0:不启用角色权限,1或者空:启用-->
<isNotEqual property="enableRoleAuth" compareValue="0">
<include refid="HGXSDataAuth.roleAuthCondition"/>
</isNotEqual>
</sql>
<sql id="roleAuthCondition">
<!-- 无权限时使用 -->
<isNotEmpty prepend=" AND " property="authDepCode">
DEP_CODE = #authDepCode#
</isNotEmpty>
<!-- 仅本人和部门组合 -->
<isEqual prepend=" AND " property="authCombination" compareValue="1">
(CREATED_BY = #authOnlyPeople# OR DEP_CODE IN <iterate close=")" open="(" conjunction=","
property="authDepCodes">#authDepCodes[]#</iterate>)
<isEqual prepend=" AND " property="authCombination" compareValue="1" open="(" close=")">
CREATED_BY = #authOnlyPeople#
OR DEP_CODE IN
<iterate close=")" open="(" conjunction="," property="authDepCodes">
#authDepCodes[]#
</iterate>
</isEqual>
<!-- 仅本人或部门 -->
<isNotEqual prepend=" AND " property="authCombination" compareValue="1">
......@@ -22,7 +32,9 @@
</isNotEmpty>
<isNotEmpty property="authDepCodes">
DEP_CODE IN
<iterate close=")" open="(" conjunction="," property="authDepCodes">#authDepCodes[]#</iterate>
<iterate close=")" open="(" conjunction="," property="authDepCodes">
#authDepCodes[]#
</iterate>
</isNotEmpty>
</isNotEqual>
</sql>
......
......@@ -50,7 +50,7 @@
<EF:EFCodeOption codeName="hggp.hgwd.fileType"/>
</EF:EFComboColumn>
<EF:EFColumn ename="docName" cname="文件名称" enable="false" width="220" sort="true"/>
<EF:EFColumn ename="docType" cname="文件后缀" enable="false" width="100" align="center" sort="true"/>
<EF:EFColumn ename="docType" cname="文件后缀" enable="false" width="110" align="center" sort="true"/>
<EF:EFColumn ename="docVersion" cname="版本号" enable="false" width="90" align="center" sort="true"/>
<EF:EFColumn ename="createdTime" cname="上传时间" parseFormats="['yyyyMMddHHmmss']" editType="datetime"
dateFormat="yyyy-MM-dd HH:mm:ss" align="center" width="140" readonly="true"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment