Commit 6040ee37 by 宋祥

1.查询报错问题修复

parent 5a2ab32b
...@@ -22,8 +22,15 @@ public class HgScSqlConstant { ...@@ -22,8 +22,15 @@ public class HgScSqlConstant {
public static final String UPDATE_PROJ_NAME = "HGSC001.updateProjName"; public static final String UPDATE_PROJ_NAME = "HGSC001.updateProjName";
} }
/**
*
* @author:songx
* @date:2024/9/8,9:41
*/
public static class HgSc007 { public static class HgSc007 {
// get
public static final String GET = "HGSC007.get";
//app 查询生产任务 //app 查询生产任务
public static final String QUERY_APP = "HGSC007.queryApp"; public static final String QUERY_APP = "HGSC007.queryApp";
} }
......
package com.baosight.hggp.hg.sc.service; package com.baosight.hggp.hg.sc.service;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation; import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.core.dao.DaoUtils; import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.sb.domain.HGSB004A; import com.baosight.hggp.hg.sb.domain.HGSB004A;
import com.baosight.hggp.hg.sc.domain.HGSC006A;
import com.baosight.hggp.hg.sc.domain.HGSC007; import com.baosight.hggp.hg.sc.domain.HGSC007;
import com.baosight.hggp.hg.sc.domain.HGSC008; import com.baosight.hggp.hg.sc.domain.HGSC008;
import com.baosight.hggp.hg.sc.domain.HGSC099; import com.baosight.hggp.hg.sc.domain.HGSC099;
import com.baosight.hggp.hg.sc.tools.HGSCTools; import com.baosight.hggp.hg.sc.tools.HGSCTools;
import com.baosight.hggp.hg.zl.tools.HGZLTools; import com.baosight.hggp.util.AssertUtils;
import com.baosight.hggp.util.*; import com.baosight.hggp.util.DateUtil;
import com.baosight.hggp.util.contants.ACConstants; import com.baosight.hggp.util.EiInfoUtils;
import com.baosight.iplat4j.core.ei.EiBlock; import com.baosight.hggp.util.LogUtils;
import com.baosight.hggp.util.MapUtils;
import com.baosight.hggp.util.StringUtils;
import com.baosight.iplat4j.core.ei.EiConstant; import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo; import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException; import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase; import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import com.baosight.iplat4j.core.util.NumberUtils;
import com.baosight.iplat4j.ed.util.SequenceGenerator;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.*; import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Optional;
/** /**
...@@ -38,6 +39,7 @@ public class ServiceHGSC007A extends ServiceEPBase { ...@@ -38,6 +39,7 @@ public class ServiceHGSC007A extends ServiceEPBase {
Map queryMap = EiInfoUtils.getFirstRow(inInfo); Map queryMap = EiInfoUtils.getFirstRow(inInfo);
String taskId = MapUtils.getString(queryMap, HGSC008.FIELD_task_id); String taskId = MapUtils.getString(queryMap, HGSC008.FIELD_task_id);
HGSC007 hgsc007 = HGSCTools.THGSC007.getById(Long.valueOf(taskId)); HGSC007 hgsc007 = HGSCTools.THGSC007.getById(Long.valueOf(taskId));
AssertUtils.isNull(hgsc007, String.format("任务【%s】不存在", taskId));
HGSC008 hgsc008 = new HGSC008(); HGSC008 hgsc008 = new HGSC008();
BeanUtils.copyProperties(hgsc007,hgsc008); BeanUtils.copyProperties(hgsc007,hgsc008);
......
...@@ -269,6 +269,13 @@ ...@@ -269,6 +269,13 @@
</dynamic> </dynamic>
</sql> </sql>
<select id="get" resultClass="com.baosight.hggp.hg.sc.domain.HGSC007">
SELECT
<include refid="column"/>
FROM ${hggpSchema}.HGSC007
WHERE ID = #id#
</select>
<select id="query" resultClass="com.baosight.hggp.hg.sc.domain.HGSC007"> <select id="query" resultClass="com.baosight.hggp.hg.sc.domain.HGSC007">
SELECT SELECT
<include refid="column"/> <include refid="column"/>
......
...@@ -1280,87 +1280,100 @@ public class HGSCTools { ...@@ -1280,87 +1280,100 @@ public class HGSCTools {
hgsc006a.setUnassignWeight(hgsc006a.getTotalWeight()); hgsc006a.setUnassignWeight(hgsc006a.getTotalWeight());
result.add(hgsc006a); result.add(hgsc006a);
}); });
return result; return result;
}
public static List<HGSC006A> getByOrderCode(String orderCode) {
AssertUtils.isEmpty(orderCode, "订单编号不能为空!");
Map paramMap = new HashMap();
paramMap.put(HGSC006A.FIELD_order_code, orderCode);
List<HGSC006A> results = DaoBase.getInstance().query(HGSC006A.QUERY, paramMap);
return CollectionUtils.isEmpty(results) ? null : results;
}
public static List<HGSC006A> otherById(String orderCode,Long orderDetailId) {
AssertUtils.isEmpty(orderCode, "订单编号不能为空!");
AssertUtils.isTrue(Objects.isNull(orderDetailId)||orderDetailId<=0, "生产订单明细ID不能为空!");
Map paramMap = new HashMap();
paramMap.put(HGSC006A.FIELD_order_code, orderCode);
paramMap.put(HGSC006A.FIELD_id, orderDetailId);
List<HGSC006A> results = DaoBase.getInstance().query(HGSC006A.QUERY_OTHER, paramMap);
return CollectionUtils.isEmpty(results) ? null : results;
}
}
public static class THGSC007{
public static HGSC007 getById(Long taskId){
AssertUtils.isTrue(Objects.isNull(taskId)||taskId<=0, "生产任务ID不能为空!");
HGSC007 results = (HGSC007)DaoBase.getInstance().get(HGSC007.QUERY, HGSC007.FIELD_id, taskId);
return results;
} }
/**
* 锁 public static List<HGSC006A> getByOrderCode(String orderCode) {
* AssertUtils.isEmpty(orderCode, "订单编号不能为空!");
* @param taskIds Map paramMap = new HashMap();
* @return paramMap.put(HGSC006A.FIELD_order_code, orderCode);
*/ List<HGSC006A> results = DaoBase.getInstance().query(HGSC006A.QUERY, paramMap);
public static void lock(List<Long> taskIds) { return CollectionUtils.isEmpty(results) ? null : results;
if (CollectionUtils.isEmpty(taskIds)) { }
return;
} public static List<HGSC006A> otherById(String orderCode, Long orderDetailId) {
Map queryMap = new HashMap(); AssertUtils.isEmpty(orderCode, "订单编号不能为空!");
queryMap.put("ids", taskIds); AssertUtils.isTrue(Objects.isNull(orderDetailId) || orderDetailId <= 0, "生产订单明细ID不能为空!");
DaoBase.getInstance().update(HGSqlConstant.HGSC007.LOCK, queryMap); Map paramMap = new HashMap();
} paramMap.put(HGSC006A.FIELD_order_code, orderCode);
paramMap.put(HGSC006A.FIELD_id, orderDetailId);
/** List<HGSC006A> results = DaoBase.getInstance().query(HGSC006A.QUERY_OTHER, paramMap);
* 查询信息 return CollectionUtils.isEmpty(results) ? null : results;
* }
* @param taskIds
* @return
*/
public static List<HGSC007> list(List<Long> taskIds) {
if (CollectionUtils.isEmpty(taskIds)) {
return null;
}
Map queryMap = new HashMap();
queryMap.put("ids", taskIds);
return DaoBase.getInstance().query(HGSC007.QUERY, queryMap);
}
} }
public static class THGSC008{
/**
public static HGSC008 getById(Long taskId){ * @author:songx
AssertUtils.isTrue(Objects.isNull(taskId)||taskId<=0, "报工单ID不能为空!"); * @date:2024/9/8,9:41
HGSC008 results = (HGSC008)DaoBase.getInstance().get(HGSC008.QUERY, HGSC008.FIELD_id, taskId); */
return results; public static class THGSC007 {
}
/**
public static List<HGSC008> getByTaskId(Long taskId){ * get
AssertUtils.isTrue(Objects.isNull(taskId)||taskId<=0, "生产任务ID不能为空!"); *
List<HGSC008> results = DaoBase.getInstance().query(HGSC008.QUERY, new HashMap<String,Object>(){{put(HGSC008.FIELD_task_id, taskId);}}); * @param taskId
return CollectionUtils.isEmpty(results) ? null : results; * @return
} */
public static HGSC007 getById(Long taskId) {
public static HGSC008 add(EiInfo info){ AssertUtils.isTrue(Objects.isNull(taskId) || taskId <= 0, "生产任务ID不能为空!");
Map resultMap = EiInfoUtils.getFirstRow(info, EiConstant.resultBlock); return (HGSC007) DaoBase.getInstance().get(HgScSqlConstant.HgSc007.GET, HGSC007.FIELD_id, taskId);
String taskId = MapUtils.getString(resultMap, HGSC008.FIELD_task_id); }
HGSC007 hgsc007 = HGSCTools.THGSC007.getById(Long.valueOf(taskId));
HGSC008 hgsc008 = new HGSC008(); /**
BeanUtils.copyProperties(hgsc007,hgsc008); * 锁
*
* @param taskIds
* @return
*/
public static void lock(List<Long> taskIds) {
if (CollectionUtils.isEmpty(taskIds)) {
return;
}
Map queryMap = new HashMap();
queryMap.put("ids", taskIds);
DaoBase.getInstance().update(HGSqlConstant.HGSC007.LOCK, queryMap);
}
/**
* 查询信息
*
* @param taskIds
* @return
*/
public static List<HGSC007> list(List<Long> taskIds) {
if (CollectionUtils.isEmpty(taskIds)) {
return null;
}
Map queryMap = new HashMap();
queryMap.put("ids", taskIds);
return DaoBase.getInstance().query(HGSC007.QUERY, queryMap);
}
}
public static class THGSC008 {
public static HGSC008 getById(Long taskId) {
AssertUtils.isTrue(Objects.isNull(taskId) || taskId <= 0, "报工单ID不能为空!");
HGSC008 results = (HGSC008) DaoBase.getInstance().get(HGSC008.QUERY, HGSC008.FIELD_id, taskId);
return results;
}
public static List<HGSC008> getByTaskId(Long taskId) {
AssertUtils.isTrue(Objects.isNull(taskId) || taskId <= 0, "生产任务ID不能为空!");
List<HGSC008> results = DaoBase.getInstance().query(HGSC008.QUERY, new HashMap<String, Object>() {{
put(HGSC008.FIELD_task_id, taskId);
}});
return CollectionUtils.isEmpty(results) ? null : results;
}
public static HGSC008 add(EiInfo info) {
Map resultMap = EiInfoUtils.getFirstRow(info, EiConstant.resultBlock);
String taskId = MapUtils.getString(resultMap, HGSC008.FIELD_task_id);
HGSC007 hgsc007 = HGSCTools.THGSC007.getById(Long.valueOf(taskId));
HGSC008 hgsc008 = new HGSC008();
BeanUtils.copyProperties(hgsc007, hgsc008);
cleanBaseInfo(hgsc008); cleanBaseInfo(hgsc008);
hgsc008.setTaskId(hgsc007.getId()); hgsc008.setTaskId(hgsc007.getId());
hgsc008.setQuantity(NumberUtils.toInteger(resultMap.get(HGSC008.FIELD_quantity))); hgsc008.setQuantity(NumberUtils.toInteger(resultMap.get(HGSC008.FIELD_quantity)));
......
...@@ -55,9 +55,11 @@ ...@@ -55,9 +55,11 @@
A.DEP_CODE = #authDepCode# A.DEP_CODE = #authDepCode#
</isNotEmpty> </isNotEmpty>
<!-- 仅本人和部门组合 --> <!-- 仅本人和部门组合 -->
<isEqual prepend=" AND " property="authCombination" compareValue="1"> <isEqual prepend=" AND " property="authCombination" compareValue="1" open="(" close=")">
(A.CREATED_BY = #authOnlyPeople# OR A.DEP_CODE IN <iterate close=")" open="(" conjunction="," A.CREATED_BY = #authOnlyPeople# OR A.DEP_CODE IN
property="authDepCodes">#authDepCodes[]#</iterate>) <iterate close=")" open="(" conjunction="," property="authDepCodes">
#authDepCodes[]#
</iterate>
</isEqual> </isEqual>
<!-- 仅本人或部门 --> <!-- 仅本人或部门 -->
<isNotEqual prepend=" AND " property="authCombination" compareValue="1"> <isNotEqual prepend=" AND " property="authCombination" compareValue="1">
...@@ -66,7 +68,9 @@ ...@@ -66,7 +68,9 @@
</isNotEmpty> </isNotEmpty>
<isNotEmpty property="authDepCodes"> <isNotEmpty property="authDepCodes">
A.DEP_CODE IN A.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>
......
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