|
|
@@ -13,15 +13,20 @@ import com.usoftchina.saas.document.service.FundinouttypeService;
|
|
|
import com.usoftchina.saas.exception.BizException;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.util.StringUtils;
|
|
|
|
|
|
import java.util.Date;
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
|
|
|
@Service
|
|
|
public class FundinouttypeServiceImpl extends CommonBaseServiceImpl<FundinouttypeMapper, Fundinouttype> implements FundinouttypeService {
|
|
|
|
|
|
@Autowired
|
|
|
private MessageLogService messageLogService;
|
|
|
+ @Autowired
|
|
|
+ private FundinouttypeMapper fundinouttypeMapper;
|
|
|
|
|
|
/**
|
|
|
* 保存/更新
|
|
|
@@ -63,10 +68,30 @@ public class FundinouttypeServiceImpl extends CommonBaseServiceImpl<Fundinouttyp
|
|
|
*/
|
|
|
@Override
|
|
|
public boolean removeByPrimaryKey(Long id){
|
|
|
+ Fundinouttype fundinouttype = getMapper().selectByPrimaryKey(id);
|
|
|
+ String kind = fundinouttype.getFt_kind();
|
|
|
+ int v_id = 0;
|
|
|
+ if ("收入".equals(kind)){
|
|
|
+ v_id = 1;
|
|
|
+ }else {
|
|
|
+ v_id = 0;
|
|
|
+ }
|
|
|
if(id != null && id > 0){
|
|
|
- getMapper().deleteByPrimaryKey(id);
|
|
|
- //记录LOG
|
|
|
- messageLogService.delete(generateMsgObj(id));
|
|
|
+ Map<String, Object> map = new HashMap<String, Object>();
|
|
|
+ map.put("v_id",v_id);
|
|
|
+ map.put("v_code", fundinouttype.getFt_name());
|
|
|
+ map.put("v_type","fund");
|
|
|
+ map.put("v_companyid",BaseContextHolder.getCompanyId());
|
|
|
+ map.put("v_res","");
|
|
|
+ fundinouttypeMapper.check(map);
|
|
|
+ Object result = map.get("v_res");
|
|
|
+ if(!StringUtils.isEmpty(result)){
|
|
|
+ throw new BizException(BizExceptionCode.USING_EXISTS.getCode(),result.toString());
|
|
|
+ }else {
|
|
|
+ getMapper().deleteByPrimaryKey(id);
|
|
|
+ //记录LOG
|
|
|
+ messageLogService.delete(generateMsgObj(id));
|
|
|
+ }
|
|
|
}
|
|
|
return true;
|
|
|
}
|