Commit 1573a8a7 by 王衍超

解决冲突

parents afed52cc 1a6b16e0
......@@ -6,6 +6,11 @@ import com.xyst.dinas.sales.dao.SalesPlanDao;
import com.xyst.dinas.sales.internal.service.SalesPlanServiceImpl;
import com.xyst.dinas.sales.service.SalesPlanService;
import com.xyst.dinas.sales.task.SalesPlanAutoCreateTaskRegister;
import com.xyst.dinas.sales.dao.NeedPlanDao;
import com.xyst.dinas.sales.internal.dao.NeedPlanDaoImpl;
import com.xyst.dinas.sales.internal.service.NeedPlanServiceImpl;
import com.xyst.dinas.sales.service.NeedPlanService;
import com.xyst.dinas.sales.web.NeedPlanController;
import com.xyst.dinas.sales.web.SalesPlanController;
public class SalesConfiguration {
......@@ -30,5 +35,18 @@ public class SalesConfiguration {
return new SalesPlanAutoCreateTaskRegister();
}
public NeedPlanController needPlanController() {
return new NeedPlanController();
}
@Bean
public NeedPlanService needPlanService() {
return new NeedPlanServiceImpl();
}
@Bean
public NeedPlanDao needPlanDao() {
return new NeedPlanDaoImpl();
}
}
package com.xyst.dinas.sales.constant;
public interface NeedPlanConstant {
/**
* 实体名
*/
String NEED_PLAN_NTITY = "com.xyst.dinas.sales.datamodel.NeedPlan";
}
package com.xyst.dinas.sales.dao;
import java.util.UUID;
import com.beecode.bcp.type.KObject;
public interface NeedPlanDao {
KObject queryNeedPlanByContractIdAndCycleId(UUID planningCycleId, UUID contractId);
}
package com.xyst.dinas.sales.internal.dao;
import java.util.List;
import java.util.UUID;
import org.hibernate.HibernateException;
import org.hibernate.Session;
import org.hibernate.query.Query;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.hibernate5.HibernateCallback;
import org.springframework.orm.hibernate5.HibernateOperations;
import com.beecode.bcp.type.KObject;
import com.xyst.dinas.sales.constant.NeedPlanConstant;
import com.xyst.dinas.sales.dao.NeedPlanDao;
public class NeedPlanDaoImpl implements NeedPlanDao, NeedPlanConstant {
@Autowired
private HibernateOperations template;
@Override
public KObject queryNeedPlanByContractIdAndCycleId(UUID planningCycleId, UUID contractId) {
return (KObject)template.execute(new HibernateCallback<KObject>() {
@SuppressWarnings("unchecked")
@Override
public KObject doInHibernate(Session session) throws HibernateException {
Query<KObject> query = session.createQuery("from " + NEED_PLAN_NTITY + " where planningCycle.id=:planningCycleId and contract.id=:contractId and submitState=:submitState", KObject.class);
query.setParameter("planningCycleId", planningCycleId);
query.setParameter("contractId", contractId);
query.setParameter("submitState", "SUBMITTED");
return query.getResultList().get(0);
}
});
}
}
package com.xyst.dinas.sales.internal.service;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.stream.Stream;
import org.springframework.beans.factory.annotation.Autowired;
import com.beecode.bcp.type.KObject;
import com.xyst.dinas.sales.dao.NeedPlanDao;
import com.xyst.dinas.sales.service.NeedPlanService;
public class NeedPlanServiceImpl implements NeedPlanService {
@Autowired
private NeedPlanDao needPlanDao;
@Override
public KObject queryNeedPlanAmountByDinasType(UUID planningCycleId,UUID contractId, UUID dinasTypeId) {
KObject needPlan = needPlanDao.queryNeedPlanByContractIdAndCycleId(planningCycleId, contractId);
List<KObject> needPlanDetailsList = needPlan.get("NeedPlanDetails").toList();
KObject kObject = null;
if (needPlanDetailsList.size() > 0) {
kObject = needPlanDetailsList.stream().filter(detail -> detail.get("dinasType").getUuid("id").equals(dinasTypeId)).findAny().orElse(null);
}
Map<String, Object> map = new HashMap<>();
map.put("needPlanAmount", kObject);
return kObject;
}
}
package com.xyst.dinas.sales.service;
import java.util.Map;
import java.util.UUID;
import com.beecode.bcp.type.KObject;
public interface NeedPlanService {
KObject queryNeedPlanAmountByDinasType(UUID planningCycleId, UUID contractId, UUID DinasTypeId);
}
package com.xyst.dinas.sales.web;
import java.util.Map;
import java.util.UUID;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import com.beecode.bcp.type.KObject;
import com.beecode.inz.basis.team.pojo.ResponseObj;
import com.xyst.dinas.sales.service.NeedPlanService;
@RestController
public class NeedPlanController {
@Autowired
private NeedPlanService needPlanService;
@ResponseBody
@RequestMapping(value = "/needplan/queryNeedPlanAmountByDinasType", method = RequestMethod.GET)
public Object verifyName(@RequestParam("planningCycleId") String planningCycleId,
@RequestParam("contractId") String contractId,
@RequestParam("dinasTypeId") String dinasTypeId) {
KObject kobject = needPlanService.queryNeedPlanAmountByDinasType(UUID.fromString(planningCycleId), UUID.fromString(contractId), UUID.fromString(dinasTypeId));
return ResponseObj.success("success", kobject);
}
}
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