Commit 7f947997 by 宋祥

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

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