RADCommentAction.java
package com.mycim.webapp.actions.rad;
import com.fa.sesa.threadlocal.LocalContext;
import com.mycim.framework.jdbc.Page;
import com.mycim.framework.utils.lang.StringUtils;
import com.mycim.framework.utils.lang.collections.MapUtils;
import com.mycim.framework.utils.msg.JsonUtils;
import com.mycim.valueobject.ObjectList;
import com.mycim.valueobject.ocap.OcapCard;
import com.mycim.valueobject.ocap.dto.RADCommentDTO;
import com.mycim.valueobject.ocap.dto.RadCommentQueryDTO;
import com.mycim.valueobject.sys.ReferenceFileDetail;
import com.mycim.webapp.actions.OcapAbstractAction;
import javax.servlet.http.HttpServletRequest;
import java.util.*;
public class RADCommentAction extends OcapAbstractAction {
public Page queryRAD(RadCommentQueryDTO queryDTO) {
return ocapService.queryRADCommentByPage(queryDTO);
}
public void addRAD(RADCommentDTO radCommentDTO) {
ocapService.addRADComment(radCommentDTO);
}
public void modifyRAD(RADCommentDTO radCommentDTO) {
ocapService.modifyRADComment(radCommentDTO);
}
public void deleteRAD(RADCommentDTO radCommentDTO) {
ocapService.deleteRADComment(radCommentDTO);
}
public List<Map<String, Object>> getRADComment(Map<String, Object> params) {
String ocapId = MapUtils.getString(params, "ocapId");
String lotId = MapUtils.getString(params, "lotId");
lotId = StringUtils.isBlankCheckNull(lotId) ? StringUtils.EMPTY : lotId;
OcapCard ocap = wipQueryService.getOcapCardByUniqueKey(LocalContext.getFacilityRrn(), ocapId, lotId);
String userGroupIds = getOcapSignerUserGroupIds(ocap);
String type = MapUtils.getString(params, "type");
String category = MapUtils.getString(params, "category");
String reasonCode = MapUtils.getString(params, "reasonCode");
String shortDescription = MapUtils.getString(params, "shortDescription");
RADCommentDTO radCommentDto = new RADCommentDTO();
radCommentDto.setCategory(category);
radCommentDto.setReasonCode(reasonCode);
radCommentDto.setShortDescription(shortDescription);
radCommentDto.setCommentType(ocap.getOcapType());
return ocapService.getRADComent(userGroupIds, type, radCommentDto);
}
@Override
protected void initSelectItem(HttpServletRequest request) {
// 用于去重
Set<String> record = new HashSet<>();
long refRrn = getInstanceRrn("$OCAP_HOLD_STATION", LocalContext.getFacilityRrn(),
ObjectList.REFERENCE_FILE_KEY);
List<ReferenceFileDetail> referenceFileDetails = sysService.getReferenceFileDetails(refRrn);
List<Map> list = new ArrayList<>();
for (ReferenceFileDetail referenceFileDetail : referenceFileDetails) {
if (record.add(referenceFileDetail.getData1Value())) {
Map<String, Object> map = new HashMap<>();
map.put("key", referenceFileDetail.getData1Value());
map.put("value", referenceFileDetail.getData1Value());
list.add(map);
}
}
put("COMBOXDATAS", JsonUtils.toString(list), request);
}
}