|
|
@@ -0,0 +1,154 @@
|
|
|
+package com.lc.ibps.components.employee.provider;
|
|
|
+
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
+import javax.annotation.Resource;
|
|
|
+
|
|
|
+import com.lc.ibps.base.framework.table.ICommonDao;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.web.bind.annotation.RequestBody;
|
|
|
+import org.springframework.web.bind.annotation.RequestParam;
|
|
|
+
|
|
|
+import com.lc.ibps.api.base.constants.StateEnum;
|
|
|
+import com.lc.ibps.api.base.query.QueryFilter;
|
|
|
+import com.lc.ibps.base.core.constants.StringPool;
|
|
|
+import com.lc.ibps.base.core.util.BeanUtils;
|
|
|
+import com.lc.ibps.cloud.entity.APIPageList;
|
|
|
+import com.lc.ibps.cloud.entity.APIRequest;
|
|
|
+import com.lc.ibps.cloud.entity.APIResult;
|
|
|
+import com.lc.ibps.cloud.provider.GenericProvider;
|
|
|
+import com.lc.ibps.components.employee.api.ISatisfactionService;
|
|
|
+import com.lc.ibps.components.employee.domain.Satisfaction;
|
|
|
+import com.lc.ibps.components.employee.persistence.entity.SatisfactionPo;
|
|
|
+import com.lc.ibps.components.employee.repository.SatisfactionRepository;
|
|
|
+
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import io.swagger.annotations.ApiParam;
|
|
|
+import io.swagger.annotations.Extension;
|
|
|
+import io.swagger.annotations.ExtensionProperty;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 满意度调查主表 服务类
|
|
|
+ * <pre>
|
|
|
+ * 构建组:ibps-provider-satisfaction
|
|
|
+ * 开发公司:深圳市金源信通科技有限公司
|
|
|
+ * 开发人员:codegen
|
|
|
+ * 创建时间:2025-03-28 17:59:16
|
|
|
+ *</pre>
|
|
|
+ */
|
|
|
+@Api(tags = "满意度调查主表管理", value = "满意度调查主表数据")
|
|
|
+@Service
|
|
|
+public class SatisfactionProvider extends GenericProvider implements ISatisfactionService{
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private SatisfactionRepository satisfactionRepository;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private ICommonDao commonDao;
|
|
|
+
|
|
|
+ @ApiOperation(value = "满意度调查主表列表(分页条件查询)数据", notes = "满意度调查主表列表(分页条件查询)数据")
|
|
|
+ @Override
|
|
|
+ public APIResult<APIPageList<SatisfactionPo>> query(
|
|
|
+ @ApiParam(name = "request", value = "传入查询请求json字符串", required = true)
|
|
|
+ @RequestBody(required = true) APIRequest request) {
|
|
|
+ APIResult<APIPageList<SatisfactionPo>> result = new APIResult<>();
|
|
|
+ try {
|
|
|
+ QueryFilter queryFilter = getQueryFilter(request);
|
|
|
+ List<SatisfactionPo> data = satisfactionRepository.query(queryFilter);
|
|
|
+ APIPageList<SatisfactionPo> apiPageData = getAPIPageList(data);
|
|
|
+ result.setData(apiPageData);
|
|
|
+ } catch (Exception e) {
|
|
|
+ // TODO ERROR => other error message
|
|
|
+ setExceptionResult(result, StateEnum.ERROR.getCode(), StateEnum.ERROR.getText(), e);
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "根据二维码ID查询问卷记录", notes = "根据二维码ID查询问卷记录")
|
|
|
+ @Override
|
|
|
+ public APIResult<List<Map<String,Object>>> getQuestionnaireByQrCodeId(String qrCodeId) {
|
|
|
+ APIResult<List<Map<String,Object>>> result = new APIResult<>();
|
|
|
+ try {
|
|
|
+ String sql = "SELECT \n" +
|
|
|
+ " d.id_ wj_id, d.ti_xing_, d.ti_gan_, d.xuan_xiang_, d.bei_zhu_, d.pai_xu_, d.shi_fou_bi_tian_,\n" +
|
|
|
+ " c.id_ wj_pid, c.wen_juan_ming_che wj_name, \n" +
|
|
|
+ " a.id_ dc_id, a.diao_cha_ming_che dc_name, a.shi_fou_guo_shen_, a.diao_cha_dui_xian,\n" +
|
|
|
+ " q.id_ qr_id \n" +
|
|
|
+ "FROM \n" +
|
|
|
+ " t_qrcodeb q\n" +
|
|
|
+ " INNER JOIN t_myddctjb a ON q.guan_lian_id_ = a.id_\n" +
|
|
|
+ " INNER JOIN t_myddctjbzb b ON a.id_ = b.parent_id_\n" +
|
|
|
+ " INNER JOIN t_myddcwjb c ON b.zi_wen_juan_id_ = c.id_\n" +
|
|
|
+ " INNER JOIN t_myddcwjtmb d ON c.id_ = d.parent_id_\n" +
|
|
|
+ "WHERE q.id_ = '%s'";
|
|
|
+ sql = String.format(sql, qrCodeId);
|
|
|
+ List<Map<String,Object>> list = commonDao.query(sql);
|
|
|
+ result.setData(list);
|
|
|
+ } catch (Exception e) {
|
|
|
+ setExceptionResult(result, StateEnum.ERROR.getCode(), StateEnum.ERROR.getText(), e);
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "根据id查询满意度调查主表", notes = "根据id查询满意度调查主表")
|
|
|
+ @Override
|
|
|
+ public APIResult<SatisfactionPo> get(
|
|
|
+ @ApiParam(name = "id", value = "查询id", required = true)
|
|
|
+ @RequestParam(name = "id", required = true) String id) {
|
|
|
+ APIResult<SatisfactionPo> result = new APIResult<>();
|
|
|
+ try {
|
|
|
+ SatisfactionPo satisfactionPo = satisfactionRepository.loadCascade(id);
|
|
|
+ result.setData(satisfactionPo);
|
|
|
+ } catch (Exception e) {
|
|
|
+ setExceptionResult(result, StateEnum.ERROR.getCode(), StateEnum.ERROR.getText(), e);
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "保存", notes = "保存满意度调查主表信息",
|
|
|
+ extensions = {
|
|
|
+ @Extension(properties = {
|
|
|
+ @ExtensionProperty(name = "submitCtrl", value = StringPool.Y)
|
|
|
+ })
|
|
|
+ })
|
|
|
+ @Override
|
|
|
+ public APIResult<Void> save(
|
|
|
+ @ApiParam(name = "satisfactionPo", value = "满意度调查主表对象", required = true)
|
|
|
+ @RequestBody(required = true) SatisfactionPo satisfactionPo) {
|
|
|
+ APIResult<Void> result = new APIResult<Void>();
|
|
|
+ try {
|
|
|
+ logger.info(" com.lc.ibps.components.provider.SatisfactionProvider.save()--->satisfactionPo: {}", satisfactionPo.toString());
|
|
|
+ Satisfaction domain = satisfactionRepository.newInstance(satisfactionPo);
|
|
|
+ domain.saveCascade();
|
|
|
+ result.setMessage("保存满意度调查主表成功");
|
|
|
+ } catch (Exception e) {
|
|
|
+ setExceptionResult(result, StateEnum.ERROR.getCode(), StateEnum.ERROR.getText(), e);
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "删除", notes = "删除满意度调查主表",
|
|
|
+ extensions = {
|
|
|
+ @Extension(properties = {
|
|
|
+ @ExtensionProperty(name = "submitCtrl", value = StringPool.Y)
|
|
|
+ })
|
|
|
+ })
|
|
|
+ @Override
|
|
|
+ public APIResult<Void> remove(
|
|
|
+ @ApiParam(name = "ids", value = "满意度调查主表ID数组", required = true)
|
|
|
+ @RequestParam(name = "ids", required = true) String[] ids) {
|
|
|
+ APIResult<Void> result = new APIResult<Void>();
|
|
|
+ try {
|
|
|
+ Satisfaction domain = satisfactionRepository.newInstance();
|
|
|
+ domain.deleteByIdsCascade(ids);
|
|
|
+ result.setMessage("删除满意度调查主表成功");
|
|
|
+ } catch (Exception e) {
|
|
|
+ setExceptionResult(result, StateEnum.ERROR.getCode(), StateEnum.ERROR.getText(), e);
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+}
|