package com.miniframe.bisiness.mdo; import java.util.Date; import java.util.Map; import com.miniframe.core.ExecProcessFlow; import com.miniframe.core.exception.BusinessException; import com.miniframe.core.ext.UtilTools; import com.miniframe.generate.business.mdo.model.MDO0002BaseModel; import com.miniframe.model.mdo.MdoProject; import com.miniframe.model.mdo.dao.MdoProjectMapper; import com.miniframe.tools.XIDateTimeUtils; import com.miniframe.tools.XiJsonUtil; import tk.mybatis.mapper.util.StringUtil; /** * 西工大系统,“工程添加修改”逻辑处理(重新生成不覆盖)。 */ public class MDO0002Service extends MDO0002BaseModel implements ExecProcessFlow { private static final long serialVersionUID = -7051358269847459502L; /** * 西工大系统,“工程添加修改”业务核心处理 */ public void transExecute() throws Exception { String pid = this.getA_mdo0002().getPid(); String name =this.getA_mdo0002().getName(); String remark =this.getA_mdo0002().getRemark(); String isshare =this.getA_mdo0002().getIsshare(); String image =this.getA_mdo0002().getImage(); String flow =this.getA_mdo0002().getFlow(); String stype =this.getA_mdo0002().getStype(); String uid=this.getA_mdohead().getUserId(); Date nowDate =XIDateTimeUtils.getNowDate(); MdoProjectMapper proDao =UtilTools.getBean(MdoProjectMapper.class); if(StringUtil.isEmpty(pid)){//添加 pid = UtilTools.getUUid(); MdoProject pro =new MdoProject(); pro.setId(pid); pro.setUid(uid); pro.setCreateTime(nowDate); pro.setUpdateTime(nowDate); pro.setFlow(flow); pro.setImage(image); pro.setIsshare(Short.valueOf(isshare)); pro.setName(name); pro.setRemark(remark); pro.setStype(stype); proDao.insert(pro); }else{//修改 MdoProject pro = proDao.selectByPrimaryKey(pid); if(pro==null){ throw new BusinessException("MDO000001"); } pro.setId(pid); pro.setUid(uid); pro.setUpdateTime(nowDate); pro.setFlow(flow); pro.setImage(image); pro.setIsshare(Short.valueOf(isshare)); pro.setName(name); pro.setRemark(remark); pro.setStype(stype); proDao.updateByPrimaryKey(pro); } this.getD_mdo0002().setPid(pid); } /** * 西工大系统,“工程添加修改”业务前处理 */ public void preTransFlow() throws Exception { this.validater(); } /** * 西工大系统,“工程添加修改”业务后处理 */ public void afterTransFlow() throws Exception { } /** * 西工大系统,“工程添加修改”逻辑入口处理方法 */ @SuppressWarnings("rawtypes") @Override public Map execute(Map vars) throws Exception { this.setTransMap(vars); preTransFlow();// 执行业务开始的规则检查和校验 transExecute();// 执行核心业务段 afterTransFlow();// 执行核心逻辑完成后的收尾逻辑 return this.getTransMap(); } }